Skip to content

[DOCS] Document streaming error behavior parity for the Python SDK API errors #794

Closed
inference-gateway/python-sdk
#140

Description

Summary

The Python SDK fix in inference-gateway/python-sdk#139 makes
InferenceGatewayAPIError reliably carry status_code and
response_data on both the requests and httpx backends, including
for the three streaming methods (create_chat_completion_stream,
create_response_stream, create_message_stream). Connection failures
during streaming calls are now also raised as InferenceGatewayError
instead of raw requests / httpx exceptions.

The README "Error Handling" section already documents the non-streaming
behavior, but it does not spell out how streaming calls behave on error.
The docs should make the streaming parity explicit so users know the
same except InferenceGatewayError / except InferenceGatewayAPIError
handling applies when iterating a stream.

Affected pages: python-sdk README "Error Handling" section (and the
docs site page mirroring it, if any).

Acceptance Criteria

  • The Error Handling section states that streaming methods raise
    InferenceGatewayAPIError with status_code and response_data
    populated on HTTP errors, on both backends.
  • The Error Handling section states that connection failures during
    streaming calls raise InferenceGatewayError (catchable with the
    existing example's except InferenceGatewayError branch).
  • A short streaming error-handling snippet is added, mirroring the
    non-streaming example.
  • No em or en dashes are introduced (plain hyphens only).

Activity

  1. added
    documentation
    on Sep 25, 2026
  2. added theissue type on Sep 25, 2026
  3. moved this to Todo in 2026on Sep 25, 2026
  4. edenreich commented on Sep 25, 2026

    @edenreich
    Contributor

    @infer can you work on this? use /ponytail:ponytail

  5. inference-gateway-maintainer commented on Sep 25, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Model: ollama_cloud/glm-5.3-flash · View Job

    Todos

    • Add issue [DOCS] Document streaming error behavior parity for the Python SDK API errors #794 to Roadmap board, set In progress
    • Investigate python-sdk README Error Handling section and PR 139 behavior
    • Check docs site for a mirroring python-sdk page (none exists - docs repo out of scope)
    • python-sdk: fetch main, create fix/issue-794 branch, edit README Error Handling section
    • Run checks, commit and push branch to python-sdk
    • Open draft PR on python-sdk, mark ready when checks pass (PR 140, all checks green, ready)
    • Restore docs working tree, verify clean
    • Set board status to QA, finish

    ✅ Infer Result: Success

    Done. The streaming error behavior is now documented, and all work is committed, pushed, and reviewable.

    What changed

    The issue's deliverable - the "Error Handling" section - lives in the python-sdk README, so the change landed there via inference-gateway/python-sdk#140 (inference-gateway/python-sdk#140), ready for review with all checks green (Analyze actions, Analyze python, CodeQL, Test).

    The README's Error Handling section now states, matching the client behavior on both the requests and httpx backends:

    • The three streaming methods (create_chat_completion_stream, create_response_stream, create_message_stream) raise InferenceGatewayAPIError with status_code and response_data populated on HTTP errors.
    • Connection failures during streaming calls raise InferenceGatewayError, catchable with the existing example's except InferenceGatewayError branch.
    • A short streaming try/except snippet mirrors the non-streaming example, plus a one-line note that stream errors surface when iteration begins, so the loop itself goes inside the try block.

    18 lines added to README.md, plain hyphens only, no issue references in the doc content. Commit: docs(readme): document streaming error behavior parity on branch fix/issue-794.

    Scope notes

    Model: ollama_cloud/glm-5.3-flash · Exit Code: 0 · Duration: 9m 3s

    Tokens: 2,287,308 in · 41,059 out · 2,328,367 total (31 requests)

    Tool calls: 56 total · 100% success rate

    Traces
    Session: 1790380157-dc7d11ee
    
    session (headless, success)                                                                        8m56s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 5.7s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       5.7s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     5.7s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             5.7s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 5.7s
    ├── execute_tool Tree call_6mdxzhpr                                                                  2ms
    ├── execute_tool Read call_msy5xu6y                                                                182µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 4.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.4s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             4.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.4s
    ├── execute_tool Bash call_sby7wr5h                                                                  3ms
    ├── execute_tool Bash call_mzfgu6q7                                                                420ms
    ├── execute_tool Bash call_gk4dtkin                                                                  3ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 6.1s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.1s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.1s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             6.1s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.1s
    ├── execute_tool Grep call_nyp2qqfx                                                                922ms
    ├── execute_tool Bash call_yaij32fc                                                                533ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                11.3s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      11.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    11.3s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            11.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                11.3s
    ├── execute_tool Memory call_vg3lbrr9                                                              105µs
    ├── execute_tool Memory call_t8eftqp2                                                              113µs
    ├── execute_tool Grep call_rkctsyau                                                                919ms
    ├── execute_tool Bash call_czpxjod4                                                                  3ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                19.2s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      19.2s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    19.2s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            19.2s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                19.2s
    ├── execute_tool TodoWrite call_18abxtvm                                                            62µs
    ├── execute_tool Bash call_0snjskiu                                                                 1.7s
    ├── chat ollama_cloud/glm-5.3-flash                                                                11.0s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      11.0s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    11.0s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            11.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                11.0s
    ├── execute_tool Bash call_myu7dfo8                                                                558ms
    ├── execute_tool Bash call_alszq36n                                                                860ms
    ├── execute_tool Read call_in0j81nk                                                                687µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                12.0s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      11.9s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    11.9s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            11.9s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                11.9s
    ├── execute_tool Memory call_ptlyioh6                                                              109µs
    ├── execute_tool Grep call_iwngetgl                                                                 1.7s
    ├── execute_tool WebFetch call_bfj4mvlm                                                            169ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                23.6s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      23.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    23.5s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            23.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                23.5s
    ├── execute_tool Grep call_rbiyxsbf                                                                  3ms
    ├── execute_tool WebFetch call_uk6v3tfl                                                             10ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                29.7s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      29.7s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    29.7s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            29.7s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                29.7s
    ├── execute_tool Read call_9kipohxx                                                                310µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                52.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      52.8s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    52.8s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            52.8s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                52.8s
    ├── execute_tool Bash call_357zoapw                                                                415ms
    ├── execute_tool Read call_taqufpe1                                                                188µs
    ├── execute_tool Read call_0q5ktr2x                                                                264µs
    ├── execute_tool Grep call_0l6tqp6v                                                                  1ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                40.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      40.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    40.3s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            40.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                40.3s
    ├── execute_tool TodoWrite call_erx6n27k                                                            68µs
    ├── execute_tool WebFetch call_3024nb8n                                                            239ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                46.1s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      46.1s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    46.0s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            46.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                46.0s
    ├── execute_tool Bash call_wj9zhwe5                                                                 59ms
    ├── execute_tool Bash call_tn4x27gx                                                                 1.1s
    ├── chat ollama_cloud/glm-5.3-flash                                                                16.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      16.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    16.4s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            16.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                16.4s
    ├── execute_tool Bash call_ao57baol                                                                  3ms
    ├── execute_tool Bash call_x56omqvh                                                                 15ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 9.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       9.8s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     9.8s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             9.8s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 9.8s
    ├── execute_tool Read call_d724gw1m                                                                192µs
    ├── execute_tool Read call_avjtpwcn                                                                208µs
    ├── execute_tool Read call_jxe1qrka                                                                176µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                25.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      25.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    25.4s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            25.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                25.4s
    ├── execute_tool Edit call_71g00igo                                                                608µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                 7.6s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       7.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     7.5s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             7.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 7.5s
    ├── execute_tool Bash call_9n2mxxhb                                                                  7ms
    ├── execute_tool Read call_pxlju5ws                                                                137µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                11.5s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      11.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    11.4s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            11.4s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                11.4s
    ├── execute_tool TodoWrite call_6vzt77n3                                                            59µs
    ├── execute_tool Bash call_j5l76wuu                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                13.1s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      13.0s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    13.0s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            13.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                13.0s
    ├── execute_tool Bash call_4zi6lceg                                                                  5ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                15.6s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      15.5s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    15.5s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            15.5s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                15.5s
    ├── execute_tool Bash call_ag7720ls                                                                  6ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 6.6s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.6s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.6s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             6.6s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.6s
    ├── execute_tool Bash call_1flz6gqn                                                                 1.4s
    ├── chat ollama_cloud/glm-5.3-flash                                                                13.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      13.3s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    13.3s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            13.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                13.3s
    ├── execute_tool Write call_rsev122a                                                               764µs
    ├── chat ollama_cloud/glm-5.3-flash                                                                11.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      11.9s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    11.9s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            11.9s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                11.9s
    ├── execute_tool Bash call_18g8seem                                                                 2.4s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 6.7s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       6.7s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     6.6s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             6.6s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 6.6s
    ├── execute_tool Bash call_ywtij6il                                                                736ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.4s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.4s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.3s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             3.3s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.3s
    ├── execute_tool Wait call_6timvq51                                                                48.8s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 3.8s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       3.8s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     3.7s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             3.7s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 3.7s
    ├── execute_tool Bash call_wpmy86w0                                                                857ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 4.0s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.0s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.0s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             4.0s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.0s
    ├── execute_tool Bash call_uxtpp274                                                                 96ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 9.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       9.8s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     9.8s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             9.8s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 9.8s
    ├── execute_tool Bash call_39h2m1pf                                                                 59ms
    ├── execute_tool Bash call_tw41id8q                                                                  3ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                17.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                      17.9s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    17.9s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                            17.9s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                17.9s
    ├── execute_tool Bash call_ha2djpyj                                                                406ms
    ├── chat ollama_cloud/glm-5.3-flash                                                                 9.8s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       9.8s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     9.7s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             9.7s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 9.7s
    ├── execute_tool Bash call_o6jb4er1                                                                  4ms
    ├── execute_tool Memory call_gnj3ilv6                                                               1.1s
    ├── chat ollama_cloud/glm-5.3-flash                                                                 4.9s
    │   ╰── POST /v1/chat/completions [inference-gateway, server]                                       4.9s
    │       ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]     4.9s
    │           ╰── POST /proxy/:provider/*path [inference-gateway, server]                             4.9s
    │               ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                 4.9s
    ├── execute_tool TodoWrite call_s8xd7sn7                                                            65µs
    ╰── chat ollama_cloud/glm-5.3-flash                                                                10.0s
        ╰── POST /v1/chat/completions [inference-gateway, server]                                      10.0s
            ╰── POST 127.0.0.1:8080/proxy/ollama_cloud/chat/completions [inference-gateway, client]    10.0s
                ╰── POST /proxy/:provider/*path [inference-gateway, server]                            10.0s
                    ╰── POST ollama.com/v1/chat/completions [inference-gateway, client]                10.0s
    
    Stats
    Tool Calls
    
    ╭───────────┬───────┬───────┬─────────╮
    │ Tool      │ Calls │ Fail% │ Avg     │
    ├───────────┼───────┼───────┼─────────┤
    │ Bash      │ 26    │ 0%    │ 450ms   │
    │ Read      │ 9     │ 0%    │ 242µs   │
    │ Grep      │ 5     │ 0%    │ 712ms   │
    │ Memory    │ 4     │ 0%    │ 281ms   │
    │ TodoWrite │ 4     │ 0%    │ 53µs    │
    │ WebFetch  │ 3     │ 0%    │ 140ms   │
    │ Tree      │ 1     │ 0%    │ 2ms     │
    │ Edit      │ 1     │ 0%    │ 596µs   │
    │ Write     │ 1     │ 0%    │ 755µs   │
    │ Wait      │ 1     │ 0%    │ 48806ms │
    ╰───────────┴───────┴───────┴─────────╯
    
    Token Usage
    
    ╭────────────────────────────┬─────────┬─────────┬────────────┬─────────┬──────╮
    │ Model                      │ Prompt  │ Cached  │ Completion │ Total   │ Cost │
    ├────────────────────────────┼─────────┼─────────┼────────────┼─────────┼──────┤
    │ ollama_cloud/glm-5.3-flash │ 2287308 │ 1904000 │ 41059      │ 2328367 │ -    │
    ╰────────────────────────────┴─────────┴─────────┴────────────┴─────────┴──────╯
    
    Sessions
    
    ╭───────────┬──────────┬──────────╮
    │ Execution │ Mode     │ Sessions │
    ├───────────┼──────────┼──────────┤
    │ headless  │ headless │ 1        │
    ╰───────────┴──────────┴──────────╯
    

    Triggered by edenreich · Infer Action · OSS

  6. moved this from In progress to QA in 2026on Sep 25, 2026
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

    documentation

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions