Documentation
¶
Index ¶
- type BaseIndex
- type CosineDistance
- type Euclidean
- type HNSWOptions
- type IVFFlatOptions
- type Index
- type InnerProduct
- type SearchDocument
- type VectorStore
- func (vs *VectorStore) AddDocuments(ctx context.Context, docs []schema.Document, _ ...vectorstores.Option) ([]string, error)
- func (vs *VectorStore) ApplyVectorIndex(ctx context.Context, index BaseIndex, name string, concurrently bool) error
- func (vs *VectorStore) DropVectorIndex(ctx context.Context, indexName string) error
- func (vs *VectorStore) IsValidIndex(ctx context.Context, indexName string) (bool, error)
- func (*VectorStore) NewBaseIndex(indexName, indexType string, strategy distanceStrategy, ...) BaseIndex
- func (vs *VectorStore) ReIndex(ctx context.Context) error
- func (vs *VectorStore) ReIndexWithName(ctx context.Context, indexName string) error
- func (vs *VectorStore) SimilaritySearch(ctx context.Context, query string, _ int, options ...vectorstores.Option) ([]schema.Document, error)
- type VectorStoreOption
- func WithContentColumn(contentColumn string) VectorStoreOption
- func WithDistanceStrategy(distanceStrategy distanceStrategy) VectorStoreOption
- func WithEmbeddingColumn(embeddingColumn string) VectorStoreOption
- func WithIDColumn(idColumn string) VectorStoreOption
- func WithK(k int) VectorStoreOption
- func WithMetadataColumns(metadataColumns []string) VectorStoreOption
- func WithMetadataJSONColumn(metadataJSONColumn string) VectorStoreOption
- func WithSchemaName(schemaName string) VectorStoreOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CosineDistance ¶
type CosineDistance struct{}
func (CosineDistance) String ¶
func (CosineDistance) String() string
type HNSWOptions ¶
HNSWOptions holds the configuration for the hnsw index.
func (HNSWOptions) Options ¶
func (h HNSWOptions) Options() string
type IVFFlatOptions ¶
type IVFFlatOptions struct {
Lists int
}
IVFFlatOptions holds the configuration for the ivfflat index.
func (IVFFlatOptions) Options ¶
func (i IVFFlatOptions) Options() string
type InnerProduct ¶
type InnerProduct struct{}
func (InnerProduct) String ¶
func (InnerProduct) String() string
type SearchDocument ¶
type VectorStore ¶
type VectorStore struct {
// contains filtered or unexported fields
}
func NewVectorStore ¶
func NewVectorStore(engine cloudsqlutil.PostgresEngine, embedder embeddings.Embedder, tableName string, opts ...VectorStoreOption, ) (VectorStore, error)
NewVectorStore creates a new VectorStore with options.
func (*VectorStore) AddDocuments ¶
func (vs *VectorStore) AddDocuments(ctx context.Context, docs []schema.Document, _ ...vectorstores.Option) ([]string, error)
AddDocuments adds documents to the Postgres collection, and returns the ids of the added documents.
func (*VectorStore) ApplyVectorIndex ¶
func (vs *VectorStore) ApplyVectorIndex(ctx context.Context, index BaseIndex, name string, concurrently bool) error
ApplyVectorIndex creates an index in the table of the embeddings.
func (*VectorStore) DropVectorIndex ¶
func (vs *VectorStore) DropVectorIndex(ctx context.Context, indexName string) error
DropVectorIndex drops the vector index from the VectorStore.
func (*VectorStore) IsValidIndex ¶
IsValidIndex checks if index exists in the VectorStore.
func (*VectorStore) NewBaseIndex ¶
func (*VectorStore) NewBaseIndex(indexName, indexType string, strategy distanceStrategy, partialIndexes []string, opts Index) BaseIndex
func (*VectorStore) ReIndex ¶
func (vs *VectorStore) ReIndex(ctx context.Context) error
ReIndex recreates the index on the VectorStore.
func (*VectorStore) ReIndexWithName ¶
func (vs *VectorStore) ReIndexWithName(ctx context.Context, indexName string) error
ReIndex recreates the index on the VectorStore by name.
func (*VectorStore) SimilaritySearch ¶
func (vs *VectorStore) SimilaritySearch(ctx context.Context, query string, _ int, options ...vectorstores.Option) ([]schema.Document, error)
SimilaritySearch performs a similarity search on the database using the query vector.
type VectorStoreOption ¶
type VectorStoreOption func(vs *VectorStore)
VectorStoreOption is a function for creating new vector store with other than the default values.
func WithContentColumn ¶
func WithContentColumn(contentColumn string) VectorStoreOption
WithContentColumn sets the VectorStore's ContentColumn field.
func WithDistanceStrategy ¶
func WithDistanceStrategy(distanceStrategy distanceStrategy) VectorStoreOption
WithDistanceStrategy sets the distance strategy used by the VectorStore.
func WithEmbeddingColumn ¶
func WithEmbeddingColumn(embeddingColumn string) VectorStoreOption
WithEmbeddingColumn sets the EmbeddingColumn field.
func WithIDColumn ¶
func WithIDColumn(idColumn string) VectorStoreOption
WithContentColumn sets VectorStore's the idColumn field.
func WithK ¶
func WithK(k int) VectorStoreOption
WithK sets the number of Documents to return from the VectorStore.
func WithMetadataColumns ¶
func WithMetadataColumns(metadataColumns []string) VectorStoreOption
WithMetadataColumns sets the VectorStore's MetadataColumns field.
func WithMetadataJSONColumn ¶
func WithMetadataJSONColumn(metadataJSONColumn string) VectorStoreOption
WithMetadataJSONColumn sets VectorStore's the metadataJSONColumn field.
func WithSchemaName ¶
func WithSchemaName(schemaName string) VectorStoreOption
WithSchemaName sets the VectorStore's schemaName field.