Skip to main content

cookie_agent_models/adapters/
cache.rs

1pub use oven_sdk_bedrock::{
2    BedrockCachePoint, BedrockCacheStrategy, BedrockCacheTtl, BedrockMessageCachePoint,
3};
4
5use super::AnthropicCacheStrategyConfig;
6
7#[derive(Clone, Debug, PartialEq)]
8pub enum CacheStrategyConfig {
9    Anthropic(AnthropicCacheStrategyConfig),
10    Bedrock(BedrockCacheStrategy),
11    Google(GoogleCacheStrategyConfig),
12    OpenAi(OpenAiCacheStrategyConfig),
13}
14
15#[derive(Clone, Copy, Debug, Eq, PartialEq)]
16pub enum GoogleCacheMode {
17    Implicit,
18    Explicit,
19    Off,
20}
21
22#[derive(Clone, Debug, Eq, PartialEq)]
23pub struct GoogleCacheStrategyConfig {
24    pub mode: GoogleCacheMode,
25    pub cached_content: Option<String>,
26}
27
28#[derive(Clone, Copy, Debug, Eq, PartialEq)]
29pub enum OpenAiPromptCacheRetention {
30    InMemory,
31    TwentyFourHours,
32}
33
34#[derive(Clone, Copy, Debug, Eq, PartialEq)]
35pub enum OpenAiCacheMode {
36    Implicit,
37    Explicit,
38}
39
40#[derive(Clone, Copy, Debug, Eq, PartialEq)]
41pub enum OpenAiPromptCacheTtl {
42    ThirtyMinutes,
43}
44
45#[derive(Clone, Debug, Eq, PartialEq)]
46pub struct OpenAiCacheStrategyConfig {
47    pub prompt_cache_key: Option<String>,
48    pub prompt_cache_retention: Option<OpenAiPromptCacheRetention>,
49    pub mode: Option<OpenAiCacheMode>,
50    pub ttl: Option<OpenAiPromptCacheTtl>,
51    pub system: bool,
52    pub rolling: bool,
53}