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

@ -282,6 +282,7 @@ fn model_add(args: &[String]) -> Result<(), String> {
"maya-config",
"strata-config",
"tts-model",
"pooling",
"gpus",
"context",
"vram-mb",
@ -290,7 +291,7 @@ fn model_add(args: &[String]) -> Result<(), String> {
"quant",
"config",
],
&["disabled"],
&["disabled", "embeddings"],
)?;
let name = flags.require("name")?.to_string();
let engine = flags.get("engine").unwrap_or("llama.cpp").to_string();
@ -352,8 +353,28 @@ fn model_add(args: &[String]) -> Result<(), String> {
{
return Err(meldung);
}
if (flags.has("embeddings") || flags.get("pooling").is_some()) && new.engine != "llama.cpp" {
return Err("Embeddings und Pooling sind nur für llama.cpp verfügbar.".to_string());
}
let mut params = nexus_core::startparams::StartParameters::new();
if flags.has("embeddings") || flags.get("pooling").is_some() {
if flags.has("embeddings") {
params.insert("embeddings".into(), "true".into());
}
params.insert(
"pooling".into(),
flags.get("pooling").unwrap_or("cls").into(),
);
nexus_core::startparams::validate_start_parameters(&new.engine, &params, new.gpus.len())
.map_err(str::to_string)?;
}
let mut store = open_store(&config)?;
store.register_llm(&new).map_err(|e| e.to_string())?;
if !params.is_empty() {
store
.save_start_parameters(&name, &params, "cli", false)
.map_err(|e| e.to_string())?;
}
audit(&store, "model.add", &name)?;
println!(
"Modell \"{name}\" registriert ({}, {}).",

View File

@ -24,7 +24,7 @@ Aufruf:
nexus key create --name N [--max-priority low|normal|high] [--default-priority ...] [--models a,b|*] [--metrics] [--ui] [--admin]
nexus key list | enable --name N | disable --name N | remove --name N (nur gesperrte Keys)
nexus user list | create --name N --role admin|nutzer | reset-password --name N (Passwort zufällig, wird einmal angezeigt)
nexus model add --name N --path PFAD [--gpus 0,1] [--context N] [--vram-mb N] [--ram-mb N] [--idle-min N] [--quant Q] [--disabled]
nexus model add --name N --path PFAD [--gpus 0,1] [--embeddings --pooling cls] [--context N] [--vram-mb N] [--ram-mb N] [--idle-min N] [--quant Q] [--disabled]
nexus model add --name N --engine ollama --tag MODELLNAME [--gpus 0] [--disabled]
nexus model add --name N --engine maya --maya-config PFAD.json [--gpus 0,1] [--disabled]
nexus model add --name N --engine strata --strata-config PFAD.json [--gpus 0,1] [--disabled]