john-adeojo / graph_websearch_agent

Websearch agent built on the LangGraph framework
MIT License
225 stars 87 forks source link

while using GEMINI API KEY--Warning: 'next_agent' key not found in RouterAgent response. Defaulting to 'default_agent'. #6

Closed Richardson143 closed 3 months ago

Richardson143 commented 3 months ago

Traceback (most recent call last): File "E:\Appdata\program files\python\projects\graph_websearch_agent.venv\Lib\site-packages\chainlit\utils.py", line 40, in wrapper return await user_function(*params_values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Appdata\program files\python\projects\graph_websearch_agent\app/chat.py", line 194, in main response = await cl.make_async(chat_workflow.invoke_workflow)(message) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Appdata\program files\python\projects\graph_websearch_agent.venv\Lib\site-packages\asyncer_main.py", line 358, in wrapper return await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Appdata\program files\python\projects\graph_websearch_agent.venv\Lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Appdata\program files\python\projects\graph_websearch_agent.venv\Lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "E:\Appdata\program files\Lib\asyncio\futures.py", line 287, in await yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "E:\Appdata\program files\Lib\asyncio\tasks.py", line 385, in __wakeup future.result() File "E:\Appdata\program files\Lib\asyncio\futures.py", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "E:\Appdata\program files\python\projects\graph_websearch_agent.venv\Lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Appdata\program files\python\projects\graph_websearch_agent\app/chat.py", line 68, in invoke_workflow next_agent_value = reviewer_state_dict["next_agent"]


KeyError: 'next_agent'
john-adeojo commented 3 months ago

What REQUEST RESPONSE error code did you get? This should be printed in white in your cmd prompt or powershell.

Richardson143 commented 3 months ago

Request Response - 429

john-adeojo commented 3 months ago

429 means too many requests, you're probably on the free plan for gemini so you're hitting rate limits. That's why the "next_agent" key is missing, the model hasn't generated anything.

Richardson143 commented 3 months ago

image

yes, I was using the Free plan of Gemini Maybe that was the issue but it should be a rate limit error, and even when I tried with Groq the error for rate limit is so clear -REQUEST RESPONSE 400-"Recursion limit of 40 reached without hitting a stop condition. You can increase the limit by setting the recursion_limit config key."

john-adeojo commented 3 months ago

recursion_limit means the workflow cycled through 40 iterations without being able to answer your question. You can increase this on the settings menu in the front end. For Gemini 429 error means you have exceeded your request quota https://cloud.google.com/vertex-ai/docs/general/troubleshooting?component=any#error_code_429. If your question is complex, it might take the workflow several iterations before it can get to an answer, so try increasing the recursion limit.