Skip to content

Commit

Permalink
dont call to_string on a string value
Browse files Browse the repository at this point in the history
  • Loading branch information
linusbierhoff committed Oct 6, 2024
1 parent b744708 commit 564dcdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion async-openai/src/types/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ where
D: serde::Deserializer<'de>,
{
let value = serde_json::Value::deserialize(deserializer)?;
Ok(value.to_string())

match value {
serde_json::Value::String(s) => Ok(s),
_ => Ok(value.to_string())
}
}


Expand Down
6 changes: 5 additions & 1 deletion async-openai/src/types/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ where
D: serde::Deserializer<'de>,
{
let value = serde_json::Value::deserialize(deserializer)?;
Ok(value.to_string())

match value {
serde_json::Value::String(s) => Ok(s),
_ => Ok(value.to_string())
}
}

#[derive(Clone, Serialize, Debug, Deserialize, PartialEq)]
Expand Down

0 comments on commit 564dcdf

Please sign in to comment.