chroma

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package chroma provides a Chroma vector database driver implementation.

Index

Constants

View Source
const (
	// DefaultCollectionName is the default collection name for storing tapes embeddings.
	DefaultCollectionName = "tapes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// URL is the Chroma server URL (e.g., "http://localhost:8000").
	URL string

	// CollectionName is the name of the collection to use.
	// Defaults to DefaultCollectionName if empty.
	CollectionName string

	// MaxRetries overrides the maximum number of connection retries.
	// Defaults to maxConnectRetries if zero.
	MaxRetries uint

	// RetryDelay overrides the initial delay between retries.
	// Defaults to initialRetryDelay if zero.
	RetryDelay time.Duration

	// MaxRetryDelay overrides the maximum delay between retries.
	// Defaults to maxRetryDelay if zero.
	MaxRetryDelay time.Duration
}

Config holds configuration for the Chroma driver.

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver implements vector.Driver using Chroma's REST API.

func NewDriver

func NewDriver(c Config, log *slog.Logger) (*Driver, error)

NewDriver creates a new Chroma vector driver. It uses exponential delay retries if it cannot connect to Chroma.

func (*Driver) Add

func (d *Driver) Add(ctx context.Context, docs []vector.Document) error

Add stores documents with their embeddings.

func (*Driver) Close

func (d *Driver) Close() error

Close releases resources held by the driver.

func (*Driver) Delete

func (d *Driver) Delete(ctx context.Context, ids []string) error

Delete removes documents by their IDs.

func (*Driver) Get

func (d *Driver) Get(ctx context.Context, ids []string) ([]vector.Document, error)

Get retrieves documents by their IDs.

func (*Driver) Query

func (d *Driver) Query(ctx context.Context, embedding []float32, topK int) ([]vector.QueryResult, error)

Query finds the topK most similar documents to the given embedding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL