Make text embedding title optional

- Make text embedding title optional, as sending it causes erros
on tasks that don't support title, like CLASSIFICATION.
- Update dependencies
This commit is contained in:
2024-04-15 11:10:11 +01:00
parent 5de4a96d33
commit 0e219aded0
4 changed files with 12 additions and 11 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ Cargo.lock
*.pdb *.pdb
/target /target
.cargo/config.toml .cargo/config.toml
.DS_Store

View File

@@ -8,17 +8,17 @@ edition = "2021"
[dependencies] [dependencies]
deadqueue = "0.2.4" deadqueue = "0.2.4"
futures-util = "0.3.30" futures-util = "0.3.30"
gcp_auth = "0.10.0" gcp_auth = "0.11.1"
reqwest = { version = "0.11.9", features = ["json", "gzip"] } reqwest = { version = "0.12.3", features = ["json", "gzip"] }
reqwest-eventsource = "0.5.0" reqwest-eventsource = "0.6.0"
serde = { version = "*", features = ["derive"] } serde = { version = "1.0.197", features = ["derive"] }
serde_json = { version = "*"} serde_json = { version = "1.0.115"}
tracing = "0.1.40" tracing = "0.1.40"
tokio = { version = "1.36.0" } tokio = { version = "1.37.0" }
[dev-dependencies] [dev-dependencies]
console = "0.15.8" console = "0.15.8"
dialoguer = "0.11.0" dialoguer = "0.11.0"
indicatif = "0.17.7" indicatif = "0.17.8"
tokio = { version = "1.35.1", features = ["full"] } tokio = { version = "1.37.0", features = ["full"] }
tracing-subscriber = "0.3.18" tracing-subscriber = "0.3.18"

View File

@@ -21,12 +21,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let embedding_request = TextEmbeddingRequest { let embedding_request = TextEmbeddingRequest {
instances: vec![ instances: vec![
TextEmbeddingRequestInstance { TextEmbeddingRequestInstance {
title: String::from("Embed testing"), title: Some(String::from("Embed testing")),
content: String::from("Embed testing"), content: String::from("Embed testing"),
task_type: String::from("RETRIEVAL_DOCUMENT"), task_type: String::from("RETRIEVAL_DOCUMENT"),
}, },
TextEmbeddingRequestInstance { TextEmbeddingRequestInstance {
title: String::from("Embed testing 2"), title: Some(String::from("Embed testing 2")),
content: String::from("Embed testing 2"), content: String::from("Embed testing 2"),
task_type: String::from("RETRIEVAL_DOCUMENT"), task_type: String::from("RETRIEVAL_DOCUMENT"),
}, },

View File

@@ -11,7 +11,7 @@ pub struct TextEmbeddingRequest {
pub struct TextEmbeddingRequestInstance { pub struct TextEmbeddingRequestInstance {
pub content: String, pub content: String,
pub task_type: String, pub task_type: String,
pub title: String, pub title: Option<String>,
} }
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]