feat: Embeddings über llama.cpp im Gateway anbieten

This commit is contained in:
2026-11-18 20:02:37 +01:00
parent 3509e731cd
commit 2c1a3d487a
12 changed files with 268 additions and 14 deletions

View File

@ -345,13 +345,12 @@ impl Engine for LlamaCppEngine {
EngineInfo {
name: "llama.cpp".to_string(),
mode: Mode::Managed,
// Gemessen: Chat und Streaming laufen. Embeddings und Tool Calling
// hängen vom Modell und von den Startargumenten ab und sind noch
// nicht geprüft.
// Embeddings benötigen ein Embedding-GGUF und --embedding im Startprofil;
// die Unterstützung mit einem echten Modell ist noch nicht geprüft.
capabilities: Capabilities {
chat: true,
completions: true,
embeddings: false,
embeddings: true,
streaming: true,
tool_calling: false,
images: false,
@ -631,6 +630,24 @@ mod tests {
);
}
#[test]
fn embedding_profil_setzt_pooling_nur_fuer_dieses_modell() {
let engine = LlamaCppEngine::new(LlamaCppConfig::default());
let mut p = profile();
assert!(
!engine
.build_command(&p, 18000)
.args
.contains(&"--embedding".to_string())
);
p.start_parameters
.insert("embeddings".into(), "true".into());
p.start_parameters.insert("pooling".into(), "cls".into());
let command = engine.build_command(&p, 18000);
assert!(command.args.contains(&"--embedding".to_string()));
assert!(command.args.windows(2).any(|a| a == ["--pooling", "cls"]));
}
#[test]
fn kommandozeile_bindet_nur_an_localhost_und_waehlt_gpus() {
let engine = LlamaCppEngine::new(LlamaCppConfig::default());