Skip to main content

anthropic_request_structure

Function anthropic_request_structure 

Source
pub fn anthropic_request_structure(
    key: Option<&TraceDigestKey>,
    sent_bytes: &[u8],
    messages: &[SharedMessage],
    system_prompt: Option<&str>,
    tools_schema: &[Value],
    prefix_marker_ttl: Option<CacheTtlClass>,
    has_tool_marker: bool,
    has_system_marker: bool,
    translation: Vec<TranslationLoss>,
    snapshots: Option<&CacheSnapshotStore>,
) -> RequestStructure
Expand description

Build the structural description of one Anthropic request.

sent_bytes MUST be the exact buffer handed to reqwest — wire length and digest come from it directly, never from re-serialization. When key is None (digest key unavailable) all digest-bearing sections (wire, system_segments, tools, cache prefixes/delta) are omitted; counts in anatomy remain. snapshots, when provided, is the session’s previous-component snapshot store (Task 12, spec §6.6): the cache prefix digests and per-segment previous-turn delta are computed and the snapshot atomically advanced, once per built request structure. translation is the Anthropic adapter’s Task 9 report entries (positional IDs only, never content).