mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-06 19:38:30 +02:00
feat: add rust snippets
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
```rust
|
||||
use qdrant_client::{
|
||||
Qdrant, QdrantError,
|
||||
qdrant::{Document, Query, QueryPointsBuilder, Value},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
let client = Qdrant::from_url("http://localhost:6333").build().unwrap();
|
||||
|
||||
let mut options = HashMap::<String, Value>::new();
|
||||
options.insert("openai-api-key".to_string(), "<YOUR_OPENAI_API_KEY>".into());
|
||||
options.insert("dimensions".to_string(), 512.into());
|
||||
|
||||
client
|
||||
.query(
|
||||
QueryPointsBuilder::new("<your-collection_name>")
|
||||
.query(Query::new_nearest(Document {
|
||||
text: "How to bake cookies?".into(),
|
||||
model: "openai/text-embedding-3-large".into(),
|
||||
options,
|
||||
}))
|
||||
.build(),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
Reference in New Issue
Block a user