GoogleCloudPlatform / generative-ai

Sample code and notebooks for Generative AI on Google Cloud, with Gemini on Vertex AI
https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview
Apache License 2.0
6.83k stars 1.84k forks source link

candidate_count > 1 with InvalidArgument: 400 Only one candidate can be specified #406

Closed lingjiekong closed 7 months ago

lingjiekong commented 7 months ago

Given this code snippet from here

model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(
    'Tell me a story about a magic backpack.',
    generation_config=genai.types.GenerationConfig(
        # Only one candidate for now.
        candidate_count=1,
        stop_sequences=['x'],
        max_output_tokens=20,
        temperature=1.0)
)

It looks like candidate_count is configurable also based on doc.

However, I got InvalidArgument: 400 Only one candidate can be specified after changing candidate_count = 2, so is more than 1 candidate not supported?

holtskinner commented 7 months ago

Hello, This repository is for Generative AI with Vertex AI on Google Cloud, not the Google AI Gemini/PaLM APIs.

This looks like the Python client library, so you can try filing an issue in this repository:

https://github.com/google/generative-ai-python

or ask in the Google Developers Community Discord #gemini-api channel.