phidatahq / phidata

Build AI Assistants with memory, knowledge and tools.
https://docs.phidata.com
Mozilla Public License 2.0
11.24k stars 1.67k forks source link

Error after 4 to 5 queries input #1080

Open Sahme115 opened 2 months ago

Sahme115 commented 2 months ago

error code: 400 - {'error': {'message': "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. the following tool_call_id did not have response messages:

When using the example from cookbook of exa tools after 4 to 5 queries it gives the error which i have stated above, I have tried tavily, duckduckgo and exa same error every time after 4 to 5 queries if the app is running continuously.

When i restart the app it works fine,

Please provide the solution with exa 🙏

ysolanky commented 2 months ago

Hello @Sahme115 !

Can you please share your Assistant config? I am not able to replicate your error using the following script:

from phi.assistant import Assistant
from phi.tools.exa import ExaTools

assistant = Assistant(
    tools=[ExaTools(include_domains=["cnbc.com", "reuters.com", "bloomberg.com"])], show_tool_calls=True
)
assistant.print_response("Search for AAPL news", debug_mode=True, markdown=True)
assistant.print_response("Search for TSLA news", debug_mode=True, markdown=True)
assistant.print_response("Search for VOO news", debug_mode=True, markdown=True)
assistant.print_response("Search for VGT news", debug_mode=True, markdown=True)
assistant.print_response("Search for GOOG news", debug_mode=True, markdown=True)
alexytiger commented 2 months ago

i was observing this error also in different cookbook examples also, for example in sql-rag.