Documentation
¶
Index ¶
- Constants
- Variables
- func NewRESTClient(cfg *ConnectionConfig) (*restClient, error)
- type CollectionConfig
- type CollectionInfo
- type ConnectionConfig
- type CreateCollectionRequest
- type Defaults
- type DeletePointsRequest
- type Distance
- type HNSWConfig
- type HTTPError
- type OptimizersConfig
- type Point
- type PointID
- type QdrantClientInterface
- type ScoredPoint
- type SearchRequest
- type UpsertPointsRequest
- type VectorParams
- type VectorsConfig
Constants ¶
View Source
const ( PointIDTypeString int = 1 PointIDTypeInt int = 2 )
Variables ¶
View Source
var ( ErrInvalidPointID = errors.New("qdrant: invalid point id") ErrForbidden = errors.New("qdrant: forbidden") ErrNotFound = errors.New("qdrant: not found") ErrBadRequest = errors.New("qdrant: bad request") ErrConflict = errors.New("qdrant: conflict") ErrRateLimited = errors.New("qdrant: rate limited") ErrServer = errors.New("qdrant: server error") )
View Source
var DefaultCollectionDefaults = Defaults{ Distance: DistanceCosine, HNSW: HNSWConfig{M: 16, EfConstruct: 128}, Optim: OptimizersConfig{DefaultSegmentNumber: 2}, }
Functions ¶
func NewRESTClient ¶
func NewRESTClient(cfg *ConnectionConfig) (*restClient, error)
Types ¶
type CollectionConfig ¶
type CollectionConfig struct {
Vectors VectorsConfig `json:"vectors"`
// Optional tuning
HNSW *HNSWConfig `json:"hnsw_config,omitempty"`
Optimizers *OptimizersConfig `json:"optimizers_config,omitempty"`
// Distributed / storage knobs
ShardNumber int `json:"shard_number,omitempty"`
ReplicationFactor int `json:"replication_factor,omitempty"`
OnDiskPayload *bool `json:"on_disk_payload,omitempty"`
// Escape hatch for unsupported / future fields
Extras map[string]any `json:"-"`
}
CollectionConfig represents the most commonly used Qdrant collection settings. It is opinionated but flexible.
Rule: - Typed fields for the common 80% - Extras for forward compatibility / advanced configs
func (*CollectionConfig) ApplyDefaults ¶
func (c *CollectionConfig) ApplyDefaults(d Defaults) error
ApplyDefaults fills missing values without overriding user intent.
type CollectionInfo ¶
type CollectionInfo struct {
Status string `json:"status"` // can extend this struct if needed
}
type ConnectionConfig ¶
type ConnectionConfig struct {
BaseURL string // e.g. "http://localhost:6333"
APIKey string // optional
Timeout time.Duration // per-request hard timeout (http.Client)
DialTimeout time.Duration // TCP dial timeout
IdleConnTimeout time.Duration // idle conn timeout
// Retry
RetryMaxAttempts int // total attempts incl. first (default 3)
RetryBaseDelay time.Duration // default 150ms
RetryMaxDelay time.Duration // default 2s
RetryJitter float64 // 0..1 (default 0.2)
}
ConnectionConfig holds the configuration parameters required to establish a connection to a Qdrant server.
type CreateCollectionRequest ¶
type CreateCollectionRequest struct {
Collection string
Config CollectionConfig
}
type Defaults ¶
type Defaults struct {
Distance Distance
HNSW HNSWConfig
Optim OptimizersConfig
}
type DeletePointsRequest ¶
type HNSWConfig ¶
type OptimizersConfig ¶
type OptimizersConfig struct {
DefaultSegmentNumber int `json:"default_segment_number,omitempty"`
}
type PointID ¶
type PointID struct {
// contains filtered or unexported fields
}
PointID supports string or integer IDs.
func PointIDInt ¶
func PointIDString ¶
func (PointID) MarshalJSON ¶
func (*PointID) UnmarshalJSON ¶
type QdrantClientInterface ¶
type QdrantClientInterface interface {
Health(ctx context.Context) error
UpsertPoints(ctx context.Context, req UpsertPointsRequest) error
DeletePoints(ctx context.Context, req DeletePointsRequest) error
Search(ctx context.Context, req SearchRequest) ([]ScoredPoint, error)
// Collection management (minimal baseline)
CreateCollection(ctx context.Context, req CreateCollectionRequest) error
DeleteCollection(ctx context.Context, collection string) error
GetCollectionInfo(ctx context.Context, collection string) (CollectionInfo, error)
}
QdrantClientInterface is a stable interface consumed by applications. It intentionally hides Qdrant SDK types and raw HTTP details.
type ScoredPoint ¶
type SearchRequest ¶
type UpsertPointsRequest ¶
type VectorParams ¶
type VectorsConfig ¶
type VectorsConfig struct {
Single *VectorParams `json:"-"`
Named map[string]VectorParams `json:"-"`
}
VectorsConfig supports either: - single unnamed vector - named vectors
func (VectorsConfig) MarshalJSON ¶
func (v VectorsConfig) MarshalJSON() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.