pub struct CacheSafeParams {
pub system_prompt: String,
pub user_context: HashMap<String, String>,
pub system_context: HashMap<String, String>,
pub tool_use_context: Arc<ToolUseContext>,
pub fork_context_messages: Vec<Message>,
}Expand description
Parameters that must be identical between the fork and parent API requests to share the parent’s prompt cache. The Anthropic API cache key is composed of: system prompt, tools, model, messages (prefix), and thinking config.
CacheSafeParams carries the first five. Thinking config is derived from the
inherited tool_use_context.options.thinking_config — but can be inadvertently
changed if the fork sets max_output_tokens, which clamps budget_tokens in
claude.ts (but only for older models that do not use adaptive thinking).
See the max_output_tokens doc on ForkedAgentConfig.
Fields§
§system_prompt: StringSystem prompt - must match parent for cache hits
user_context: HashMap<String, String>User context - prepended to messages, affects cache
system_context: HashMap<String, String>System context - appended to system prompt, affects cache
tool_use_context: Arc<ToolUseContext>Tool use context containing tools, model, and other options
fork_context_messages: Vec<Message>Parent context messages for prompt cache sharing
Trait Implementations§
Source§impl Clone for CacheSafeParams
impl Clone for CacheSafeParams
Source§fn clone(&self) -> CacheSafeParams
fn clone(&self) -> CacheSafeParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more