You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm doing some weird stuff with putting authorization in front of my ollama endpoint, but that's besides the point.
Point is, I have an endpoint that will always return a 401 status code with how I have it configured (that's my problem to fix). When a status code other than 200 is returned, ollama_chat.py uses response.iter_lines() as the parameter passed to the message of OllamaError. You can see the problem here:
I think this is probably an easy fix, you just need to actually exhaust the iterator and convert its output into a readable string. However, I figured it's worth it to have some discussion around how to do that. Imagine that the response body is actually an entire web page (for whatever reason). We maybe don't want to include that as the error in the message body.
Additionally, this bug isn't really a big deal for me, but I figured someone out there might like a crack at an easy PR to merge in.
Relevant log output
Traceback (most recent call last):
File "/home/lavender/.local/pipx/venvs/aider-chat/lib/python3.10/site-packages/aider/coders/base_coder.py", line 1255, in send_message
yield from self.send(messages, functions=self.functions)
File "/home/lavender/.local/pipx/venvs/aider-chat/lib/python3.10/site-packages/aider/coders/base_coder.py", line 1575, in send
yield from self.show_send_output_stream(completion)
File "/home/lavender/.local/pipx/venvs/aider-chat/lib/python3.10/site-packages/aider/coders/base_coder.py", line 1650, in show_send_output_stream
forchunkin completion:
File "/home/lavender/.local/pipx/venvs/aider-chat/lib/python3.10/site-packages/litellm/llms/ollama_chat.py", line 442, in ollama_completion_stream
raise e
File "/home/lavender/.local/pipx/venvs/aider-chat/lib/python3.10/site-packages/litellm/llms/ollama_chat.py", line 395, in ollama_completion_stream
raise OllamaError(
litellm.llms.ollama_chat.OllamaError: <generator object Response.iter_lines at 0x7d42b036f7d0><generator object Response.iter_lines at 0x7d42b036f7d0>
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
Whatever aider-chat installed through pipx (as of 2025-01-11) has as its dependency
Twitter / LinkedIn details
No response
The text was updated successfully, but these errors were encountered:
What happened?
I'm doing some weird stuff with putting authorization in front of my ollama endpoint, but that's besides the point.
Point is, I have an endpoint that will always return a 401 status code with how I have it configured (that's my problem to fix). When a status code other than 200 is returned, ollama_chat.py uses
response.iter_lines()
as the parameter passed to themessage
ofOllamaError
. You can see the problem here:litellm/litellm/llms/ollama_chat.py
Line 376 in 3062564
I think this is probably an easy fix, you just need to actually exhaust the iterator and convert its output into a readable string. However, I figured it's worth it to have some discussion around how to do that. Imagine that the response body is actually an entire web page (for whatever reason). We maybe don't want to include that as the error in the message body.
Additionally, this bug isn't really a big deal for me, but I figured someone out there might like a crack at an easy PR to merge in.
Relevant log output
Are you a ML Ops Team?
No
What LiteLLM version are you on ?
Whatever aider-chat installed through pipx (as of 2025-01-11) has as its dependency
Twitter / LinkedIn details
No response
The text was updated successfully, but these errors were encountered: