-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvectorstore.go
More file actions
40 lines (31 loc) · 1.6 KB
/
vectorstore.go
File metadata and controls
40 lines (31 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package rag
import "context"
// VectorStore defines the interface for vector storage and search.
// QdrantClient satisfies this interface.
type VectorStore interface {
// CreateCollection creates a new vector collection with the given
// name and vector dimensionality.
CreateCollection(ctx context.Context, name string, vectorSize uint64) error
// CollectionExists checks whether a collection with the given name exists.
CollectionExists(ctx context.Context, name string) (bool, error)
// DeleteCollection deletes the collection with the given name.
DeleteCollection(ctx context.Context, name string) error
// ListCollections returns all collection names in the store.
ListCollections(ctx context.Context) ([]string, error)
// CollectionInfo returns metadata about a collection. Implementations
// should populate at least PointCount and VectorSize in the returned
// CollectionInfo struct.
CollectionInfo(ctx context.Context, name string) (*CollectionInfo, error)
// UpsertPoints inserts or updates points in the named collection.
UpsertPoints(ctx context.Context, collection string, points []Point) error
// Search performs a vector similarity search, returning up to limit results.
// An optional filter map restricts results by payload field values.
Search(ctx context.Context, collection string, vector []float32, limit uint64, filter map[string]string) ([]SearchResult, error)
}
// CollectionInfo holds backend-agnostic metadata about a collection.
type CollectionInfo struct {
Name string
PointCount uint64
VectorSize uint64
Status string // e.g. "green", "yellow", "red", "unknown"
}