mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 12:58: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>
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package snippet
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/qdrant/go-client/qdrant"
|
|
)
|
|
|
|
func Main() {
|
|
// @hide-start
|
|
client, err := qdrant.NewClient(&qdrant.Config{
|
|
Host: "xyz-example.qdrant.io",
|
|
Port: 6334,
|
|
APIKey: "<paste-your-api-key-here>",
|
|
UseTLS: true,
|
|
})
|
|
// @hide-end
|
|
|
|
if err != nil { panic(err) } // @hide
|
|
defer client.Close() // @hide
|
|
|
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
|
CollectionName: "<your-collection>",
|
|
Points: []*qdrant.PointStruct{
|
|
{
|
|
Id: qdrant.NewIDNum(1),
|
|
Vectors: qdrant.NewVectorsImage(&qdrant.Image{
|
|
Model: "qdrant/clip-vit-b-32-vision",
|
|
Image: qdrant.NewValueString("https://qdrant.tech/example.png"),
|
|
}),
|
|
Payload: qdrant.NewValueMap(map[string]any{
|
|
"title": "Example image",
|
|
}),
|
|
},
|
|
},
|
|
})
|
|
|
|
client.Query(context.Background(), &qdrant.QueryPoints{
|
|
CollectionName: "<your-collection>",
|
|
Query: qdrant.NewQueryNearest(
|
|
qdrant.NewVectorInputDocument(&qdrant.Document{
|
|
Text: "Mission to Mars",
|
|
Model: "qdrant/clip-vit-b-32-text",
|
|
}),
|
|
),
|
|
})
|
|
}
|