Skip to content

fix(huggingface): Capture streamed tool calls#1848

Open
Luca Forstner (lforst) wants to merge 3 commits intomainfrom
lforst/hf-stream-tool-calls
Open

fix(huggingface): Capture streamed tool calls#1848
Luca Forstner (lforst) wants to merge 3 commits intomainfrom
lforst/hf-stream-tool-calls

Conversation

@lforst
Copy link
Copy Markdown
Member

@lforst Luca Forstner (lforst) commented Apr 17, 2026

We were ignoring streamed tool calls.

Fixes #1846

Copy link
Copy Markdown
Contributor

@Qard Stephen Belanger (Qard) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, though we might want to consider avoiding this field merging pattern as we're adding unnecessary overhead with that and it's difficult to read anyway.

Comment on lines +540 to +543
...(typeof deltaFunction.name === "string" &&
typeof currentFunction.name !== "string"
? { name: deltaFunction.name }
: {}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern of constructing an object only to immediately destructure it and merge it into another is a bit wasteful and not particularly readable. Seems to be used a bunch in this PR. We should probably just build that into a separate name variable directly without all that destructuring complication.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] HuggingFace streaming chat completion drops tool calls during aggregation

2 participants