You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromagentsimportAgent, AgentHooks, RunContextWrapper, Tool, function_toolfromagents.extensions.handoff_promptimportprompt_with_handoff_instructionsfrompydanticimportBaseModelfromtrading.constantsimporttrading_templatesfromtrading.alpaca_serviceimportalpaca_serviceclassTextChatOutputType(BaseModel):
"""Represents a chat response from an agent."""response: str# @function_toolasyncdefcall_backend_method(method_name: str, kwargs: dict):
returngetattr(alpaca_service, method_name)(**kwargs)
template_agent=Agent(
name="template_agent",
instructions=prompt_with_handoff_instructions(
f""" blah """
),
model="gpt-4.1",
tools=[], # Add DB/API tools as neededhooks=RuntimeEvents,
)
orchestrator=Agent(
name="alpaca_trading_assistant",
instructions=prompt_with_handoff_instructions(
""" blah """
),
model="gpt-4.1",
tools=[
template_agent.as_tool(
tool_name="template_agent_tool",
tool_description="Classify user intent and map to template and method",
),
call_backend_method
],
hooks=RuntimeEvents,
)
If I uncomment @function_tool, I get this error:
File "/app/assistant-be_py/assistant/voice_utils.py", line 68, in <module>
@function_tool
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/tool.py", line 414, in function_tool
return _create_function_tool(func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/tool.py", line 324, in _create_function_tool
schema = function_schema(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/function_schema.py", line 333, in function_schema
json_schema = ensure_strict_json_schema(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 26, in ensure_strict_json_schema
return _ensure_strict_json_schema(schema, path=(), root=schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 72, in _ensure_strict_json_schema
key: _ensure_strict_json_schema(prop_schema, path=(*path, "properties", key), root=root)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@function_tool
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/tool.py", line 414, in function_tool
return _create_function_tool(func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/tool.py", line 324, in _create_function_tool
schema = function_schema(
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/function_schema.py", line 333, in function_schema
json_schema = ensure_strict_json_schema(json_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 26, in ensure_strict_json_schema
return _ensure_strict_json_schema(schema, path=(), root=schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 59, in _ensure_strict_json_schema
raise UserError(
agents.exceptions.UserError: additionalProperties should not be set for object types. This could be because you're using an older version of Pydantic, or because you configured additional properties to be allowed. If you really need this, update the function or output tool to not use a strict schema.
openai.agents: Shutting down trace provider
openai.agents: Shutting down trace processor <agents.tracing.processors.BatchTraceProcessor object at 0x7f0858ce2bd0>
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 72, in _ensure_strict_json_schema
key: _ensure_strict_json_schema(prop_schema, path=(*path, "properties", key), root=root)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/agents/strict_schema.py", line 59, in _ensure_strict_json_schema
raise UserError(
agents.exceptions.UserError: additionalProperties should not be set for object types. This could be because you're using an older version of Pydantic, or because you configured additional properties to be allowed. If you really need this, update the function or output tool to not use a strict schema.
openai.agents: Shutting down trace provider
openai.agents: Shutting down trace processor <agents.tracing.processors.BatchTraceProcessor object at 0x7f654aaf6ae0>
The text was updated successfully, but these errors were encountered:
Am getting this error that can't debug:
If I uncomment
@function_tool
, I get this error:The text was updated successfully, but these errors were encountered: