Skip to main content

Module anthropic

Module anthropic 

Source
Expand description

Metadata-only structural description of an Anthropic Messages request (Task 8). Every function here consumes trusted structural inputs — the already-sanitized message array, the caller-supplied system prompt, the registered tool schemas, and the exact serialized wire bytes — and produces only counts, byte lengths, enums, validated IDs, and keyed digests. No raw string is ever retained.

Functions§

anthropic_request_structure
Build the structural description of one Anthropic request.
retry_class_for_status
Map an Anthropic HTTP failure status to a coarse retry class.
retry_class_for_stream_error
Map an in-stream Anthropic error type (already vetted upstream) to a coarse retry class. None means the stream died at transport level.
stop_reason_from_wire
Normalize an Anthropic wire stop_reason into the trace enum. Unknown values collapse to Other — the raw string is never stored.