-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrap Claude 3.7 thinking tokens in <thinking>
tags
#11486
Conversation
@@ -1127,6 +1127,14 @@ impl AnthropicLLM { | |||
StreamContent::AnthropicStreamThinking( | |||
thinking, | |||
) => { | |||
// Send <thinking> tag at the start of a thinking block | |||
let _ = event_sender.send(json!({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't you sending one at each event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at each new thinking block only it would seem (side note: trying out an AI agent tool here, launched the agent, tested, opened the PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i get multiple thinking blocks I separate them nicely in <thinking>
elements I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't we getting such events per token? or token group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it's a group of token with content_block_start
as the event_type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is can we get multiple in a row? If not which is your argument here we should just wrap here instead of the extra logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can't, we're supposed to get a block start then deltas then a block stop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I hadn't seen the name of the event up top. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
<thinking>
tags in order to fallback on front's delimiter detection. It thus aligns the behavior of 3.5 and 3.7.Before/After
Tests
Risk
Deploy Plan