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
For below code, why the 'PythonTools' will always being called? Even I am not say any date or time related words in text?
My opinion is, the python tools will be called when needed. The tool calls is a timeconsuming task, it should be better that the tool called as needed.
importosimportpathlibfromphi.assistantimportAssistantfromphi.llm.openaiimportOpenAIChatfromphi.tools.pythonimportPythonToolsfrompydanticimportBaseModel, Fieldfromdotenvimportload_dotenvload_dotenv()
STORAGE_ROOT=os.getenv('STORAGE_ROOT')
PYTHON_TOOLS_STORAGE=os.getenv('PYTHON_TOOLS')
PYTHON_TOOLS_STORAGE_FOLDER_PATH=os.path.join(STORAGE_ROOT, PYTHON_TOOLS_STORAGE)
classTradesAPIParameter(BaseModel):
startTime: str=Field(None, description="Start time for transaction creation. Use the python_tools tool to generate the code and get the value, in the format '2024-07-26T00:00:00+08:00'.")
endTime: str=Field(None, description="End time for transaction creation. Use the python_tools tool to generate the code and get the value, in the format '2024-07-26T23:59:59+08:00'.")
page: int=Field(1, description="Current page number for pagination.")
size: int=Field(10, description="Number of records per page for pagination.")
movie_assistant=Assistant(
llm=OpenAIChat(model="gpt-4o"),
description="You are a parameter parser for the transaction record query API, responsible for parsing the natural language input by the user into the parameter fields required by this API.",
output_model=TradesAPIParameter,
tools=[PythonTools(base_dir=pathlib.Path(PYTHON_TOOLS_STORAGE_FOLDER_PATH))],
show_tool_calls=False,
debug_mode=False,
)
params=movie_assistant.run("Query the records, and make sure 14 records are displayed per page.")
print("=========================")
print(params)
print("=========================")
The text was updated successfully, but these errors were encountered:
@KevinZhang19870314 can you try adding instructions = ["Only use python tools when ..."] to the Assistant(instructions=[]) clss. Let me know if that helps.
@KevinZhang19870314 can you try adding instructions = ["Only use python tools when ..."] to the Assistant(instructions=[]) clss. Let me know if that helps.
For below code, why the 'PythonTools' will always being called? Even I am not say any date or time related words in text?
My opinion is, the python tools will be called when needed. The tool calls is a timeconsuming task, it should be better that the tool called as needed.
The text was updated successfully, but these errors were encountered: