GoogleCloudPlatform / GoogleCloudPlatform/generative-ai
[Bug]: Gemini 3.5 Flash doesn't return log probs
- Dominant language
- Jupyter Notebook
- Stars
- 17.7k
- Forks
- 4.5k
- Avg merge
- 12h 38m
- Merged PRs (30d)
- 42
Description
### File Name
gemini/logprobs/intro_logprobs.ipynb
### What happened?
When I run the cell containing this code:
```
prompt = """
I am not sure if I really like this restaurant a lot.
"""
response_schema = {"type": "STRING", "enum": ["Positive", "Negative", "Neutral"]}
response = client.models.generate_content(
model=MODEL_ID,
contents=prompt,
config=GenerateContentConfig(
response_mime_type="text/x.enum",
response_schema=response_schema,
response_logprobs=True, # default to False
logprobs=3, # [1-20]
),
)
print(response.text)
```
I get this error:
```
ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Unable to submit request because Logprobs is not supported for this model.
```
### Relevant log output
```shell
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.