Skip to content

Commit e7da465

Browse files
authored
fix: bug fixes (64bit#104)
* fix: request creation failures should be bubbled up * ISSUE 103: Serialize None to null for content field in ChatCompletionRequestMessage
1 parent 3776935 commit e7da465

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

async-openai/src/client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ impl<C: Config> Client<C> {
197197
let client = self.http_client.clone();
198198

199199
backoff::future::retry(self.backoff.clone(), || async {
200+
let request = request_maker().await.map_err(backoff::Error::Permanent)?;
200201
let response = client
201-
.execute(request_maker().await?)
202+
.execute(request)
202203
.await
203204
.map_err(OpenAIError::Reqwest)
204205
.map_err(backoff::Error::Permanent)?;

async-openai/src/types/types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,8 @@ pub struct ChatCompletionRequestMessage {
723723
pub role: Role,
724724
/// The contents of the message.
725725
/// `content` is required for all messages except assistant messages with function calls.
726-
#[serde(skip_serializing_if = "Option::is_none")]
726+
// DON'T SKIP: https://github.com/64bit/async-openai/issues/103
727+
//#[serde(skip_serializing_if = "Option::is_none")]
727728
pub content: Option<String>,
728729
/// The name of the author of this message. `name` is required if role is function,
729730
/// and it should be the name of the function whose response is in the `content`.

0 commit comments

Comments
 (0)