diff --git a/orca-core/Cargo.toml b/orca-core/Cargo.toml index aa12228..b4cf732 100644 --- a/orca-core/Cargo.toml +++ b/orca-core/Cargo.toml @@ -23,7 +23,7 @@ pdf_text = { git = "https://github.com/pdf-rs/pdf_text" } itertools = "^0.11.0" pdf = { git = "https://github.com/pdf-rs/pdf" } uuid = { version = "^1.1.2", features = ["v4"] } -qdrant-client = "1.5.0" +qdrant-client = "1.7.0" anyhow = "1.0.75" serial_test = "2.0.0" rand = "0.8.5" diff --git a/orca-core/src/pipeline/simple.rs b/orca-core/src/pipeline/simple.rs index a0d11c4..4417e05 100644 --- a/orca-core/src/pipeline/simple.rs +++ b/orca-core/src/pipeline/simple.rs @@ -116,9 +116,7 @@ impl LLMPipeline { self.template_engine = template_clone; Ok(template_name) } - None => { - return Err(anyhow::anyhow!("Template with name {} does not exist", name)); - } + None => Err(anyhow::anyhow!("Template with name {} does not exist", name)), } } diff --git a/orca-core/src/prompt/mod.rs b/orca-core/src/prompt/mod.rs index 6f8decc..42d4eb5 100644 --- a/orca-core/src/prompt/mod.rs +++ b/orca-core/src/prompt/mod.rs @@ -313,14 +313,14 @@ macro_rules! prompts { ($e:expr) => {{ $e .into_iter() - .map(|x| Box::new(x.clone()) as Box) - .collect::>>() + .map(|x| Box::new(x.clone()) as Box) + .collect::>>() }}; ($($e:expr),* $(,)?) => { { let mut prompts = Vec::new(); $( - prompts.push(Box::new($e.to_string()) as Box); + prompts.push(Box::new($e.to_string()) as Box); )* prompts } diff --git a/orca-core/src/qdrant.rs b/orca-core/src/qdrant.rs index 005cfc0..0e69295 100644 --- a/orca-core/src/qdrant.rs +++ b/orca-core/src/qdrant.rs @@ -108,6 +108,24 @@ impl Qdrant { Ok(Qdrant { client }) } + /// Creates a new `Qdrant` instance given an existing `QdrantClient`. + /// This is useful if you want to use a custom `QdrantClient` instance. + /// + /// # Arguments + /// * `client` - An existing `QdrantClient` instance. + /// + /// # Example + /// ``` + /// use orca_core::qdrant::Qdrant; + /// use qdrant_client::prelude::QdrantClient; + /// + /// let client = QdrantClient::new(None).unwrap(); + /// let qdrant = Qdrant::from_client(client); + /// ``` + pub fn from_client(client: QdrantClient) -> Self { + Qdrant { client } + } + /// Creates a new collection with the given name and vector size. /// /// # Arguments @@ -195,7 +213,7 @@ impl Qdrant { { let payload: Payload = payload.to_payload()?; let points = vec![PointStruct::new(0, vector, payload)]; - self.client.upsert_points_blocking(collection_name, points, None).await?; + self.client.upsert_points_blocking(collection_name, None, points, None).await?; Ok(()) } @@ -249,7 +267,7 @@ impl Qdrant { let points = points_result?; - self.client.upsert_points_blocking(collection_name, points, None).await?; + self.client.upsert_points_blocking(collection_name, None, points, None).await?; Ok(()) } diff --git a/orca-models/src/openai/embeddings.rs b/orca-models/src/openai/embeddings.rs index b7ef041..401b007 100644 --- a/orca-models/src/openai/embeddings.rs +++ b/orca-models/src/openai/embeddings.rs @@ -175,7 +175,7 @@ impl OpenAI { Ok(req) } - async fn generate_embedding(&self, prompt: String) -> Result> { + async fn generate_embedding(&self, prompt: String) -> Result { let req = self.generate_request(&prompt)?; let res = self.client.execute(req).await?; let res = res.json::().await?;