Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPStatusError("Client error '422 Unprocessable Entity' ... #5

Open
wkdghdus opened this issue Oct 17, 2024 · 3 comments
Open

HTTPStatusError("Client error '422 Unprocessable Entity' ... #5

wkdghdus opened this issue Oct 17, 2024 · 3 comments

Comments

@wkdghdus
Copy link

wkdghdus commented Oct 17, 2024

Hi, there are some issues trying to implement this template to the project I am working on.

When I import this project straight into my project without any modification, it returns such error.

HTTPStatusError("Client error '422 Unprocessable Entity' for url 'http://api/threads/c7ff1dda-9fb2-4aac-aaf2-c77598d66938/runs'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422")Traceback (most recent call last):


  File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/__init__.py", line 1511, in astream
    async for _ in runner.atick(


  File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/runner.py", line 194, in atick
    _panic_or_proceed(


  File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/runner.py", line 273, in _panic_or_proceed
    raise exc


  File "/usr/local/lib/python3.11/site-packages/langgraph/pregel/retry.py", line 102, in arun_with_retry
    await task.proc.ainvoke(task.input, config)


  File "/usr/local/lib/python3.11/site-packages/langgraph/utils/runnable.py", line 453, in ainvoke
    input = await asyncio.create_task(coro, context=context)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  File "/usr/local/lib/python3.11/site-packages/langgraph/utils/runnable.py", line 236, in ainvoke
    ret = await asyncio.create_task(coro, context=context)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  File "/deps/__outer_interiorGPT/src/squads/conversationTeam/chatbot/graph.py", line 50, in schedule_memories
    await memory_client.runs.create(


  File "/usr/local/lib/python3.11/site-packages/langgraph_sdk/client.py", line 1474, in create
    return await self.http.post(f"/threads/{thread_id}/runs", json=payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


  File "/usr/local/lib/python3.11/site-packages/langgraph_sdk/client.py", line 229, in post
    raise e


  File "/usr/local/lib/python3.11/site-packages/langgraph_sdk/client.py", line 222, in post
    r.raise_for_status()


  File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 763, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)


httpx.HTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://api/threads/c7ff1dda-9fb2-4aac-aaf2-c77598d66938/runs'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422


Invalid assistant ID

There is no problem running the memory state separately, and I've figured that it is a problem with get_client() not being able to run in the background. I've tried inputting url parameter as http://localhost:8123, yet the error changes to ConnectError('All connection attempts failed') but does not fix.

what possibly could happen here? All I did was to copy paste the code into my repository, changed the import to absolute path, and all the models to openAI. the same code works perfectly in the template.

@wkdghdus
Copy link
Author

I've been trying to run the template using langgraph up and the debugger. but it seems like the memory isn't updating when I use this method. It runs perfectly on the desktop CLI. But when I use the debugger and langgraph up command I get this error, resulting in memories not getting updated

langgraph-api-1       | 2024-10-17T09:52:19.659927Z [warning  ] Ignoring unknown node name handle_patch_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.660303Z [warning  ] Ignoring unknown node name handle_insertion_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.661846Z [warning  ] Ignoring unknown node name handle_patch_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.661999Z [warning  ] Ignoring unknown node name handle_insertion_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.668279Z [warning  ] Ignoring unknown node name handle_patch_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.668368Z [warning  ] Ignoring unknown node name handle_insertion_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.674180Z [warning  ] Ignoring unknown node name handle_patch_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       | 2024-10-17T09:52:19.674241Z [warning  ] Ignoring unknown node name handle_insertion_memory in pending sends [langgraph] api_revision=0bf6edd api_variant=licensed
langgraph-api-1       |

@wkdghdus
Copy link
Author

wkdghdus commented Oct 17, 2024

I've solved this problem by modifying langgraph.json file.

I've initially assigned the graph names like these
"convo/chatBot": "path/to/chatbot/graph.py:graph"
"convo/memoryGraph": path/to/memory/graph.py:graph"

I think this for some reason hindered the ability for get_client to fetch the memory graph.
(I have no idea how get_client() fetches the correct graph without any specification)

but when I changed the graph names to "chatBot" "memoryGraph", it worked as intended.

can somebody possibly explain why this solution worked?

@hinthornw
Copy link
Contributor

It's

mem_assistant_id: str = (

the assistant ID configuration value can etiher be a graph name or an assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants