Skip to content

Commit a400363

Browse files
authored
Fix audio transcription deserialization when duration field is absent (#512)
The `duration` field on `AudioTranscriptionResponse` uses a custom `deserialize_with`, which makes serde require the field to be present in the JSON — even though it's `Option<f64>`. When the inference proxy (vllm-proxy-rs) returns a response without a top-level `duration` field (it nests it under `usage.seconds`), deserialization fails with "missing field `duration`", causing a 502. Fix: add `#[serde(default)]` so missing `duration` deserializes as `None`.
1 parent 27c1161 commit a400363

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

crates/inference_providers/src/models.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ pub struct AudioTranscriptionResponse {
992992
pub text: String,
993993

994994
/// Total audio duration in seconds (may be a string in some provider responses)
995+
#[serde(default)]
995996
#[serde(skip_serializing_if = "Option::is_none")]
996997
#[serde(deserialize_with = "deserialize_duration")]
997998
pub duration: Option<f64>,

0 commit comments

Comments
 (0)