Skip to content

client: report connection failures consistently when streaming - #741

Open
LaoChouPro wants to merge 1 commit into
ollama:mainfrom
LaoChouPro:fix/stream-connection-errors
Open

LaoChouPro wants to merge 1 commit into
ollama:mainfrom
LaoChouPro:fix/stream-connection-errors

Conversation

@LaoChouPro

Copy link
Copy Markdown

When Ollama is unreachable, streaming requests currently expose a raw httpx error instead of the helpful ConnectionError used by ordinary requests. Apply the same handling to synchronous and asynchronous streams while preserving server response errors. This addresses the remaining streaming case from issue 120.

Tests cover all five streaming methods, non-streaming parity, HTTP errors and errors inside successful streams. All 126 tests and doctests pass, along with Ruff checks, formatting and package builds.

Translate httpx connection errors in both streaming request paths using
the same message as ordinary requests. Keep server response errors intact.

Assisted-by: OpenAI GPT-6 <noreply@openai.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant