Skip to content

feat(backends/hf): thinking/answer splitting on the streaming path #1799

Open

Description

@rafvasq

What feature would you like to be added?

Today <think>...</think> splitting happens on the non-streaming path only; for LocalHFBackend streaming it's skipped, so the reasoning trace leaks inline into result.value. Make streaming split equivalently to non-streaming — populating result.thinking / result.value — including </think> straddling a chunk boundary, prompt-opened <think> (granite-4.2), and truncated reasoning (no </think>).

Why is this feature needed?

Streaming output is inconsistent with LocalHFBackend's own non-streaming path and with the other backends, which already separate reasoning from the answer during streaming (e.g. litellm.py populates mot.thinking incrementally). The non-streaming native + fallback parsing is being added under #1604, which scopes streaming out; this issue tracks that deferred streaming work.

Activity

  1. added
    enhancement
    p1
    area/backends
    on Nov 9, 2026
  2. jeeth-kataria commented on Nov 20, 2026

    @jeeth-kataria
    Contributor

    I’d like to take this on. I have a patch for both LocalHFBackend streaming paths that separates reasoning from the answer, including when the closing tag spans chunks. It also preserves literal tags in structured JSON. The targeted Hugging Face suite passed with 222 tests and 10 skips. This complements #1801, which covers non-streaming output. Could a maintainer confirm the scope and assign or route this issue so I can open the PR?

  3. rafvasq commented on Nov 23, 2026

    @rafvasq
    ContributorAuthor

    Hi @jeeth-kataria, thanks for the interest! I believe that this work will have to build off of the direction that #1801 goes in, so I think it's best to hold off until it's approved/merged.

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

    area/backendsenhancementp1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions