If I understand it correctly, you're supposed to be able to set candidate_count to 2. I can't that to work. With candidate_count set to 1 the code works and a normal response is received.
Environment details
OS type and version:
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Python version: python --version
Python 3.11.4
pip version: pip --version
pip 24.0
google-cloud-aiplatform version: pip show google-cloud-aiplatform
Version: 1.47.0
Steps to reproduce
Run the code below.
Read exception
Code example
# loosely taken from https://github.com/GoogleCloudPlatform/generative-ai/blob/main/gemini/getting-started/intro_gemini_1_5_pro.ipynb
from vertexai.generative_models import GenerativeModel, GenerationConfig
gemini_pro_model = GenerativeModel("gemini-1.5-pro-preview-0409")
generation_config = GenerationConfig(
temperature=2.0,
candidate_count=2
)
model_response = gemini_pro_model.generate_content(contents="Why do cars have four wheels?", generation_config=generation_config)
print("model_response\n",model_response)
Stack trace
<..>
google.api_core.exceptions.InvalidArgument: 400 Unable to submit request because it has a candidateCount value of 2 but the supported range is from 1 to 2. Update the value and try again.
Hi,
If I understand it correctly, you're supposed to be able to set
candidate_count
to 2. I can't that to work. Withcandidate_count
set to 1 the code works and a normal response is received.Environment details
Ubuntu 22.04.4 LTS (Jammy Jellyfish)
python --version
Python 3.11.4
pip --version
pip 24.0
google-cloud-aiplatform
version:pip show google-cloud-aiplatform
Version: 1.47.0
Steps to reproduce
Code example
Stack trace