micro--go-micro
6e04f1afb5
Follow-up cleanup after merging the Ollama provider (#3636): - Add the `ollama` row to the AI provider capability matrix in the provider guide, and blank-import `ai/ollama` in provider_capabilities_test.go so the matrix stays enforced against the registry (the provider registers a stream but wasn't imported in that test, so its row went unchecked). - README: bump "7 LLM providers" → 8 and list Ollama (local + cloud); add its default model (`llama3.2`) to the model table. - Fix a fictional model name shipped in the example and package doc: `gemma4:31b-cloud` → `gpt-oss:120b`. gemma4 doesn't exist, and the `-cloud` suffix is for cloud models proxied through a local Ollama, not the direct ollama.com/v1 endpoint the example uses. - Record the provider and the new agent.BaseURL/micro.AgentBaseURL option in the CHANGELOG [Unreleased] section. Claude-Session: https://claude.ai/code/session_01CmdEY7pYmV5zzwCjNJ4ykL Co-authored-by: Claude <noreply@anthropic.com>
49 行
1.1 KiB
Go
49 行
1.1 KiB
Go
package guides_test
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
|
|
"go-micro.dev/v6/ai"
|
|
_ "go-micro.dev/v6/ai/anthropic"
|
|
_ "go-micro.dev/v6/ai/atlascloud"
|
|
_ "go-micro.dev/v6/ai/gemini"
|
|
_ "go-micro.dev/v6/ai/groq"
|
|
_ "go-micro.dev/v6/ai/mistral"
|
|
_ "go-micro.dev/v6/ai/ollama"
|
|
_ "go-micro.dev/v6/ai/openai"
|
|
_ "go-micro.dev/v6/ai/together"
|
|
)
|
|
|
|
func TestAIProviderGuideCapabilityMatrixMatchesRegistry(t *testing.T) {
|
|
_, filename, _, ok := runtime.Caller(0)
|
|
if !ok {
|
|
t.Fatal("runtime.Caller failed")
|
|
}
|
|
|
|
guidePath := filepath.Join(filepath.Dir(filename), "ai-provider-guide.md")
|
|
b, err := os.ReadFile(guidePath)
|
|
if err != nil {
|
|
t.Fatalf("read AI provider guide: %v", err)
|
|
}
|
|
guide := string(b)
|
|
|
|
for _, row := range ai.CapabilityRows() {
|
|
want := fmt.Sprintf("| `%s` | %s | %s | %s | %s |", row.Provider, yesNo(row.Model), yesNo(row.Image), yesNo(row.Video), yesNo(row.Stream))
|
|
if !strings.Contains(guide, want) {
|
|
t.Fatalf("AI provider guide capability matrix is stale; missing row %q", want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func yesNo(ok bool) string {
|
|
if ok {
|
|
return "Yes"
|
|
}
|
|
return "No"
|
|
}
|