Skip to content

Commit 7d8a77b

Browse files
committed
fix(client): handle keepalive events in streaming responses
1 parent fef329e commit 7d8a77b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

async-openai/src/client.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,10 @@ where
763763
break;
764764
}
765765

766+
if message.event == "keepalive" {
767+
continue;
768+
}
769+
766770
let response = match serde_json::from_str::<O>(&message.data) {
767771
Err(e) => Err(map_deserialization_error(e, message.data.as_bytes())),
768772
Ok(output) => Ok(output),

0 commit comments

Comments
 (0)