mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-08 20:38:31 +02:00
* Break Inference page into several pages * Make all inference code snippets testable and clean up * Make more snippets testable * Edits * Document automatic query and passage prefix injection in Cloud Inference Qdrant Cloud Inference silently applies model-specific prefixes (e.g. "query: "/"passage: " for E5, BGE-style instruction prefix for BGE/mxbai/ Snowflake arctic-embed) so users don't need to manage them manually. Add a section explaining this behavior, the idempotency guarantee, and the scope (Qdrant-hosted models only; external providers handle their own). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Document short query optimization in Cloud Inference Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update links * Expand on external provider API key usage * Add section about external provider API keys * Default to header for external API keys --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
800 B
Rust
28 lines
800 B
Rust
use qdrant_client::{
|
|
Qdrant,
|
|
qdrant::{Document, Query, QueryPointsBuilder, Value},
|
|
};
|
|
use std::collections::HashMap;
|
|
|
|
pub async fn main() -> anyhow::Result<()> {
|
|
let client = Qdrant::from_url("http://localhost:6333").build().unwrap(); // @hide
|
|
|
|
let mut options = HashMap::<String, Value>::new();
|
|
options.insert("output_dimension".to_string(), 512.into());
|
|
|
|
client
|
|
.with_header("cohere-api-key", "<YOUR_COHERE_API_KEY>")
|
|
.query(
|
|
QueryPointsBuilder::new("{collection_name}")
|
|
.query(Query::new_nearest(Document {
|
|
text: "a green square".into(),
|
|
model: "cohere/embed-v4.0".into(),
|
|
options,
|
|
}))
|
|
.build(),
|
|
)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|