1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! `Provenance` resource — recall provenance records (which grains fed a
//! recall, with scoring signals; EU AI Act Art. 12 transparency).
//!
//! Mirrors the Python SDK's `client.provenance.*` surface.
//!
//! Provenance reads carry recalled-content references and are excluded
//! from the SDK's request-body logging.
use serde_json::Value;
use crate::error::Result;
use crate::http::HttpClient;
/// Recall-provenance reads.
///
/// Access via [`crate::Areev::provenance`].
pub struct Provenance<'a> {
http: &'a HttpClient,
memory_id: String,
}
impl<'a> Provenance<'a> {
/// Internal constructor — use [`crate::Areev::provenance`].
pub(crate) fn new(http: &'a HttpClient, memory_id: String) -> Self {
Self { http, memory_id }
}
fn p(&self, suffix: &str) -> String {
format!("/memories/{}/provenance{}", self.memory_id, suffix)
}
/// List provenance records for recent recalls. `filters` is added as
/// query parameters.
pub async fn list(&self, filters: Option<&Value>) -> Result<Value> {
self.http._get_sensitive(&self.p(""), filters).await
}
/// Provenance for a single recall by id.
pub async fn get(&self, recall_id: &str) -> Result<Value> {
self.http
._get_sensitive(&self.p(&format!("/{recall_id}")), None)
.await
}
/// Aggregate provenance summary across recalls. `filters` is added as
/// query parameters.
pub async fn summary(&self, filters: Option<&Value>) -> Result<Value> {
self.http._get_sensitive(&self.p("/summary"), filters).await
}
}