Skip to main content

assay_core/cache/
vcr.rs

1use crate::model::LlmResponse;
2use crate::storage::Store;
3
4#[derive(Clone)]
5pub struct VcrCache {
6    store: Store,
7}
8
9impl VcrCache {
10    pub fn new(store: Store) -> Self {
11        Self { store }
12    }
13    pub fn get(&self, key: &str) -> anyhow::Result<Option<LlmResponse>> {
14        self.store.cache_get(key)
15    }
16    pub fn put(&self, key: &str, resp: &LlmResponse) -> anyhow::Result<()> {
17        self.store.cache_put(key, resp)
18    }
19}