mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-10 21:38:30 +02:00
52 lines
1.9 KiB
Rust
52 lines
1.9 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use qdrant_client::{
|
|
Payload, Qdrant,
|
|
qdrant::{Document, NamedVectors, PointStruct, UpsertPointsBuilder, Value},
|
|
};
|
|
|
|
pub async fn main() -> anyhow::Result<()> {
|
|
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::<String, Value>::from_iter(vec![(
|
|
"openai-api-key".into(),
|
|
"<YOUR_OPENAI_API_KEY>".into(),
|
|
)]),
|
|
},
|
|
)
|
|
.add_vector(
|
|
"small",
|
|
Document {
|
|
text: "Recipe for baking chocolate chip cookies".into(),
|
|
model: "openai/text-embedding-3-small".into(),
|
|
options: HashMap::<String, Value>::from_iter(vec![
|
|
(
|
|
"openai-api-key".into(),
|
|
Value::from("<YOUR_OPENAI_API_KEY>"),
|
|
),
|
|
("mrl".into(), Value::from(64)),
|
|
]),
|
|
},
|
|
),
|
|
Payload::default(),
|
|
)],
|
|
)
|
|
.wait(true),
|
|
)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|