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

TypeError in ollama_completion_stream with local file connector #3225

Open
GedKalessin opened this issue Nov 23, 2024 · 2 comments
Open

TypeError in ollama_completion_stream with local file connector #3225

GedKalessin opened this issue Nov 23, 2024 · 2 comments

Comments

@GedKalessin
Copy link

I get the following error while using the search tool in Danswer (Knowledge Persona) with Ollama installed locally:
Traceback (most recent call last):
File "/app/danswer/chat/process_message.py", line 644, in stream_chat_message_objects
for packet in answer.processed_streamed_output:
File "/app/danswer/llm/answering/answer.py", line 281, in processed_streamed_output
for processed_packet in self._get_response([llm_call]):
File "/app/danswer/llm/answering/answer.py", line 245, in _get_response
yield from response_handler_manager.handle_llm_response(stream)
File "/app/danswer/llm/answering/llm_response_handler.py", line 69, in handle_llm_response
for message in stream:
File "/app/danswer/llm/chat_llm.py", line 459, in _stream_implementation
for part in response:
File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 427, in ollama_completion_stream
raise e
File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 403, in ollama_completion_stream
response_content = "".join(content_chunks)
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 30: expected str instance, NoneType found.

The followings are some logs from the docker containers:

1 -----------------------------------------------------------------------------------------------------------------------------------------

024-11-20 13:45:25 INFO: 11/20/2024 12:45:25 PM h11_impl.py 499: 172.23.0.10:39208 - "PATCH /user/recent-assistants HTTP/1.1" 200
2024-11-20 13:45:25 ERROR: 11/20/2024 12:45:25 PM utils.py 434: Failed to get max tokens for LLM with name llama3.2. Defaulting to 4096.
2024-11-20 13:45:25 Traceback (most recent call last):
2024-11-20 13:45:25 File "/app/danswer/llm/utils.py", line 415, in get_llm_max_tokens
2024-11-20 13:45:25 raise RuntimeError(
2024-11-20 13:45:25 RuntimeError: No litellm entry found for ollama/llama3.2
2024-11-20 13:45:25 INFO: 11/20/2024 12:45:25 PM h11_impl.py 499: 172.23.0.10:39214 - "GET /chat/max-selected-document-tokens?persona_id=1 HTTP/1.1" 200
2024-11-20 13:45:37 INFO: 11/20/2024 12:45:37 PM h11_impl.py 499: 172.23.0.10:47146 - "POST /chat/create-chat-session HTTP/1.1" 200
2024-11-20 13:45:37 INFO: 11/20/2024 12:45:37 PM h11_impl.py 499: 172.23.0.10:47152 - "POST /chat/send-message HTTP/1.1" 200
2024-11-20 13:45:37 ERROR: 11/20/2024 12:45:37 PM utils.py 434: Failed to get max tokens for LLM with name llama3.2. Defaulting to 4096.
2024-11-20 13:45:37 Traceback (most recent call last):
2024-11-20 13:45:37 File "/app/danswer/llm/utils.py", line 415, in get_llm_max_tokens
2024-11-20 13:45:37 raise RuntimeError(
2024-11-20 13:45:37 RuntimeError: No litellm entry found for ollama/llama3.2
2024-11-20 13:45:37 ERROR: 11/20/2024 12:45:37 PM utils.py 434: Failed to get max tokens for LLM with name llama3.2. Defaulting to 4096.
2024-11-20 13:45:37 Traceback (most recent call last):
2024-11-20 13:45:37 File "/app/danswer/llm/utils.py", line 415, in get_llm_max_tokens
2024-11-20 13:45:37 raise RuntimeError(
2024-11-20 13:45:37 RuntimeError: No litellm entry found for ollama/llama3.2
2024-11-20 13:45:53 INFO: 11/20/2024 12:45:53 PM tool_response_handler.py 90: Selecting single tool from tools: []
2024-11-20 13:45:53 NOTICE: 11/20/2024 12:45:53 PM tool_response_handler.py 105: Chosen tool: None
2024-11-20 13:45:54 ERROR: 11/20/2024 12:45:54 PM process_message.py 756: Failed to process chat message.
2024-11-20 13:45:54 Traceback (most recent call last):
2024-11-20 13:45:54 File "/app/danswer/chat/process_message.py", line 644, in stream_chat_message_objects
2024-11-20 13:45:54 for packet in answer.processed_streamed_output:
2024-11-20 13:45:54 File "/app/danswer/llm/answering/answer.py", line 281, in processed_streamed_output
2024-11-20 13:45:54 for processed_packet in self._get_response([llm_call]):
2024-11-20 13:45:54 File "/app/danswer/llm/answering/answer.py", line 245, in _get_response
2024-11-20 13:45:54 yield from response_handler_manager.handle_llm_response(stream)
2024-11-20 13:45:54 File "/app/danswer/llm/answering/llm_response_handler.py", line 69, in handle_llm_response
2024-11-20 13:45:54 for message in stream:
2024-11-20 13:45:54 File "/app/danswer/llm/chat_llm.py", line 459, in _stream_implementation
2024-11-20 13:45:54 for part in response:
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 427, in ollama_completion_stream
2024-11-20 13:45:54 raise e
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 403, in ollama_completion_stream
2024-11-20 13:45:54 response_content = "".join(content_chunks)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 TypeError: sequence item 28: expected str instance, NoneType found
2024-11-20 13:45:54 INFO: 11/20/2024 12:45:54 PM timing.py 76: stream_chat_message took 17.167276620864868 seconds
2024-11-20 13:45:54 ERROR: 11/20/2024 12:45:54 PM main.py 212: Could not trace chat message history
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-11-20 13:45:54 await self.app(scope, receive, _send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in call
2024-11-20 13:45:54 await self.simple_response(scope, receive, send, request_headers=headers)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
2024-11-20 13:45:54 await self.app(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
2024-11-20 13:45:54 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 13:45:54 raise exc
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 13:45:54 await app(scope, receive, sender)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
2024-11-20 13:45:54 await self.middleware_stack(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
2024-11-20 13:45:54 await route.handle(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
2024-11-20 13:45:54 await self.app(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
2024-11-20 13:45:54 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 13:45:54 raise exc
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 13:45:54 await app(scope, receive, sender)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
2024-11-20 13:45:54 response = await func(request)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
2024-11-20 13:45:54 raise e
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
2024-11-20 13:45:54 raw_response = await run_endpoint_function(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-11-20 13:45:54 return await run_in_threadpool(dependant.call, **values)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-11-20 13:45:54 return await anyio.to_thread.run_sync(func, *args)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-11-20 13:45:54 return await get_async_backend().run_sync_in_worker_thread(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2024-11-20 13:45:54 return await future
2024-11-20 13:45:54 ^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
2024-11-20 13:45:54 result = context.run(func, *args)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/app/danswer/server/query_and_chat/chat_backend.py", line 230, in rename_chat_session
2024-11-20 13:45:54 final_msg, history_msgs = create_chat_chain(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/app/danswer/chat/chat_utils.py", line 86, in create_chat_chain
2024-11-20 13:45:54 raise RuntimeError("Could not trace chat message history")
2024-11-20 13:45:54
2024-11-20 13:45:54 INFO: 11/20/2024 12:45:54 PM h11_impl.py 499: 172.23.0.10:44760 - "PUT /chat/rename-chat-session HTTP/1.1" 500
2024-11-20 13:45:54 ERROR: Exception in ASGI application
2024-11-20 13:45:54 Traceback (most recent call last):
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi
2024-11-20 13:45:54 result = await app( # type: ignore[func-returns-value]
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-11-20 13:45:54 return await self.app(scope, receive, send)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-11-20 13:45:54 await super().call(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-11-20 13:45:54 await self.middleware_stack(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-11-20 13:45:54 raise exc
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-11-20 13:45:54 await self.app(scope, receive, _send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in call
2024-11-20 13:45:54 await self.simple_response(scope, receive, send, request_headers=headers)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
2024-11-20 13:45:54 await self.app(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
2024-11-20 13:45:54 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 13:45:54 raise exc
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 13:45:54 await app(scope, receive, sender)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
2024-11-20 13:45:54 await self.middleware_stack(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
2024-11-20 13:45:54 await route.handle(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
2024-11-20 13:45:54 await self.app(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
2024-11-20 13:45:54 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 13:45:54 raise exc
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 13:45:54 await app(scope, receive, sender)
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
2024-11-20 13:45:54 response = await func(request)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
2024-11-20 13:45:54 raise e
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
2024-11-20 13:45:54 raw_response = await run_endpoint_function(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-11-20 13:45:54 return await run_in_threadpool(dependant.call, **values)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-11-20 13:45:54 return await anyio.to_thread.run_sync(func, *args)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-11-20 13:45:54 return await get_async_backend().run_sync_in_worker_thread(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2024-11-20 13:45:54 return await future
2024-11-20 13:45:54 ^^^^^^^^^^^^
2024-11-20 13:45:54 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
2024-11-20 13:45:54 result = context.run(func, *args)
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/app/danswer/server/query_and_chat/chat_backend.py", line 230, in rename_chat_session
2024-11-20 13:45:54 final_msg, history_msgs = create_chat_chain(
2024-11-20 13:45:54 ^^^^^^^^^^^^^^^^^^
2024-11-20 13:45:54 File "/app/danswer/chat/chat_utils.py", line 86, in create_chat_chain
2024-11-20 13:45:54 raise RuntimeError("Could not trace chat message history")
2024-11-20 13:45:54 RuntimeError: Could not trace chat message history

2 ----------------------------------------------------------------------------------------------------------------

2024-11-20 14:42:10 INFO: 11/20/2024 01:42:10 PM utils.py 421: Max tokens for mistral: 8192 (from max_input_tokens)
2024-11-20 14:42:10 INFO: 11/20/2024 01:42:10 PM utils.py 421: Max tokens for mistral: 8192 (from max_input_tokens)
2024-11-20 14:42:28 INFO: 11/20/2024 01:42:28 PM tool_response_handler.py 90: Selecting single tool from tools: []
2024-11-20 14:42:28 NOTICE: 11/20/2024 01:42:28 PM tool_response_handler.py 105: Chosen tool: None
2024-11-20 14:42:28 ERROR: 11/20/2024 01:42:28 PM process_message.py 756: Failed to process chat message.
2024-11-20 14:42:28 Traceback (most recent call last):
2024-11-20 14:42:28 File "/app/danswer/chat/process_message.py", line 644, in stream_chat_message_objects
2024-11-20 14:42:28 for packet in answer.processed_streamed_output:
2024-11-20 14:42:28 File "/app/danswer/llm/answering/answer.py", line 281, in processed_streamed_output
2024-11-20 14:42:28 for processed_packet in self._get_response([llm_call]):
2024-11-20 14:42:28 File "/app/danswer/llm/answering/answer.py", line 245, in _get_response
2024-11-20 14:42:28 yield from response_handler_manager.handle_llm_response(stream)
2024-11-20 14:42:28 File "/app/danswer/llm/answering/llm_response_handler.py", line 69, in handle_llm_response
2024-11-20 14:42:28 for message in stream:
2024-11-20 14:42:28 File "/app/danswer/llm/chat_llm.py", line 459, in _stream_implementation
2024-11-20 14:42:28 for part in response:
2024-11-20 14:42:28 File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 427, in ollama_completion_stream
2024-11-20 14:42:28 raise e
2024-11-20 14:42:28 File "/usr/local/lib/python3.11/site-packages/litellm/llms/ollama.py", line 403, in ollama_completion_stream
2024-11-20 14:42:28 response_content = "".join(content_chunks)
2024-11-20 14:42:28 ^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:28 TypeError: sequence item 29: expected str instance, NoneType found
2024-11-20 14:42:28 INFO: 11/20/2024 01:42:28 PM timing.py 76: stream_chat_message took 18.63579797744751 seconds
2024-11-20 14:42:29 ERROR: 11/20/2024 01:42:29 PM main.py 212: Could not trace chat message history
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-11-20 14:42:29 await self.app(scope, receive, _send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in call
2024-11-20 14:42:29 await self.simple_response(scope, receive, send, request_headers=headers)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
2024-11-20 14:42:29 await self.app(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
2024-11-20 14:42:29 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 14:42:29 raise exc
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 14:42:29 await app(scope, receive, sender)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
2024-11-20 14:42:29 await self.middleware_stack(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
2024-11-20 14:42:29 await route.handle(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
2024-11-20 14:42:29 await self.app(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
2024-11-20 14:42:29 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 14:42:29 raise exc
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 14:42:29 await app(scope, receive, sender)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
2024-11-20 14:42:29 response = await func(request)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
2024-11-20 14:42:29 raise e
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
2024-11-20 14:42:29 raw_response = await run_endpoint_function(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-11-20 14:42:29 return await run_in_threadpool(dependant.call, **values)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-11-20 14:42:29 return await anyio.to_thread.run_sync(func, *args)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-11-20 14:42:29 return await get_async_backend().run_sync_in_worker_thread(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2024-11-20 14:42:29 return await future
2024-11-20 14:42:29 ^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
2024-11-20 14:42:29 result = context.run(func, *args)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/app/danswer/server/query_and_chat/chat_backend.py", line 230, in rename_chat_session
2024-11-20 14:42:29 final_msg, history_msgs = create_chat_chain(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/app/danswer/chat/chat_utils.py", line 86, in create_chat_chain
2024-11-20 14:42:29 raise RuntimeError("Could not trace chat message history")
2024-11-20 14:42:29
2024-11-20 14:42:29 INFO: 11/20/2024 01:42:29 PM h11_impl.py 499: 172.23.0.10:39208 - "PUT /chat/rename-chat-session HTTP/1.1" 500
2024-11-20 14:42:29 ERROR: Exception in ASGI application
2024-11-20 14:42:29 Traceback (most recent call last):
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi
2024-11-20 14:42:29 result = await app( # type: ignore[func-returns-value]
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-11-20 14:42:29 return await self.app(scope, receive, send)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-11-20 14:42:29 await super().call(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-11-20 14:42:29 await self.middleware_stack(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-11-20 14:42:29 raise exc
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-11-20 14:42:29 await self.app(scope, receive, _send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in call
2024-11-20 14:42:29 await self.simple_response(scope, receive, send, request_headers=headers)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
2024-11-20 14:42:29 await self.app(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
2024-11-20 14:42:29 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 14:42:29 raise exc
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 14:42:29 await app(scope, receive, sender)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 758, in call
2024-11-20 14:42:29 await self.middleware_stack(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
2024-11-20 14:42:29 await route.handle(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
2024-11-20 14:42:29 await self.app(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
2024-11-20 14:42:29 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-11-20 14:42:29 raise exc
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-11-20 14:42:29 await app(scope, receive, sender)
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
2024-11-20 14:42:29 response = await func(request)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
2024-11-20 14:42:29 raise e
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
2024-11-20 14:42:29 raw_response = await run_endpoint_function(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
2024-11-20 14:42:29 return await run_in_threadpool(dependant.call, **values)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
2024-11-20 14:42:29 return await anyio.to_thread.run_sync(func, *args)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
2024-11-20 14:42:29 return await get_async_backend().run_sync_in_worker_thread(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2024-11-20 14:42:29 return await future
2024-11-20 14:42:29 ^^^^^^^^^^^^
2024-11-20 14:42:29 File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
2024-11-20 14:42:29 result = context.run(func, *args)
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/app/danswer/server/query_and_chat/chat_backend.py", line 230, in rename_chat_session
2024-11-20 14:42:29 final_msg, history_msgs = create_chat_chain(
2024-11-20 14:42:29 ^^^^^^^^^^^^^^^^^^
2024-11-20 14:42:29 File "/app/danswer/chat/chat_utils.py", line 86, in create_chat_chain
2024-11-20 14:42:29 raise RuntimeError("Could not trace chat message history")
2024-11-20 14:42:29 RuntimeError: Could not trace chat message history

@crazyfrogspb
Copy link

crazyfrogspb commented Dec 4, 2024

I regularly get the same error (RuntimeError("Could not trace chat message history")) when Ollama is busy with other stuff (it work fine for chunk filtering though). I logged chat messages in chat_utils.py, this is what I get:
for message in all_chat_messages:
logger.debug(
f"Chat message: {message.message}, id: {message.id}, child id: {current_message.latest_child_message}"
)

Chat message: , id: 1001, child id: None

@McCannDahl
Copy link

I think this issue is related to this one BerriAI/litellm#7094

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

3 participants