Documentation
¶
Overview ¶
Package qdrant provides the vector database integration.
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) CollectionExists(ctx context.Context, name string) (bool, error)
- func (c *Client) CreateCollection(ctx context.Context, name string, dimension int) error
- func (c *Client) Delete(ctx context.Context, collectionName string, id string) error
- func (c *Client) Search(ctx context.Context, collectionName string, vector []float32, limit int, ...) ([]*SearchResult, error)
- func (c *Client) SetPayload(ctx context.Context, collectionName string, id string, ...) error
- func (c *Client) Upsert(ctx context.Context, collectionName string, points []*Point) error
- type Point
- type SearchResult
- type VectorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the VectorStore interface for Qdrant.
func NewClient ¶
NewClient creates a new Qdrant client. URL can be in formats: "localhost:6334", "host:port", "https://cloud.qdrant.io:6334" TLS is automatically enabled for URLs containing "https://" or cloud-like domains.
func (*Client) CollectionExists ¶
CollectionExists checks if a collection exists.
func (*Client) CreateCollection ¶
CreateCollection creates a new collection if it doesn't exist.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, collectionName string, vector []float32, limit int, threshold float64) ([]*SearchResult, error)
Search finds the nearest neighbors for a given vector.
type Point ¶
type Point struct {
ID string `json:"id"`
Vector []float32 `json:"vector"`
Payload map[string]interface{} `json:"payload"`
}
Point represents a data point in the vector database.
type SearchResult ¶
type SearchResult struct {
ID string `json:"id"`
Score float32 `json:"score"`
Payload map[string]interface{} `json:"payload"`
Vector []float32 `json:"vector,omitempty"`
}
SearchResult represents a single result from a similarity search.
type VectorStore ¶
type VectorStore interface {
// CreateCollection creates a new collection if it doesn't exist.
CreateCollection(ctx context.Context, name string, dimension int) error
// CollectionExists checks if a collection exists.
CollectionExists(ctx context.Context, name string) (bool, error)
// Upsert inserts or updates points in the collection.
Upsert(ctx context.Context, collectionName string, points []*Point) error
// Search finds the nearest neighbors for a given vector.
Search(ctx context.Context, collectionName string, vector []float32, limit int, threshold float64) ([]*SearchResult, error)
// Delete removes a point by ID.
Delete(ctx context.Context, collectionName string, id string) error
// SetPayload updates payload fields on existing points without re-uploading vectors.
SetPayload(ctx context.Context, collectionName string, id string, payload map[string]interface{}) error
// Close closes the connection to the database.
Close() error
}
VectorStore defines the interface for vector database operations.