Skip to main content

cognee_models/
backend_overrides.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5/// Per-call backend configuration overrides.
6///
7/// Mirrors Python's `vector_db_config` / `graph_db_config` parameters on
8/// `add()`, `cognify()`, and `memify()`. When present, the pipeline should
9/// use the specified backend configuration instead of the default.
10///
11/// For now the configuration is stored as a flat provider name + params map.
12/// Actual backend instantiation from these configs is left to the caller or
13/// a future factory function.
14#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct BackendOverrides {
16    /// Optional per-call vector DB configuration.
17    pub vector_db_config: Option<BackendConfig>,
18
19    /// Optional per-call graph DB configuration.
20    pub graph_db_config: Option<BackendConfig>,
21}
22
23/// Configuration for dynamically selecting/creating a backend.
24///
25/// Mirrors Python's dict-based `vector_db_config` / `graph_db_config`.
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct BackendConfig {
28    /// Provider name (e.g. `"qdrant"`, `"ladybug"`, `"pgvector"`).
29    pub provider: String,
30
31    /// Arbitrary provider-specific parameters.
32    pub params: HashMap<String, serde_json::Value>,
33}