Commit 5aa9995
fix: handle missing
Gemini Flash 2.0 & 2.5 sometimes omits the parts field when returning
very short responses (e.g., single words), causing deserialization to
fail with `missing field parts` error.
This pr adds `#[serde(default)]` to `Content.parts` to gracefully handle
these cases by defaulting to an empty vector.
Fixes #1749
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Adds `#[serde(default)]` to `Content.parts` in `types.rs` to handle
missing `parts` field, fixing deserialization errors for short
responses.
>
> - **Behavior**:
> - Adds `#[serde(default)]` to `Content.parts` in `types.rs` to handle
missing `parts` field by defaulting to an empty vector.
> - Fixes deserialization errors for short responses from Gemini Flash
2.0 & 2.5.
> - **Misc**:
> - Fixes issue #1749.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for c523f8b. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->
Co-authored-by: Doral Pipeline <pipelines@doralhw.org>parts field in gemini flash responses (#2272)1 parent faeace8 commit 5aa9995
1 file changed
Lines changed: 1 addition & 0 deletions
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
| |||
0 commit comments