pub trait LlmProvider: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn complete(&self, prompt: &str) -> Result<String>;
fn analyze_for_capture(&self, content: &str) -> Result<CaptureAnalysis>;
// Provided methods
fn complete_with_system(&self, system: &str, user: &str) -> Result<String> { ... }
fn analyze_for_capture_extended(
&self,
content: &str,
existing_memories: Option<&str>,
) -> Result<ExtendedCaptureAnalysis> { ... }
fn classify_search_intent(
&self,
prompt: &str,
) -> Result<ExtendedSearchIntent> { ... }
fn analyze_for_consolidation(
&self,
memories: &str,
) -> Result<ConsolidationAnalysis> { ... }
}Expand description
Trait for LLM providers.
Required Methods§
Sourcefn analyze_for_capture(&self, content: &str) -> Result<CaptureAnalysis>
fn analyze_for_capture(&self, content: &str) -> Result<CaptureAnalysis>
Provided Methods§
Sourcefn complete_with_system(&self, system: &str, user: &str) -> Result<String>
fn complete_with_system(&self, system: &str, user: &str) -> Result<String>
Generates a completion with a system prompt.
§Errors
Returns an error if the completion fails.
Default implementation concatenates system and user prompts. Providers should override this to use native system prompt support.
Sourcefn analyze_for_capture_extended(
&self,
content: &str,
existing_memories: Option<&str>,
) -> Result<ExtendedCaptureAnalysis>
fn analyze_for_capture_extended( &self, content: &str, existing_memories: Option<&str>, ) -> Result<ExtendedCaptureAnalysis>
Analyzes content for memory capture with extended security analysis.
Uses the unified subcog system prompt for comprehensive analysis including adversarial detection and contradiction checking.
§Arguments
content- The content to analyze.existing_memories- Optional context of existing memories for contradiction detection.
§Errors
Returns an error if analysis fails.
Sourcefn classify_search_intent(&self, prompt: &str) -> Result<ExtendedSearchIntent>
fn classify_search_intent(&self, prompt: &str) -> Result<ExtendedSearchIntent>
Classifies search intent with namespace weights.
Uses the unified subcog system prompt for intent classification with enhanced topic extraction and namespace weighting.
§Errors
Returns an error if classification fails.