Repository navigation
Replay thinking that a compatible server signs with an empty signature - #425
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR fixes multi-turn sessions with
AnthropicLanguageModelagainst a server that signs thinking blocks with an empty signature, such as llama-server's/v1/messages. The server sends"signature": ""on a thinking block, or an emptysignature_deltawhen it streams. The package stored that as a missing signature, so the next turn threwTranscript.ReasoningReplayError.invalidSignaturebefore it sent a request.The package now keeps a signature that the server sent, even an empty one, and replays it unchanged. A thinking entry with no signature still throws
invalidSignature, as does a streamed block whose start has an empty signature and that gets nosignature_delta. Redacted thinking with empty data also still throws. One thing changes for other servers: a transcript that holds an empty signature is now sent as it is, where the old code threw before the request.