Uh oh!
There was an error while loading. Please reload this page.
fix: strip <think>/<precontext> from live stream deltas (#4) - #11
Merged
Conversation
Interfaze streams side-channels inline in content as <think>…</think> and <precontext>…</precontext>. The SDK stripped them only from the aggregated accessors, so live token consumers (raw deltas / create(stream=True)) saw the raw tags in delta.content. Add InterfazeStream.text_deltas() (sync + async): a delta-level filtered iterator that strips both tag types, buffering across chunk boundaries for split tags and never withholding text that cannot be a tag. reasoning and precontext remain available on get_final_completion(). README now steers live rendering to text_deltas().
Abhinavexist added a commit
that referenced
this pull request
Jul 21, 2026
…est-id, escape hatches - #1 .stream() now yields OpenAI ChatCompletionStreamEvents (content.delta/done, tool-call events) via ChatCompletionStreamState; <think>/<precontext> stripped from content events; text_deltas() for plain tokens; create(stream=True) unchanged. - #2 streamed usage + system_fingerprint captured on get_final_completion(). - #3 _request_id carried onto the returned completion. - #6 parse()/with_raw_response/with_streaming_response exposed on the wrapper (no more AttributeError; parse delegates to the OpenAI client, model default + guard). Rebased onto main (post #7–#11).
This was referenced Jul 21, 2026
Merged
Abhinavexist added a commit
that referenced
this pull request
Jul 22, 2026
…est-id, escape hatches - #1 .stream() now yields OpenAI ChatCompletionStreamEvents (content.delta/done, tool-call events) via ChatCompletionStreamState; <think>/<precontext> stripped from content events; text_deltas() for plain tokens; create(stream=True) unchanged. - #2 streamed usage + system_fingerprint captured on get_final_completion(). - #3 _request_id carried onto the returned completion. - #6 parse()/with_raw_response/with_streaming_response exposed on the wrapper (no more AttributeError; parse delegates to the OpenAI client, model default + guard). Rebased onto main (post #7–#11).
Abhinavexist added a commit
that referenced
this pull request
Jul 22, 2026
…est-id, escape hatches (#20) - #1 .stream() now yields OpenAI ChatCompletionStreamEvents (content.delta/done, tool-call events) via ChatCompletionStreamState; <think>/<precontext> stripped from content events; text_deltas() for plain tokens; create(stream=True) unchanged. - #2 streamed usage + system_fingerprint captured on get_final_completion(). - #3 _request_id carried onto the returned completion. - #6 parse()/with_raw_response/with_streaming_response exposed on the wrapper (no more AttributeError; parse delegates to the OpenAI client, model default + guard). Rebased onto main (post #7–#11).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#4
Problem
Interfaze streams side-channels inline in
contentas<precontext>…</precontext>and<think>…</think>. The SDK stripped them only from the aggregated accessors (text,get_final_completion()). Anyone rendering tokens live — iterating the stream directly or using the plaincreate(stream=True)drop-in path — saw the raw tags indelta.content.Fix
Add
InterfazeStream.text_deltas()(sync and async): a delta-level filtered iterator that yields visible text only.<think>and<precontext>blocks incrementally.<prec|ontext>) instead of leaking it.<is emitted; it does not block waiting for a close tag that may never arrive — side-channels are conditional on the header / absent under a schema).reasoningandprecontextremain available onget_final_completion().README's streaming example now uses
text_deltas()and documents that raw deltas are unfiltered (implements the issue's "provide a filtered helper + document" resolution).Tests
5 new: precontext stripped, think stripped, tag split across chunks, literal
<preserved, and asynctext_deltas. Suite: 29 passing;ruff+mypy --strictclean.