pub struct KnowledgeConfig {
pub embedders: IndexMap<String, Value>,
pub rerankers: IndexMap<String, Value>,
pub stores: IndexMap<String, Value>,
pub datasets: Vec<DatasetConfig>,
pub reranker: Option<String>,
}Expand description
Declarative knowledge-base configuration (knowledge.yaml / .json).
embedders:
default: { type: openai, base_url: "http://localhost:11434/v1", model: nomic-embed-text }
inproc: { type: local, model: sentence-transformers/all-MiniLM-L6-v2 } # feature `local-embed`
cloud: { type: openai, model: text-embedding-3-small, api_key_env: OPENAI_API_KEY }
rerankers:
cohere: { type: http, base_url: "https://api.cohere.com/v2", model: rerank-v3.5, api_key_env: COHERE_API_KEY }
stores:
local: { type: sqlite, path: ./kb.db }
json: { type: memory, path: ./kb.json }
vector: { type: qdrant, url: "http://localhost:6333", collection: kb, api_key_env: QDRANT_API_KEY }
datasets:
- { id: handbook, name: Handbook, store: local, embedder: default, reranker: cohere }
- { id: crm, retriever: { type: http, url: "https://rag.internal/search", api_key_env: RAG_TOKEN } }
reranker: cohere # optional, used across datasetsSecrets are never written inline: every provider takes api_key_env, the
name of an environment variable resolved when the configuration is built.
Fields§
§embedders: IndexMap<String, Value>§rerankers: IndexMap<String, Value>§stores: IndexMap<String, Value>§datasets: Vec<DatasetConfig>§reranker: Option<String>Cross-dataset reranker (a key of rerankers).
Implementations§
Source§impl KnowledgeConfig
impl KnowledgeConfig
pub fn from_json(text: &str) -> Result<Self, RagError>
pub fn from_yaml(text: &str) -> Result<Self, RagError>
Sourcepub fn build(&self) -> Result<KnowledgeBase, RagError>
pub fn build(&self) -> Result<KnowledgeBase, RagError>
Build the knowledge base, resolving secrets with std::env::var.
Sourcepub fn build_with_env(
&self,
env: EnvLookup<'_>,
) -> Result<KnowledgeBase, RagError>
pub fn build_with_env( &self, env: EnvLookup<'_>, ) -> Result<KnowledgeBase, RagError>
Build the knowledge base with a custom environment lookup.
Trait Implementations§
Source§impl Clone for KnowledgeConfig
impl Clone for KnowledgeConfig
Source§impl Debug for KnowledgeConfig
impl Debug for KnowledgeConfig
Source§impl Default for KnowledgeConfig
impl Default for KnowledgeConfig
Source§impl<'de> Deserialize<'de> for KnowledgeConfig
impl<'de> Deserialize<'de> for KnowledgeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for KnowledgeConfig
impl PartialEq for KnowledgeConfig
Source§impl Serialize for KnowledgeConfig
impl Serialize for KnowledgeConfig
impl StructuralPartialEq for KnowledgeConfig
Auto Trait Implementations§
impl Forget for KnowledgeConfig
impl Freeze for KnowledgeConfig
impl Move for KnowledgeConfig
impl RefUnwindSafe for KnowledgeConfig
impl Send for KnowledgeConfig
impl Sync for KnowledgeConfig
impl Unpin for KnowledgeConfig
impl UnsafeUnpin for KnowledgeConfig
impl UnwindSafe for KnowledgeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more