-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollections.go
More file actions
31 lines (26 loc) · 977 Bytes
/
collections.go
File metadata and controls
31 lines (26 loc) · 977 Bytes
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
package rag
import (
"context"
"iter"
"slices"
)
// ListCollections returns all collection names from the given vector store.
func ListCollections(ctx context.Context, store VectorStore) ([]string, error) {
return store.ListCollections(ctx)
}
// ListCollectionsSeq returns an iterator that yields all collection names from the given vector store.
func ListCollectionsSeq(ctx context.Context, store VectorStore) (iter.Seq[string], error) {
names, err := store.ListCollections(ctx)
if err != nil {
return nil, err
}
return slices.Values(names), nil
}
// DeleteCollection removes a collection from the given vector store.
func DeleteCollection(ctx context.Context, store VectorStore, name string) error {
return store.DeleteCollection(ctx, name)
}
// CollectionStats returns backend-agnostic metadata about a collection.
func CollectionStats(ctx context.Context, store VectorStore, name string) (*CollectionInfo, error) {
return store.CollectionInfo(ctx, name)
}