-
Notifications
You must be signed in to change notification settings - Fork 738
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Summary
Cannot generate log probabilities from models above 2.0. Even for 2.0 sometimes it works and sometimes not. I receive the error
ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Logprobs is not enabled for models/gemini-2.5-pro', 'status': 'INVALID_ARGUMENT'}}
Environment details
- Programming language: Pyhon
- OS: macOS
- Language runtime version: 3.12.11
- Package version: 1.56.0
Steps to reproduce
Here is the code I used. Only works when I change model name to gemini-2.0-flash
from google import genai
from google.genai.types import GenerateContentConfig
client = genai.Client()
MODEL_ID = "gemini-2.5-flash"
prompt = "I really like the new features of the latest smartphone release."
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,
logprobs=3,
),
)
Thanks!
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.