Skip to content

Commit 155293f

Browse files
TheArchitectitclaude
authored andcommitted
fix: make delta field optional in ChunkChoice
The final streaming chunk from some providers contains only finish_reason and usage, with no delta field. Made it optional to prevent parse errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent ef8b03f commit 155293f

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

rust/crates/api/src/providers/openai_compat.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,7 @@ struct ChatCompletionChunk {
790790

791791
#[derive(Debug, Deserialize)]
792792
struct ChunkChoice {
793+
#[serde(default)]
793794
delta: ChunkDelta,
794795
#[serde(default)]
795796
finish_reason: Option<String>,

0 commit comments

Comments
 (0)