From b447a743fb432fdbcb59eea11dffd805158c29b3 Mon Sep 17 00:00:00 2001 From: ochafik Date: Tue, 9 Apr 2024 09:41:45 +0100 Subject: [PATCH] agent: revert to json schemas (ts not ready for refs) --- examples/openai/prompting.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/openai/prompting.py b/examples/openai/prompting.py index b3b4848a0..3de252069 100644 --- a/examples/openai/prompting.py +++ b/examples/openai/prompting.py @@ -608,8 +608,8 @@ class ThoughtfulStepsToolsChatHandler(ChatHandler): content='\n'.join([ 'You are a function calling AI model.', 'Here are the tools available:', - # _tools_schema_signatures(self.args.tools, indent=2), - _tools_typescript_signatures(self.args.tools), + _tools_schema_signatures(self.args.tools, indent=2), + # _tools_typescript_signatures(self.args.tools), _please_respond_with_schema( _make_bespoke_schema( response_schema, @@ -714,16 +714,16 @@ def get_chat_handler(args: ChatHandlerArgs, parallel_calls: bool, tool_style: Op # os.environ.get('NO_TS') def _please_respond_with_schema(schema: dict) -> str: - # sig = json.dumps(schema, indent=2) - _ts_converter = SchemaToTypeScriptConverter() - _ts_converter.resolve_refs(schema, 'schema') - sig = _ts_converter.visit(schema) + sig = json.dumps(schema, indent=2) + # _ts_converter = SchemaToTypeScriptConverter() + # # _ts_converter.resolve_refs(schema, 'schema') + # sig = _ts_converter.visit(schema) return f'Please respond in JSON format with the following schema: {sig}' def _tools_typescript_signatures(tools: list[Tool]) -> str: _ts_converter = SchemaToTypeScriptConverter() - for tool in tools: - _ts_converter.resolve_refs(tool.function.parameters, tool.function.name) + # for tool in tools: + # _ts_converter.resolve_refs(tool.function.parameters, tool.function.name) return 'namespace functions {\n' + '\n'.join( '// ' + tool.function.description.replace('\n', '\n// ') + '\n' + ''