Skip to content

Commit

Permalink
fix compiler issues; bump qdrant 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagomed committed Dec 9, 2023
1 parent e333121 commit 6a903b3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion orca-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions orca-core/src/pipeline/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ impl<M: LLM + Clone + 'static> LLMPipeline<M> {
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)),
}
}

Expand Down
6 changes: 3 additions & 3 deletions orca-core/src/prompt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,14 @@ macro_rules! prompts {
($e:expr) => {{
$e
.into_iter()
.map(|x| Box::new(x.clone()) as Box<dyn crate::prompt::Prompt>)
.collect::<Vec<Box<dyn crate::prompt::Prompt>>>()
.map(|x| Box::new(x.clone()) as Box<dyn $crate::prompt::Prompt>)
.collect::<Vec<Box<dyn $crate::prompt::Prompt>>>()
}};
($($e:expr),* $(,)?) => {
{
let mut prompts = Vec::new();
$(
prompts.push(Box::new($e.to_string()) as Box<dyn Prompt>);
prompts.push(Box::new($e.to_string()) as Box<dyn $crate::prompt::Prompt>);
)*
prompts
}
Expand Down
22 changes: 20 additions & 2 deletions orca-core/src/qdrant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(())
}

Expand Down Expand Up @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion orca-models/src/openai/embeddings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl OpenAI {
Ok(req)
}

async fn generate_embedding(&self, prompt: String) -> Result<Vec<Response>> {
async fn generate_embedding(&self, prompt: String) -> Result<Response> {
let req = self.generate_request(&prompt)?;
let res = self.client.execute(req).await?;
let res = res.json::<Response>().await?;
Expand Down

0 comments on commit 6a903b3

Please sign in to comment.