Skip to content

Commit

Permalink
chore(openai): fix response_format types
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 24, 2024
1 parent 5233744 commit 1986041
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/openai_multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extern crate spider;

use spider::configuration::{GPTConfigs, WaitForIdleNetwork};
use spider::features::chrome_common::RequestInterceptConfiguration;
use spider::tokio;
use spider::website::Website;
use std::time::Duration;
Expand Down
2 changes: 1 addition & 1 deletion spider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider"
version = "2.10.16"
version = "2.10.17"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
12 changes: 5 additions & 7 deletions spider/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ pub async fn openai_request_base(
let json_mode = gpt_configs.extra_ai_data;

match async_openai::types::ChatCompletionRequestAssistantMessageArgs::default()
.content(&string_concat!("URL: ", url, "\n", "HTML: ", resource))
.content(string_concat!("URL: ", url, "\n", "HTML: ", resource))
.build()
{
Ok(resource_completion) => {
Expand Down Expand Up @@ -1998,12 +1998,10 @@ pub async fn openai_request_base(
let v = match gpt_base
.max_tokens(max_tokens as u32)
.messages(messages)
.response_format(async_openai::types::ChatCompletionResponseFormat {
r#type: if json_mode {
async_openai::types::ChatCompletionResponseFormatType::JsonObject
} else {
async_openai::types::ChatCompletionResponseFormatType::Text
},
.response_format(if json_mode {
async_openai::types::ResponseFormat::JsonObject
} else {
async_openai::types::ResponseFormat::Text
})
.build()
{
Expand Down
2 changes: 1 addition & 1 deletion spider_chrome/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_chrome"
version = "2.10.16"
version = "2.10.17"
rust-version = "1.70"
authors = [
"j-mendez <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion spider_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_cli"
version = "2.10.16"
version = "2.10.17"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_transformations/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_transformations"
version = "2.10.16"
version = "2.10.17"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_utils"
version = "2.10.16"
version = "2.10.17"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_worker"
version = "2.10.16"
version = "2.10.17"
authors = [
"j-mendez <[email protected]>"
]
Expand Down

0 comments on commit 1986041

Please sign in to comment.