added Tokens, openrouter, memory system
CI / check (push) Successful in 4m11s
CI / test (push) Successful in 3m57s
CI / clippy (push) Has been cancelled

This commit is contained in:
Sithies
2026-03-21 19:59:07 +01:00
parent 4e6b2c6759
commit 18b666f45d
41 changed files with 3217 additions and 258 deletions
+14 -15
View File
@@ -1,34 +1,33 @@
// nazarick-core/src/llm/traits.rs
//
// LlmProvider Trait — gemeinsame Schnittstelle für alle LLM-Backends.
// Neue Provider (Ollama, Mistral) implementieren diesen Trait.
use crate::types::Result;
use crate::llm::types::{LlmRequest, LlmResponse};
/// Format für Skill-Calls das dieser Provider unterstützt.
#[derive(Debug, Clone, PartialEq)]
pub enum SkillFormat {
/// XML-Tags — funktioniert mit lokalen Modellen
/// <skill name="update_personality">...</skill>
/// XML-Tags — für lokale Modelle ohne Function Calling
Xml,
/// Native Tool Use — Claude, GPT-4, Mistral API
/// Strukturierter JSON-basierter Funktionsaufruf
/// Native Tool Use — Ollama, Mistral API, OpenRouter
ToolUse,
/// Skills deaktiviert — Modell folgt keinem Format zuverlässig
/// Skills deaktiviert
None,
}
impl SkillFormat {
/// Parsed aus config.toml String
pub fn from_str(s: &str) -> Self {
match s {
"tool_use" => Self::ToolUse,
"none" => Self::None,
_ => Self::Xml, // default
}
}
}
#[async_trait::async_trait]
pub trait LlmProvider: Send + Sync {
/// Sendet eine Anfrage an das LLM und gibt die Antwort zurück.
async fn complete(&self, request: LlmRequest) -> Result<LlmResponse>;
/// Gibt den Namen des Providers zurück.
fn name(&self) -> &str;
/// Gibt das Skill-Format zurück das dieser Provider unterstützt.
/// Standard: Xml — für lokale Modelle.
fn skill_format(&self) -> SkillFormat {
SkillFormat::Xml
}