diff --git a/pkg/tools/integration/web.go b/pkg/tools/integration/web.go index 6423e7152..0568ba8dc 100644 --- a/pkg/tools/integration/web.go +++ b/pkg/tools/integration/web.go @@ -485,9 +485,6 @@ 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") } diff --git a/pkg/tools/integration/web_test.go b/pkg/tools/integration/web_test.go index d7d704189..436413085 100644 --- a/pkg/tools/integration/web_test.go +++ b/pkg/tools/integration/web_test.go @@ -1959,19 +1959,36 @@ func TestGeminiSearchProvider_SearchSuccess(t *testing.T) { } } -func TestGeminiSearchProvider_SearchRejectsRange(t *testing.T) { +func TestGeminiSearchProvider_SearchIgnoresRange(t *testing.T) { provider := &GeminiSearchProvider{ apiKey: "google-key", model: "gemini-2.5-flash", - client: http.DefaultClient, + client: &http.Client{ + Transport: roundTripFunc(func(req *http.Request) (*http.Response, error) { + rec := httptest.NewRecorder() + rec.WriteHeader(http.StatusOK) + fmt.Fprint(rec, `{ + "candidates": [ + { + "content": { + "parts": [ + {"text": "Recent robotics result."} + ] + } + } + ] +}`) + return rec.Result(), nil + }), + }, } - _, err := provider.Search(context.Background(), "robotics", 2, "d") - if err == nil { - t.Fatal("expected error") + out, err := provider.Search(context.Background(), "robotics", 2, "d") + if err != nil { + t.Fatalf("Search() error: %v", err) } - if !strings.Contains(err.Error(), "does not support range") { - t.Fatalf("unexpected error: %v", err) + if !strings.Contains(out, "Recent robotics result.") { + t.Fatalf("missing response text in output: %s", out) } }