use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::Value; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct RagDocument { pub id: String, pub content: String, pub metadata: HashMap, } impl RagDocument { pub fn new(id: impl Into, content: impl Into) -> Self { Self { id: id.into(), content: content.into(), metadata: HashMap::new(), } } pub fn with_metadata(mut self, metadata: HashMap) -> Self { self.metadata = metadata; self } pub fn metadata_value( mut self, key: impl Into, value: impl Into, ) -> Self { self.metadata.insert(key.into(), value.into()); self } } #[derive(Clone, Debug, Serialize, Deserialize)] pub struct RagSearchHit { pub id: String, pub session_id: String, pub score: f32, pub content: String, pub metadata: HashMap, }