add missing .with_recipient('assistant') to tool message in demo code #62 #63
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.
The demo was missing the required
.with_recipient("assistant")call on tool messages. We can see in harmony format specification that tool messages should includeto=assistantin their header because the tool response requires the assistant to process. It's currently producing this format:Here's our format specification in harmony:
So with that we can correctly produce this:
The issue #62 suggested doing that and I also created a simple test that compared both situations. I found out that the original had 241 tokens, the update has 244 tokens now, the first difference found at token 221, and the decoded text showed the missing
to=assistantpart in the tool message header.So now 3 additional tokens when
.with_recipient("assistant")is added.While I was probing into this issue, I also discovered that there's a separate test failure in
test_does_not_drop_if_ongoing_analysisthat appears to be related to tokenization differences in the<|constrain|>jsonpart, but this is unrelated to the missing.with_recipient("assistant")issue and should be addressed separately.