57 lines
1.6 KiB
Go
57 lines
1.6 KiB
Go
package ollama_test
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/maximhq/bifrost/core/internal/llmtests"
|
|
|
|
"github.com/maximhq/bifrost/core/schemas"
|
|
)
|
|
|
|
func TestOllama(t *testing.T) {
|
|
t.Parallel()
|
|
if strings.TrimSpace(os.Getenv("OLLAMA_BASE_URL")) == "" {
|
|
t.Skip("Skipping Ollama tests because OLLAMA_BASE_URL is not set")
|
|
}
|
|
|
|
client, ctx, cancel, err := llmtests.SetupTest()
|
|
if err != nil {
|
|
t.Fatalf("Error initializing test setup: %v", err)
|
|
}
|
|
defer cancel()
|
|
defer client.Shutdown()
|
|
|
|
testConfig := llmtests.ComprehensiveTestConfig{
|
|
Provider: schemas.Ollama,
|
|
ChatModel: "llama3.1:latest",
|
|
TextModel: "", // Ollama doesn't support text completion in newer models
|
|
EmbeddingModel: "", // Ollama doesn't support embedding
|
|
Scenarios: llmtests.TestScenarios{
|
|
TextCompletion: false, // Not supported
|
|
SimpleChat: true,
|
|
CompletionStream: true,
|
|
MultiTurnConversation: true,
|
|
ToolCalls: true,
|
|
ToolCallsStreaming: true,
|
|
MultipleToolCalls: true,
|
|
MultipleToolCallsStreaming: true,
|
|
End2EndToolCalling: true,
|
|
AutomaticFunctionCall: true,
|
|
ImageURL: false,
|
|
ImageBase64: false,
|
|
MultipleImages: false,
|
|
FileBase64: false,
|
|
FileURL: false,
|
|
CompleteEnd2End: true,
|
|
Embedding: false,
|
|
ListModels: true,
|
|
},
|
|
}
|
|
|
|
t.Run("OllamaTests", func(t *testing.T) {
|
|
llmtests.RunAllComprehensiveTests(t, client, ctx, testConfig)
|
|
})
|
|
}
|