Support end_turn flag (#9698)

Experimental flag that signals the end of the turn.
This commit is contained in:
pakrym-oai
2026-01-22 09:27:48 -08:00
committed by GitHub
parent 4d48d4e0c2
commit b511c38ddb
31 changed files with 92 additions and 4 deletions

View File

@@ -80,6 +80,10 @@ pub enum ResponseItem {
id: Option<String>,
role: String,
content: Vec<ContentItem>,
// Do not use directly, no available consistently across all providers.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
end_turn: Option<bool>,
},
Reasoning {
#[serde(default, skip_serializing)]
@@ -328,6 +332,7 @@ impl From<DeveloperInstructions> for ResponseItem {
content: vec![ContentItem::InputText {
text: di.into_text(),
}],
end_turn: None,
}
}
}
@@ -497,6 +502,7 @@ impl From<ResponseInputItem> for ResponseItem {
role,
content,
id: None,
end_turn: None,
},
ResponseInputItem::FunctionCallOutput { call_id, output } => {
Self::FunctionCallOutput { call_id, output }

View File

@@ -1607,6 +1607,7 @@ impl From<CompactedItem> for ResponseItem {
content: vec![ContentItem::OutputText {
text: value.message,
}],
end_turn: None,
}
}
}