diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/mrl-multi-stage/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/mrl-multi-stage/rust.md new file mode 100644 index 000000000..88c1f60da --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/mrl-multi-stage/rust.md @@ -0,0 +1,41 @@ +```rust +use std::collections::HashMap; + +use qdrant_client::{ + Qdrant, QdrantError, + qdrant::{Document, PrefetchQueryBuilder, Query, QueryPointsBuilder, Value}, +}; + +client + .query( + QueryPointsBuilder::new("{collection_name}") + .add_prefetch( + PrefetchQueryBuilder::default() + .query(Query::new_nearest(Document { + text: "How to bake cookies?".into(), + model: "openai/text-embedding-3-small".into(), + options: HashMap::::from_iter(vec![ + ( + "openai-api-key".to_string(), + Value::from(""), + ), + ("mrl".into(), Value::from(64)), + ]), + })) + .using("small") + .limit(10_u64), + ) + .query(Query::new_nearest(Document { + text: "How to bake cookies?".into(), + model: "openai/text-embedding-3-small".into(), + options: HashMap::from_iter(vec![( + "openai-api-key".into(), + "".into(), + )]), + })) + .using("large") + .limit(10_u64) + .build(), + ) + .await?; +``` diff --git a/qdrant-landing/content/documentation/headless/snippets/inference/mrl/rust.md b/qdrant-landing/content/documentation/headless/snippets/inference/mrl/rust.md new file mode 100644 index 000000000..f615cd3c5 --- /dev/null +++ b/qdrant-landing/content/documentation/headless/snippets/inference/mrl/rust.md @@ -0,0 +1,49 @@ +```rust +use std::collections::HashMap; + +use qdrant_client::{ + Payload, Qdrant, QdrantError, + qdrant::{Document, NamedVectors, PointStruct, UpsertPointsBuilder, Value}, +}; + +let client = Qdrant::from_url("http://localhost:6334").build()?; + +client + .upsert_points( + UpsertPointsBuilder::new( + "{collection_name}", + vec![PointStruct::new( + 1, + NamedVectors::default() + .add_vector( + "large", + Document { + text: "Recipe for baking chocolate chip cookies".into(), + model: "openai/text-embedding-3-small".into(), + options: HashMap::::from_iter(vec![( + "openai-api-key".into(), + "".into(), + )]), + }, + ) + .add_vector( + "small", + Document { + text: "Mars, the red planet".into(), + model: "sentence-transformers/all-minilm-l6-v2".into(), + options: HashMap::::from_iter(vec![ + ( + "openai-api-key".into(), + Value::from(""), + ), + ("mrl".into(), Value::from(64)), + ]), + }, + ), + Payload::default(), + )], + ) + .wait(true), + ) + .await?; +```