Skip to content

Streamed <precontext>/<think> tags leak to live consumers #3

Description

Severity: Medium — streamed <precontext>/<think> tags leak to live consumers

Interfaze streams side-channels inline in content as <precontext>…</precontext> and <think>…</think>. The SDK strips them only from the aggregated accessors (text, finalChatCompletion() / get_final_completion()).

The yielded chunks — and the plain drop-in path (create({stream:true}) / create(stream=True)) — still carry the raw tags in delta.content. Anyone rendering tokens live (the normal streaming UX) sees <precontext>{…}</precontext> and <think>… in the output.

Fix

Provide a delta-level filtered iterator that buffers across tag boundaries and emits only visible text (plus typed precontext/reasoning events), or clearly document that live rendering must consume the filtered helper stream rather than raw deltas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions