Skip to content

[DOCS] Python SDK streaming snippet should read chunk JSON directly #1261

Closed

Description

Summary

The Python SDK streaming snippet in sdks.md parses chunk.data into CreateChatCompletionStreamResponse. That generated model currently rejects standard OpenAI-format chunks (null finish_reason, deltas without role or content), so the snippet prints nothing for a normal stream.

User-facing change

Python SDK streaming examples now read the parsed JSON directly, for example data["choices"][0]["delta"].get("content"), instead of validating each chunk with CreateChatCompletionStreamResponse.

Affected pages

  • sdks.md - Python SDK streaming section

Links

Activity

  1. added
    documentation
    on Nov 17, 2026
  2. edenreich commented on Nov 17, 2026

    @edenreich
    Contributor

    @claude can you document this?

  3. inference-gateway-maintainer commented on Nov 17, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 1m 5s —— View job • docs/issue-1261-20261117-2016 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-1261-20261117-2016?quick_pull=1&title=Issue%20%231261%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%231261%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Done

    Changes to sdks.md

    • Python Streaming example: each chunk is decoded with json.loads and printed from choice['delta'].get('content'). I removed the CreateChatCompletionStreamResponse import.
    • New tip: explains why validating each chunk with that model fails for now (a null finish_reason, or a delta without role or content).
    • Reasoning streaming snippet: now reads reasoning_content and content from the same dict, so it still lines up with the Streaming example.

    The create_response_stream / ResponseStreamEvent example still validates each event with a model. The issue doesn't mention it, so I didn't change it. If that model has the same problem, it needs the same fix.
    | Branch

  4. moved this from Todo to In progress in 2026on Nov 17, 2026
  5. moved this from In progress to QA in 2026on Nov 17, 2026
  6. moved this from QA to Done in 2026on Nov 17, 2026
  7. inference-gateway-releaser commented on Nov 17, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.27 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions