Skip to content

fix: skip blank stream response lines#689

Open
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/skip-blank-stream-lines
Open

fix: skip blank stream response lines#689
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/skip-blank-stream-lines

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Summary

  • Ignore blank lines while iterating sync and async streaming responses.
  • Keep the existing JSON parsing behavior for non-empty stream payloads.

Why

Some HTTP streaming transports can yield heartbeat/empty lines. Those should not cause json.loads() to fail before the next valid response object arrives.

Testing

  • python -m pytest tests/test_client.py::test_client_chat_stream_skips_blank_lines tests/test_client.py::test_async_client_chat_stream_skips_blank_lines tests/test_client.py::test_client_chat_stream tests/test_client.py::test_async_client_chat_stream -q
  • git diff --check

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