Skip to content
1 min read · 130 words

Function: fingerprintAnthropicMessagesPrefix()

ts
function fingerprintAnthropicMessagesPrefix(input: {
  messages: MessageParam[];
  model: string;
  system?: string | TextBlockParam[];
  throughBlock?: {
    contentIndex: number;
    messageIndex: number;
  };
  tools?: Tool[];
}): Promise<string>;

Defined in: src/batteries/llm/anthropic_messages/helpers.ts:394

Computes the SHA-256 fingerprint used for Anthropic thinking replay.

The input is the exact assembled request prefix: model, resolved system, tools, and messages through the content block immediately before the thinking block. Object keys are recursively sorted; array order and block boundaries are preserved.

Parameters

ParameterType
input{ messages: MessageParam[]; model: string; system?: string | TextBlockParam[]; throughBlock?: { contentIndex: number; messageIndex: number; }; tools?: Tool[]; }
input.messagesMessageParam[]
input.modelstring
input.system?string | TextBlockParam[]
input.throughBlock?{ contentIndex: number; messageIndex: number; }
input.throughBlock.contentIndexnumber
input.throughBlock.messageIndexnumber
input.tools?Tool[]

Returns

Promise<string>