Skip to content

Commit 38329c8

Browse files
committed
agent: revert to json schemas (ts not ready for refs)
1 parent 084470f commit 38329c8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

examples/openai/prompting.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ def __init__(self, args: ChatHandlerArgs, parallel_calls: bool):
608608
content='\n'.join([
609609
'You are a function calling AI model.',
610610
'Here are the tools available:',
611-
# _tools_schema_signatures(self.args.tools, indent=2),
612-
_tools_typescript_signatures(self.args.tools),
611+
_tools_schema_signatures(self.args.tools, indent=2),
612+
# _tools_typescript_signatures(self.args.tools),
613613
_please_respond_with_schema(
614614
_make_bespoke_schema(
615615
response_schema,
@@ -714,16 +714,16 @@ def get_chat_handler(args: ChatHandlerArgs, parallel_calls: bool, tool_style: Op
714714

715715
# os.environ.get('NO_TS')
716716
def _please_respond_with_schema(schema: dict) -> str:
717-
# sig = json.dumps(schema, indent=2)
718-
_ts_converter = SchemaToTypeScriptConverter()
719-
_ts_converter.resolve_refs(schema, 'schema')
720-
sig = _ts_converter.visit(schema)
717+
sig = json.dumps(schema, indent=2)
718+
# _ts_converter = SchemaToTypeScriptConverter()
719+
# # _ts_converter.resolve_refs(schema, 'schema')
720+
# sig = _ts_converter.visit(schema)
721721
return f'Please respond in JSON format with the following schema: {sig}'
722722

723723
def _tools_typescript_signatures(tools: list[Tool]) -> str:
724724
_ts_converter = SchemaToTypeScriptConverter()
725-
for tool in tools:
726-
_ts_converter.resolve_refs(tool.function.parameters, tool.function.name)
725+
# for tool in tools:
726+
# _ts_converter.resolve_refs(tool.function.parameters, tool.function.name)
727727

728728
return 'namespace functions {\n' + '\n'.join(
729729
'// ' + tool.function.description.replace('\n', '\n// ') + '\n' + ''

0 commit comments

Comments
 (0)