“google.api_core.exceptions.InvalidArgument: 400 Only one candidate can be specified”
I would like to know how to recieve multiple output of the Gemini LLM by chaning value of candidate_count parameter. Or does the current Gemini API only allow one output per query?
I would appreciate if you could help me with it.
Thanks
Hi @Jaeseong_Lee. Currently, Gemini API doesn’t support generating multiple candidates in a single call. In case you want to generate multiple responses, you can make multiple separate calls to the API using for loop. You can follow the below code :
count = []
for _ in range(3):
response = model.generate_content(
contents=input_text,
generation_config=palm.GenerationConfig(
temperature=0.7
)
)
count.append(response)