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:
33
internal/ai/factory_test.go
Normal file
33
internal/ai/factory_test.go
Normal 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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user