Skip to content

Commit ed56dcd

Browse files
committed
fix: convert string URL to reqwest::Url
1 parent fc180ec commit ed56dcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

async-openai/src/chat_with_trait.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ impl<'c, C: Config> ChatWithTrait<'c, C> {
3131
request: CreateChatCompletionRequest,
3232
) -> Result<CreateChatCompletionResponse, OpenAIError> {
3333
// Prepare the request
34-
let url = self.client.config.url("/chat/completions");
34+
let url = reqwest::Url::parse(&self.client.config.url("/chat/completions"))
35+
.map_err(|e| OpenAIError::InvalidArgument(format!("Invalid URL: {}", e)))?;
3536

3637
// Serialize request body
3738
let body = serde_json::to_vec(&request)

0 commit comments

Comments
 (0)