Documentation
¶
Index ¶
- type ChromaService
- func (s *ChromaService) AddDocuments(collectionName string, docs []string, ids []string) error
- func (s *ChromaService) Close()
- func (s *ChromaService) GetTenant() (bool, error)
- func (s *ChromaService) IngestRecords(collectionName, filePath string, cfg *ingest.Config) error
- func (s *ChromaService) ListCollections() ([]client.Collection, error)
- func (s *ChromaService) ListDatabases() ([]client.Database, error)
- func (s *ChromaService) QueryDocuments(collectionName string, queries []string, nResults int) (*client.QueryResponse, error)
- func (s *ChromaService) TestConnection() error
- func (s *ChromaService) UpsertDocuments(collectionName string, docs []string, ids []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChromaService ¶
type ChromaService struct {
// contains filtered or unexported fields
}
ChromaService handles business logic for ChromaDB operations.
func NewChromaService ¶
func NewChromaService(c client.ChromaClientInterface, e onnx.EmbedderInterface) *ChromaService
NewChromaService creates a new service with the given client and embedder. If the client is a concrete *client.ChromaClient, the embedder is injected into it.
func (*ChromaService) AddDocuments ¶
func (s *ChromaService) AddDocuments(collectionName string, docs []string, ids []string) error
AddDocuments adds documents to a collection with embeddings.
func (*ChromaService) Close ¶
func (s *ChromaService) Close()
Close releases resources used by the service.
func (*ChromaService) GetTenant ¶
func (s *ChromaService) GetTenant() (bool, error)
GetTenant checks if the tenant exists.
func (*ChromaService) IngestRecords ¶
func (s *ChromaService) IngestRecords(collectionName, filePath string, cfg *ingest.Config) error
IngestRecords ingests records from a JSONL file into the collection. It parses the file, extracts content and metadata, generates embeddings, and uploads in batches. collectionName can be a name or UUID. If cfg is nil, sensible defaults are used.
func (*ChromaService) ListCollections ¶
func (s *ChromaService) ListCollections() ([]client.Collection, error)
ListCollections lists all collections in the database.
func (*ChromaService) ListDatabases ¶
func (s *ChromaService) ListDatabases() ([]client.Database, error)
ListDatabases lists all databases for the tenant.
func (*ChromaService) QueryDocuments ¶
func (s *ChromaService) QueryDocuments(collectionName string, queries []string, nResults int) (*client.QueryResponse, error)
QueryDocuments queries documents in a collection.
func (*ChromaService) TestConnection ¶
func (s *ChromaService) TestConnection() error
TestConnection tests the connection to ChromaDB.
func (*ChromaService) UpsertDocuments ¶
func (s *ChromaService) UpsertDocuments(collectionName string, docs []string, ids []string) error
UpsertDocuments upserts documents to a collection with embeddings (insert or update).