add action type to responses header

This commit is contained in:
kevin zhao
2025-10-07 17:20:27 -07:00
parent b8b04514bc
commit c1a2be732e
5 changed files with 25 additions and 1 deletions
+11 -1
View File
@@ -244,7 +244,12 @@ impl ModelClient {
let max_attempts = self.provider.request_max_retries();
for attempt in 0..=max_attempts {
match self
.attempt_stream_responses(attempt, &payload_json, &auth_manager)
.attempt_stream_responses(
attempt,
&payload_json,
&auth_manager,
prompt.is_review_turn,
)
.await
{
Ok(stream) => {
@@ -272,6 +277,7 @@ impl ModelClient {
attempt: u64,
payload_json: &Value,
auth_manager: &Option<Arc<AuthManager>>,
is_review_turn: bool,
) -> std::result::Result<ResponseStream, StreamAttemptError> {
// Always fetch the latest auth in case a prior attempt refreshed the token.
let auth = auth_manager.as_ref().and_then(|m| m.auth());
@@ -293,6 +299,10 @@ impl ModelClient {
// Send session_id for compatibility.
.header("conversation_id", self.conversation_id.to_string())
.header("session_id", self.conversation_id.to_string())
.header(
"action_kind",
if is_review_turn { "review" } else { "turn" },
)
.header(reqwest::header::ACCEPT, "text/event-stream")
.json(payload_json);
+3
View File
@@ -41,6 +41,9 @@ pub struct Prompt {
/// Optional the output schema for the model's response.
pub output_schema: Option<Value>,
/// Marks whether this prompt is part of a review turn.
pub is_review_turn: bool,
}
impl Prompt {
+1
View File
@@ -1950,6 +1950,7 @@ async fn run_turn(
parallel_tool_calls,
base_instructions_override: turn_context.base_instructions.clone(),
output_schema: turn_context.final_output_json_schema.clone(),
is_review_turn: turn_context.is_review_mode,
};
let mut retries = 0;