34 lines
860 B
Rust
34 lines
860 B
Rust
// nazarick-core/src/llm/traits.rs
|
|
|
|
use crate::types::Result;
|
|
use crate::llm::types::{LlmRequest, LlmResponse};
|
|
|
|
#[derive(Debug, Clone, PartialEq)]
|
|
pub enum SkillFormat {
|
|
/// XML-Tags — für lokale Modelle ohne Function Calling
|
|
Xml,
|
|
/// Native Tool Use — Ollama, Mistral API, OpenRouter
|
|
ToolUse,
|
|
/// 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 {
|
|
async fn complete(&self, request: LlmRequest) -> Result<LlmResponse>;
|
|
fn name(&self) -> &str;
|
|
fn skill_format(&self) -> SkillFormat {
|
|
SkillFormat::Xml
|
|
}
|
|
} |