-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvectorstore.go
More file actions
51 lines (41 loc) · 1.88 KB
/
vectorstore.go
File metadata and controls
51 lines (41 loc) · 1.88 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
41
42
43
44
45
46
47
48
49
50
51
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.
// One or more optional filter maps restrict results by payload field values.
Search(ctx context.Context, collection string, vector []float32, limit uint64, filter ...map[string]string) ([]SearchResult, error)
}
// Vector represents an RFC-compatible vector payload for storage.
// It is equivalent to Point, but uses the Values field name from the spec.
type Vector struct {
ID string
Values []float32
Payload map[string]any
}
// 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"
Count uint64
Vectors uint64
Index string
}