From 3b4ad6d9da4c80d41d5b652133f68c081b99147b Mon Sep 17 00:00:00 2001 From: awol2005ex Date: Mon, 24 Mar 2025 16:12:07 +0800 Subject: [PATCH] fixed the error that some openai compatible api's response don't have "object" field --- async-openai/src/types/chat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/async-openai/src/types/chat.rs b/async-openai/src/types/chat.rs index b60011d0..8ba74515 100644 --- a/async-openai/src/types/chat.rs +++ b/async-openai/src/types/chat.rs @@ -897,7 +897,7 @@ pub struct CreateChatCompletionResponse { pub system_fingerprint: Option, /// The object type, which is always `chat.completion`. - pub object: String, + pub object: Option, pub usage: Option, } @@ -980,7 +980,7 @@ pub struct CreateChatCompletionStreamResponse { /// Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. pub system_fingerprint: Option, /// The object type, which is always `chat.completion.chunk`. - pub object: String, + pub object: Option, /// An optional field that will only be present when you set `stream_options: {"include_usage": true}` in your request. /// When present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.