-
Notifications
You must be signed in to change notification settings - Fork 721
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
GenerationContentResponse coming from the Batch API contains CitationMetadata as specified in the docs: https://ai.google.dev/api/generate-content#citationmetadata
class CitationMetadata:
citationSources: list[CitationSource]The library models it different though, leading to a mismatch:
class CitationMetadata:
citations: list[Citation]As CitationMetadata also inherits from _common.BaseModel all extra properties lead to an exception.
And because (at least) the Batch API returns the "correct" model, parsing it using the library is not possible.
Environment details
- Programming language: Python
- OS: Linux
- Language runtime version: Python 3.13
- Package version: 1.28.0
Steps to reproduce
- Download jsonl output file from Batch API that has
response.candidates.0.citationMetadata.citationSourcespopulated. - Try to parse response with
GenerateContentResponse.model_validate_json
mertcanekiz
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.