mirror of
https://github.com/hanzoai/vector-go.git
synced 2026-10-30 18:18:35 +00:00
# Conflicts: # examples/simple/go.mod # examples/simple/go.sum # go.mod # go.sum # qdrant/collections_service_grpc.pb.go # qdrant/compare_versions.go # qdrant/config.go # qdrant/grpc_client.go # qdrant/points_service_grpc.pb.go # qdrant/qdrant_grpc.pb.go # qdrant/snapshots_service_grpc.pb.go
38 lines
952 B
Go
38 lines
952 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"github.com/hanzoai/vector-go/qdrant"
|
|
)
|
|
|
|
//nolint:mnd,gocritic // magic numbers is acceptable for this example, as well as exit with fatal.
|
|
func main() {
|
|
// Create new client
|
|
client, err := qdrant.NewClient(&qdrant.Config{
|
|
Host: "xyz-example.eu-central.aws.cloud.qdrant.io",
|
|
Port: 6334,
|
|
APIKey: "<paste-your-api-key-here>",
|
|
// PoolSize: 3,
|
|
// KeepAliveTime: 10,
|
|
// KeepAliveTimeout: 2,
|
|
// TLSConfig: &tls.Config{...},
|
|
// GrpcOptions: []grpc.DialOption{},
|
|
// Headers: map[string]string{
|
|
// "x-custom-id": "my-client-id",
|
|
// "openai-api-key": "<openai-key>",
|
|
// },
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("could not instantiate: %v", err)
|
|
}
|
|
defer client.Close()
|
|
// List collections
|
|
collections, err := client.ListCollections(context.Background())
|
|
if err != nil {
|
|
log.Fatalf("could not get collections: %v", err)
|
|
}
|
|
log.Printf("List of collections: %v", collections)
|
|
}
|