diff --git a/pkg/tools/integration/web.go b/pkg/tools/integration/web.go index 55a68a3a2..6423e7152 100644 --- a/pkg/tools/integration/web.go +++ b/pkg/tools/integration/web.go @@ -485,6 +485,9 @@ func (p *GeminiSearchProvider) Search( count int, rangeCode string, ) (string, error) { + if rangeCode != "" { + return "", fmt.Errorf("gemini search does not support range filter") + } if strings.TrimSpace(p.apiKey) == "" { return "", errors.New("no API key provided") } @@ -1258,7 +1261,7 @@ var ( "glm_search", "baidu_search", } - autoPrimaryWebSearchProviders = []string{"gemini", "perplexity", "brave", "searxng", "tavily"} + autoPrimaryWebSearchProviders = []string{"perplexity", "brave", "searxng", "tavily", "gemini"} autoFallbackWebSearchProviders = []string{"baidu_search", "glm_search"} ) diff --git a/pkg/tools/integration/web_test.go b/pkg/tools/integration/web_test.go index 7d2fc34c0..6ccf98a08 100644 --- a/pkg/tools/integration/web_test.go +++ b/pkg/tools/integration/web_test.go @@ -1959,6 +1959,22 @@ func TestGeminiSearchProvider_SearchSuccess(t *testing.T) { } } +func TestGeminiSearchProvider_SearchRejectsRange(t *testing.T) { + provider := &GeminiSearchProvider{ + apiKey: "google-key", + model: "gemini-2.5-flash", + client: http.DefaultClient, + } + + _, err := provider.Search(context.Background(), "robotics", 2, "d") + if err == nil { + t.Fatal("expected error") + } + if !strings.Contains(err.Error(), "does not support range") { + t.Fatalf("unexpected error: %v", err) + } +} + func TestGeminiSearchProvider_SearchAPIError(t *testing.T) { provider := &GeminiSearchProvider{ apiKey: "google-key",