* 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
34 lines
727 B
Go
34 lines
727 B
Go
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())
|
|
}
|
|
}
|