OllamaChatClient
doesn't check for status code before deserializing.
#5820
Labels
ai-ready-to-implement
area-AI
bug
This issue describes a behavior which is not expected - a bug.
work in progress 🚧
Description
Per the title, the client currently doesn't check response status codes before deserializing in both the non-streaming
extensions/src/Libraries/Microsoft.Extensions.AI.Ollama/OllamaChatClient.cs
Lines 90 to 97 in fc84cf9
and streaming implementations
extensions/src/Libraries/Microsoft.Extensions.AI.Ollama/OllamaChatClient.cs
Lines 119 to 126 in fc84cf9
In practice, this results in one single empty chat update being returned in cases where, for example, Ollama returns a 404 response. We should fix this and ensure that OllamaSharp doesn't suffer from the same issue.
Reproduction Steps
N/A
Expected behavior
Should throw an exception when non 20x responses are being produced.
Actual behavior
Does not throw an exception when non-20x responses are being produced.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: