From 1986041e8d6a29e94eb92e81aee3ee2837147f9f Mon Sep 17 00:00:00 2001 From: j-mendez Date: Thu, 24 Oct 2024 05:51:12 -0400 Subject: [PATCH] chore(openai): fix response_format types --- Cargo.lock | 12 ++++++------ examples/openai_multi.rs | 1 + spider/Cargo.toml | 2 +- spider/src/utils/mod.rs | 12 +++++------- spider_chrome/Cargo.toml | 2 +- spider_cli/Cargo.toml | 2 +- spider_transformations/Cargo.toml | 2 +- spider_utils/Cargo.toml | 2 +- spider_worker/Cargo.toml | 2 +- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 629233aeb..66173c033 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3894,7 +3894,7 @@ dependencies = [ [[package]] name = "spider" -version = "2.10.16" +version = "2.10.17" dependencies = [ "ahash", "async-openai", @@ -3955,7 +3955,7 @@ dependencies = [ [[package]] name = "spider_chrome" -version = "2.10.16" +version = "2.10.17" dependencies = [ "adblock", "async-tungstenite", @@ -3990,7 +3990,7 @@ dependencies = [ [[package]] name = "spider_cli" -version = "2.10.16" +version = "2.10.17" dependencies = [ "clap", "env_logger", @@ -4014,7 +4014,7 @@ dependencies = [ [[package]] name = "spider_transformations" -version = "2.10.16" +version = "2.10.17" dependencies = [ "aho-corasick", "fast_html2md", @@ -4035,7 +4035,7 @@ dependencies = [ [[package]] name = "spider_utils" -version = "2.10.16" +version = "2.10.17" dependencies = [ "indexmap 1.9.3", "serde", @@ -4047,7 +4047,7 @@ dependencies = [ [[package]] name = "spider_worker" -version = "2.10.16" +version = "2.10.17" dependencies = [ "env_logger", "lazy_static", diff --git a/examples/openai_multi.rs b/examples/openai_multi.rs index 41993369f..fb24d3d05 100644 --- a/examples/openai_multi.rs +++ b/examples/openai_multi.rs @@ -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; diff --git a/spider/Cargo.toml b/spider/Cargo.toml index 632137d1e..494c2cab6 100644 --- a/spider/Cargo.toml +++ b/spider/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider" -version = "2.10.16" +version = "2.10.17" authors = [ "j-mendez " ] diff --git a/spider/src/utils/mod.rs b/spider/src/utils/mod.rs index 398d4f46f..7424b3628 100644 --- a/spider/src/utils/mod.rs +++ b/spider/src/utils/mod.rs @@ -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) => { @@ -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() { diff --git a/spider_chrome/Cargo.toml b/spider_chrome/Cargo.toml index 432087b8a..9548af0dd 100644 --- a/spider_chrome/Cargo.toml +++ b/spider_chrome/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider_chrome" -version = "2.10.16" +version = "2.10.17" rust-version = "1.70" authors = [ "j-mendez " diff --git a/spider_cli/Cargo.toml b/spider_cli/Cargo.toml index 0e65de576..55a43b35a 100644 --- a/spider_cli/Cargo.toml +++ b/spider_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider_cli" -version = "2.10.16" +version = "2.10.17" authors = [ "j-mendez " ] diff --git a/spider_transformations/Cargo.toml b/spider_transformations/Cargo.toml index 9434b8495..cdb5e60d7 100644 --- a/spider_transformations/Cargo.toml +++ b/spider_transformations/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider_transformations" -version = "2.10.16" +version = "2.10.17" authors = [ "j-mendez " ] diff --git a/spider_utils/Cargo.toml b/spider_utils/Cargo.toml index dfff7fbe9..2c255c859 100644 --- a/spider_utils/Cargo.toml +++ b/spider_utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider_utils" -version = "2.10.16" +version = "2.10.17" authors = [ "j-mendez " ] diff --git a/spider_worker/Cargo.toml b/spider_worker/Cargo.toml index 200d7c8a9..dc32951cc 100644 --- a/spider_worker/Cargo.toml +++ b/spider_worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spider_worker" -version = "2.10.16" +version = "2.10.17" authors = [ "j-mendez " ]