feat(ai): add support for Ollama AI provider configuration

* Update README with Ollama integration details
* Add Ollama configuration to example YAML files
* Implement Ollama provider in AI factory
* Add tests for Ollama provider functionality
* Enhance config validation for Ollama settings
This commit is contained in:
Hein
2026-03-25 12:26:31 +02:00
parent ad05a9e228
commit c8ca272b03
12 changed files with 182 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
package ai
import (
"io"
"log/slog"
"net/http"
"testing"
"git.warky.dev/wdevs/amcs/internal/config"
)
func TestNewProviderSupportsOllama(t *testing.T) {
provider, err := NewProvider(config.AIConfig{
Provider: "ollama",
Embeddings: config.AIEmbeddingConfig{
Model: "nomic-embed-text",
Dimensions: 768,
},
Metadata: config.AIMetadataConfig{
Model: "llama3.2",
},
Ollama: config.OllamaConfig{
BaseURL: "http://localhost:11434/v1",
APIKey: "ollama",
},
}, &http.Client{}, slog.New(slog.NewTextHandler(io.Discard, nil)))
if err != nil {
t.Fatalf("NewProvider() error = %v", err)
}
if provider.Name() != "ollama" {
t.Fatalf("provider name = %q, want ollama", provider.Name())
}
}