Part 5 Assessment DLI Course ‘Building RAG Agents for LLMs’ Gradio Internal Server Error

Ran server_app.py but gradio provides internal server error. The output of server_app.py is
INFO: Started server process [583]
INFO: Waiting for application startup.

__ ___ .__ __. _______ . _______ . ____ ____ _______
| | / \ | \ | | / ____| / || ____|| _ \ \ \ / / | ___|
| | / ^ \ | | | | | __ | (----| |__ | |_) | \ \/ / | |__ | | / /_\ \ | . | | | |
| \ \ | | | / \ / | |
| ----./ _____ \ | |\ | | |__| | .----) | | |____ | |\ \----. \ / | |____ |_______/__/ \__\ |__| \__| \______| |_______/ |_______|| _| .
| _
/ |_______|

LANGSERVE: Playground for chain “/generator/” is live at:
LANGSERVE: │
LANGSERVE: └──> /generator/playground/
LANGSERVE:
LANGSERVE: Playground for chain “/retriever/” is live at:
LANGSERVE: │
LANGSERVE: └──> /retriever/playground/
LANGSERVE:
LANGSERVE: Playground for chain “/basic_chat/” is live at:
LANGSERVE: │
LANGSERVE: └──> /basic_chat/playground/
LANGSERVE:
LANGSERVE: See all available routes at /docs/

LANGSERVE: ⚠️ Using pydantic 2.6.1. OpenAPI docs for invoke, batch, stream, stream_log endpoints will not be generated. API endpoints and playground should work as expected. If you need to see the docs, you can downgrade to pydantic 1. For example, pip install pydantic==1.10.13. See Working with Pydantic v1 while having v2 installed · Issue #10360 · tiangolo/fastapi · GitHub for details.

INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:9012 (Press CTRL+C to quit)
INFO: 172.18.0.5:54812 - “POST /basic_chat/stream HTTP/1.1” 200 OK
ERROR: Exception in ASGI application
Traceback (most recent call last):
File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 269, in call
await wrap(partial(self.listen_for_disconnect, receive))
File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 258, in wrap
await func()
File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 215, in listen_for_disconnect
message = await receive()
^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py”, line 587, in receive
await self.message_event.wait()
File “/usr/local/lib/python3.11/asyncio/locks.py”, line 213, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f53cbda0590

During handling of the above exception, another exception occurred:

  • Exception Group Traceback (most recent call last):
    | File “/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py”, line 426, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File “/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py”, line 84, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File “/usr/local/lib/python3.11/site-packages/fastapi/applications.py”, line 1054, in call
    | await super().call(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/applications.py”, line 116, in call
    | await self.middleware_stack(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py”, line 186, in call
    | raise exc
    | File “/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py”, line 164, in call
    | await self.app(scope, receive, _send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py”, line 62, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py”, line 55, in wrapped_app
    | raise exc
    | File “/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py”, line 44, in wrapped_app
    | await app(scope, receive, sender)
    | File “/usr/local/lib/python3.11/site-packages/starlette/routing.py”, line 746, in call
    | await route.handle(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/routing.py”, line 288, in handle
    | await self.app(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/routing.py”, line 75, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py”, line 55, in wrapped_app
    | raise exc
    | File “/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py”, line 44, in wrapped_app
    | await app(scope, receive, sender)
    | File “/usr/local/lib/python3.11/site-packages/starlette/routing.py”, line 73, in app
    | await response(scope, receive, send)
    | File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 255, in call
    | async with anyio.create_task_group() as task_group:
    | File “/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py”, line 678, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    ±±--------------- 1 ----------------
    | Traceback (most recent call last):
    | File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 258, in wrap
    | await func()
    | File “/usr/local/lib/python3.11/site-packages/sse_starlette/sse.py”, line 245, in stream_response
    | async for data in self.body_iterator:
    | File “/usr/local/lib/python3.11/site-packages/langserve/api_handler.py”, line 911, in _stream
    | async for chunk in self._runnable.astream(
    | File “/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 2449, in astream
    | async for chunk in self.atransform(input_aiter(), config, **kwargs):
    | File “/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 2432, in atransform
    | async for chunk in self._atransform_stream_with_config(
    | File “/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 1595, in _atransform_stream_with_config
    | chunk: Output = await asyncio.create_task( # type: ignore[call-arg]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File “/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 2395, in _atransform
    | final_pipeline = step.atransform(
    | ^^^^^^^^^^^^^^^^
    | File “/usr/local/lib/python3.11/site-packages/langchain_core/runnables/base.py”, line 3081, in atransform
    | raise NotImplementedError(“This runnable does not support async methods.”)
    | NotImplementedError: This runnable does not support async methods.
1 Like

I am facing the exact same issue, and have been losing it pretty much. Did you try going through this most viewed issue. Part 5 Assessment in DLI Course ‘Building RAG Agents for LLMs’

Did anyone find a fix for this issue? Facing the same issue. @boi-doingthings @m4gaikwad