Documentation
¶
Index ¶
- Variables
- type DistanceFn
- type Options
- type Store
- func (c *Store) AddDocuments(_ context.Context, documents []schema.Document, option ...vectorstores.Option) error
- func (c *Store) ClearCollection() error
- func (c *Store) CollectionName() string
- func (c *Store) CollectionSize() (int, error)
- func (c *Store) GetAllDocuments() ([]schema.Document, error)
- func (c *Store) ResetDB() error
- func (c *Store) SimilaritySearch(_ context.Context, query string, numDocuments int, ...) ([]schema.Document, error)
Constants ¶
This section is empty.
Variables ¶
var (
DistanceFnL2 = "l2"
)
Functions ¶
This section is empty.
Types ¶
type DistanceFn ¶
type DistanceFn = string
type Options ¶
type Options func(o *chromaOptions)
func WithCollection ¶
WithCollection Sets the collection name to target with this instance of the client. [Required] Can also optionally supply a metadata map to attach to the collection. To work with multiple collections, create a client per collection
func WithDistanceFn ¶
func WithDistanceFn(fn DistanceFn) Options
WithDistanceFn Sets the distance function. Defaults to "l2"/ See Chroma docs for other supported distance functions
func WithEmbedder ¶
func WithEmbedder(e embeddings.Embedder) Options
WithEmbedder Sets the embedder. [Required]
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AddDocuments ¶
func (c *Store) AddDocuments(_ context.Context, documents []schema.Document, option ...vectorstores.Option) error
AddDocuments to the Chroma collection
func (*Store) ClearCollection ¶
ClearCollection Drops and recreates the collection. All documents will be lost The original DistanceFn and Metadata are maintained
func (*Store) CollectionName ¶
CollectionName Returns the collection name associated with this instance of the Chroma client
func (*Store) CollectionSize ¶
func (*Store) GetAllDocuments ¶
GetAllDocuments returns *all* the documents in the collection. Useful for debugging, but be careful while using in production.
func (*Store) ResetDB ¶
ResetDB Resets the Chroma DB. See: https://docs.trychroma.com/reference/Client#reset
func (*Store) SimilaritySearch ¶
func (c *Store) SimilaritySearch(_ context.Context, query string, numDocuments int, options ...vectorstores.Option) ([]schema.Document, error)
SimilaritySearch Performs a similarity search on the given query within the collection targeted by this client. Note: If a distance Threshold is set, the number of documents returned can be *lower* than the requested numDocuments