Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grounding Web with Gemini Flash 2.0 - google_search field instead of google_search_retrieval #2914

Open
fatihyildizhan opened this issue Feb 8, 2025 · 0 comments
Assignees
Labels
samples Issues that are directly related to samples.

Comments

@fatihyildizhan
Copy link

Hello,

I get the following error in the grounding web sample with Gemini Flash 2.0. How can I make this request with C# .Net 8?
Thank you for your time.

Error message:
Status(StatusCode="InvalidArgument", Detail="Unable to submit request because Please use google_search field instead of google_search_retrieval field.. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini")

Sample:
https://github.com/GoogleCloudPlatform/dotnet-docs-samples/blob/main/aiplatform/api/AIPlatform.Samples/GroundingWebSample.cs#L57

var generateContentRequest = new GenerateContentRequest
{
    Model = $"projects/{projectId}/locations/{location}/publishers/{publisher}/models/{model}",
    GenerationConfig = new GenerationConfig
    {
        Temperature = 0.0f
    },
    Contents =
    {
        new Content
        {
            Role = "USER",
            Parts = { new Part { Text = "When is the next total solar eclipse in US?" } }
        }
    },
    Tools =
    {
        new Tool
        {
            GoogleSearchRetrieval = new GoogleSearchRetrieval()
        }
    }
};
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Feb 8, 2025
@jskeet jskeet assigned meteatamel and unassigned jskeet Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

No branches or pull requests

3 participants