Skip to content

Commit e293b8b

Browse files
committed
Review fixes
1 parent 7a4522b commit e293b8b

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/api_types/responses.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,10 @@ impl CreateResponsesResponse {
14811481
let mut val = serde_json::to_value(self).unwrap_or_default();
14821482
if let serde_json::Value::Object(ref mut map) = val {
14831483
if self.status == Some(ResponsesResponseStatus::Completed) {
1484-
map.insert("completed_at".into(), serde_json::json!(self.created_at));
1484+
map.insert(
1485+
"completed_at".into(),
1486+
serde_json::json!(chrono::Utc::now().timestamp() as f64),
1487+
);
14851488
}
14861489
for (k, v) in echo_fields {
14871490
// Don't overwrite reasoning if the struct already has it set from conversion
@@ -1509,8 +1512,12 @@ impl CreateResponsesPayload {
15091512
.into_iter()
15101513
.map(|mut t| {
15111514
if let serde_json::Value::Object(ref mut obj) = t {
1512-
obj.entry("strict").or_insert(serde_json::Value::Null);
1513-
obj.entry("description").or_insert(serde_json::Value::Null);
1515+
let is_function =
1516+
obj.get("type").and_then(|v| v.as_str()) == Some("function");
1517+
if is_function {
1518+
obj.entry("strict").or_insert(serde_json::Value::Null);
1519+
obj.entry("description").or_insert(serde_json::Value::Null);
1520+
}
15141521
}
15151522
t
15161523
})
@@ -1624,9 +1631,14 @@ impl CreateResponsesPayload {
16241631
})
16251632
.unwrap_or(serde_json::Value::Null),
16261633
);
1634+
m.insert(
1635+
"metadata".into(),
1636+
serde_json::to_value(self.metadata.clone()).unwrap_or(serde_json::Value::Null),
1637+
);
16271638
m.insert("error".into(), serde_json::Value::Null);
16281639
m.insert("incomplete_details".into(), serde_json::Value::Null);
16291640
m.insert("max_tool_calls".into(), serde_json::Value::Null);
1641+
// top_logprobs is not a request parameter on the Responses API; default to 0 per spec
16301642
m.insert("top_logprobs".into(), serde_json::json!(0));
16311643
// Ensure reasoning is echoed (null if not configured)
16321644
m.insert(

0 commit comments

Comments
 (0)