assay-core 2.17.0

High-performance evaluation framework for LLM agents (Core)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use sha2::{Digest, Sha256};

pub fn cache_key(model: &str, prompt: &str, fingerprint: &str, trace_hash: Option<&str>) -> String {
    let mut h = Sha256::new();
    h.update(model.as_bytes());
    h.update(b"\n");
    h.update(prompt.as_bytes());
    h.update(b"\n");
    h.update(fingerprint.as_bytes());
    if let Some(th) = trace_hash {
        h.update(b"\n");
        h.update(th.as_bytes());
    }
    format!("{:x}", h.finalize())
}