agent: revert to json schemas (ts not ready for refs)
This commit is contained in:
parent
701a66d80f
commit
b447a743fb
1 changed files with 8 additions and 8 deletions
|
@ -608,8 +608,8 @@ class ThoughtfulStepsToolsChatHandler(ChatHandler):
|
||||||
content='\n'.join([
|
content='\n'.join([
|
||||||
'You are a function calling AI model.',
|
'You are a function calling AI model.',
|
||||||
'Here are the tools available:',
|
'Here are the tools available:',
|
||||||
# _tools_schema_signatures(self.args.tools, indent=2),
|
_tools_schema_signatures(self.args.tools, indent=2),
|
||||||
_tools_typescript_signatures(self.args.tools),
|
# _tools_typescript_signatures(self.args.tools),
|
||||||
_please_respond_with_schema(
|
_please_respond_with_schema(
|
||||||
_make_bespoke_schema(
|
_make_bespoke_schema(
|
||||||
response_schema,
|
response_schema,
|
||||||
|
@ -714,16 +714,16 @@ def get_chat_handler(args: ChatHandlerArgs, parallel_calls: bool, tool_style: Op
|
||||||
|
|
||||||
# os.environ.get('NO_TS')
|
# os.environ.get('NO_TS')
|
||||||
def _please_respond_with_schema(schema: dict) -> str:
|
def _please_respond_with_schema(schema: dict) -> str:
|
||||||
# sig = json.dumps(schema, indent=2)
|
sig = json.dumps(schema, indent=2)
|
||||||
_ts_converter = SchemaToTypeScriptConverter()
|
# _ts_converter = SchemaToTypeScriptConverter()
|
||||||
_ts_converter.resolve_refs(schema, 'schema')
|
# # _ts_converter.resolve_refs(schema, 'schema')
|
||||||
sig = _ts_converter.visit(schema)
|
# sig = _ts_converter.visit(schema)
|
||||||
return f'Please respond in JSON format with the following schema: {sig}'
|
return f'Please respond in JSON format with the following schema: {sig}'
|
||||||
|
|
||||||
def _tools_typescript_signatures(tools: list[Tool]) -> str:
|
def _tools_typescript_signatures(tools: list[Tool]) -> str:
|
||||||
_ts_converter = SchemaToTypeScriptConverter()
|
_ts_converter = SchemaToTypeScriptConverter()
|
||||||
for tool in tools:
|
# for tool in tools:
|
||||||
_ts_converter.resolve_refs(tool.function.parameters, tool.function.name)
|
# _ts_converter.resolve_refs(tool.function.parameters, tool.function.name)
|
||||||
|
|
||||||
return 'namespace functions {\n' + '\n'.join(
|
return 'namespace functions {\n' + '\n'.join(
|
||||||
'// ' + tool.function.description.replace('\n', '\n// ') + '\n' + ''
|
'// ' + tool.function.description.replace('\n', '\n// ') + '\n' + ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue