Documentation ¶
Index ¶
- Constants
- func CompareEmbeddings(embeddings []*Embedding, other []*Embedding) bool
- func EmbedRecordsDefaultImpl(e EmbeddingFunction, ctx context.Context, records []*Record, force bool) error
- func ToAPIEmbeddings(embeddings []*Embedding) []openapi.EmbeddingsInner
- type BasicAuthCredentialsProvider
- type CollectionQueryBuilder
- type CollectionQueryOption
- func WithIds(ids []string) CollectionQueryOption
- func WithInclude(include ...QueryEnum) CollectionQueryOption
- func WithLimit(limit int32) CollectionQueryOption
- func WithNResults(nResults int32) CollectionQueryOption
- func WithOffset(offset int32) CollectionQueryOption
- func WithQueryEmbedding(queryEmbedding *Embedding) CollectionQueryOption
- func WithQueryEmbeddings(queryEmbeddings []*Embedding) CollectionQueryOption
- func WithQueryText(queryText string) CollectionQueryOption
- func WithQueryTexts(queryTexts []string) CollectionQueryOption
- func WithWhere(operation where.WhereOperation) CollectionQueryOption
- func WithWhereDocument(operation wheredoc.WhereDocumentOperation) CollectionQueryOption
- func WithWhereDocumentMap(where map[string]interface{}) CollectionQueryOption
- func WithWhereMap(where map[string]interface{}) CollectionQueryOption
- type ConsistentHashEmbeddingFunction
- func (e *ConsistentHashEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]*Embedding, error)
- func (e *ConsistentHashEmbeddingFunction) EmbedQuery(_ context.Context, document string) (*Embedding, error)
- func (e *ConsistentHashEmbeddingFunction) EmbedRecords(ctx context.Context, records []*Record, force bool) error
- type CredentialsProvider
- type DistanceFunction
- type Embedding
- func NewEmbedding(embeddings []interface{}) (*Embedding, error)
- func NewEmbeddingFromAPI(apiEmbedding openapi.EmbeddingsInner) *Embedding
- func NewEmbeddingFromFloat32(embedding []float32) *Embedding
- func NewEmbeddingFromInt32(embedding []int32) *Embedding
- func NewEmbeddings(embeddings []interface{}) ([]*Embedding, error)
- func NewEmbeddingsFromFloat32(embeddings [][]float32) []*Embedding
- func NewEmbeddingsFromInt32(embeddings [][]int32) []*Embedding
- type EmbeddingFunction
- type EmbeddingModel
- type IDGenerator
- type InvalidEmbeddingValueError
- type InvalidMetadataValueError
- type Option
- type QueryEnum
- type Record
- type RecordSet
- func (rs *RecordSet) BuildAndValidate(ctx context.Context) ([]*Record, error)
- func (rs *RecordSet) GetDocuments() []string
- func (rs *RecordSet) GetEmbeddings() []*Embedding
- func (rs *RecordSet) GetIDs() []string
- func (rs *RecordSet) GetMetadatas() []map[string]interface{}
- func (rs *RecordSet) GetURIs() []string
- func (rs *RecordSet) Validate() error
- func (rs *RecordSet) WithRecord(recordOpts ...Option) *RecordSet
- func (rs *RecordSet) WithRecords(records []*Record) *RecordSet
- type RecordSetOption
- type RerankingModel
- type SHA256Generator
- type TokenAuthCredentialsProvider
- type TokenTransportHeader
- type ULIDGenerator
- type UUIDGenerator
Constants ¶
View Source
const ( L2 DistanceFunction = "l2" COSINE DistanceFunction = "cosine" IP DistanceFunction = "ip" DefaultTenant = "default_tenant" DefaultDatabase = "default_database" IDocuments QueryEnum = "documents" IEmbeddings QueryEnum = "embeddings" IMetadatas QueryEnum = "metadatas" IDistances QueryEnum = "distances" HNSWSpace = "hnsw:space" HNSWConstructionEF = "hnsw:construction_ef" HNSWBatchSize = "hnsw:batch_size" HNSWSyncThreshold = "hnsw:sync_threshold" HNSWM = "hnsw:M" HNSWSearchEF = "hnsw:search_ef" HNSWNumThreads = "hnsw:num_threads" HNSWResizeFactor = "hnsw:resize_factor" DefaultTimeout = 30 * time.Second EmbeddingsEpsilon = 1e-6 )
Variables ¶
This section is empty.
Functions ¶
func CompareEmbeddings ¶
func EmbedRecordsDefaultImpl ¶
func ToAPIEmbeddings ¶
func ToAPIEmbeddings(embeddings []*Embedding) []openapi.EmbeddingsInner
Types ¶
type BasicAuthCredentialsProvider ¶
func NewBasicAuthCredentialsProvider ¶
func NewBasicAuthCredentialsProvider(username, password string) *BasicAuthCredentialsProvider
func (*BasicAuthCredentialsProvider) Authenticate ¶
func (b *BasicAuthCredentialsProvider) Authenticate(config *openapi.Configuration) error
type CollectionQueryBuilder ¶
type CollectionQueryOption ¶
type CollectionQueryOption func(*CollectionQueryBuilder) error
func WithIds ¶
func WithIds(ids []string) CollectionQueryOption
func WithInclude ¶
func WithInclude(include ...QueryEnum) CollectionQueryOption
func WithLimit ¶
func WithLimit(limit int32) CollectionQueryOption
func WithNResults ¶
func WithNResults(nResults int32) CollectionQueryOption
func WithOffset ¶
func WithOffset(offset int32) CollectionQueryOption
func WithQueryEmbedding ¶
func WithQueryEmbedding(queryEmbedding *Embedding) CollectionQueryOption
func WithQueryEmbeddings ¶
func WithQueryEmbeddings(queryEmbeddings []*Embedding) CollectionQueryOption
func WithQueryText ¶
func WithQueryText(queryText string) CollectionQueryOption
func WithQueryTexts ¶
func WithQueryTexts(queryTexts []string) CollectionQueryOption
func WithWhere ¶
func WithWhere(operation where.WhereOperation) CollectionQueryOption
func WithWhereDocument ¶
func WithWhereDocument(operation wheredoc.WhereDocumentOperation) CollectionQueryOption
func WithWhereDocumentMap ¶
func WithWhereDocumentMap(where map[string]interface{}) CollectionQueryOption
func WithWhereMap ¶
func WithWhereMap(where map[string]interface{}) CollectionQueryOption
type ConsistentHashEmbeddingFunction ¶
type ConsistentHashEmbeddingFunction struct {
// contains filtered or unexported fields
}
func (*ConsistentHashEmbeddingFunction) EmbedDocuments ¶
func (*ConsistentHashEmbeddingFunction) EmbedQuery ¶
func (*ConsistentHashEmbeddingFunction) EmbedRecords ¶
type CredentialsProvider ¶
type CredentialsProvider interface {
Authenticate(apiClient *openapi.Configuration) error
}
type DistanceFunction ¶
type DistanceFunction string
func ToDistanceFunction ¶
func ToDistanceFunction(str any) (DistanceFunction, error)
type Embedding ¶
func NewEmbedding ¶
func NewEmbeddingFromAPI ¶
func NewEmbeddingFromAPI(apiEmbedding openapi.EmbeddingsInner) *Embedding
func NewEmbeddingFromFloat32 ¶
func NewEmbeddingFromInt32 ¶
func NewEmbeddings ¶
func NewEmbeddingsFromInt32 ¶
func (*Embedding) GetFloat32 ¶
func (*Embedding) ToAPI ¶
func (e *Embedding) ToAPI() openapi.EmbeddingsInner
type EmbeddingFunction ¶
type EmbeddingFunction interface { // EmbedDocuments returns a vector for each text. EmbedDocuments(ctx context.Context, texts []string) ([]*Embedding, error) // EmbedQuery embeds a single text. EmbedQuery(ctx context.Context, text string) (*Embedding, error) EmbedRecords(ctx context.Context, records []*Record, force bool) error }
func NewConsistentHashEmbeddingFunction ¶
func NewConsistentHashEmbeddingFunction() EmbeddingFunction
type EmbeddingModel ¶
type EmbeddingModel string
type IDGenerator ¶
type InvalidEmbeddingValueError ¶
type InvalidEmbeddingValueError struct {
Value interface{}
}
func (*InvalidEmbeddingValueError) Error ¶
func (e *InvalidEmbeddingValueError) Error() string
type InvalidMetadataValueError ¶
type InvalidMetadataValueError struct { Key string Value interface{} }
func (*InvalidMetadataValueError) Error ¶
func (e *InvalidMetadataValueError) Error() string
type Record ¶
type RecordSet ¶
type RecordSet struct { Records []*Record IDGenerator IDGenerator EmbeddingFunction EmbeddingFunction }
func NewRecordSet ¶
func NewRecordSet(opts ...RecordSetOption) (*RecordSet, error)
func (*RecordSet) BuildAndValidate ¶
func (*RecordSet) GetDocuments ¶
func (*RecordSet) GetEmbeddings ¶
func (*RecordSet) GetMetadatas ¶
func (*RecordSet) WithRecord ¶
func (*RecordSet) WithRecords ¶
type RecordSetOption ¶
func WithEmbeddingFunction ¶
func WithEmbeddingFunction(embeddingFunction EmbeddingFunction) RecordSetOption
WithEmbeddingFunction sets the embedding function to be used for in place embedding.
func WithIDGenerator ¶
func WithIDGenerator(idGenerator IDGenerator) RecordSetOption
type RerankingModel ¶
type RerankingModel string
type SHA256Generator ¶
type SHA256Generator struct{}
func NewSHA256Generator ¶
func NewSHA256Generator() *SHA256Generator
func (*SHA256Generator) Generate ¶
func (s *SHA256Generator) Generate(document string) string
type TokenAuthCredentialsProvider ¶
type TokenAuthCredentialsProvider struct { Token string Header TokenTransportHeader }
func NewTokenAuthCredentialsProvider ¶
func NewTokenAuthCredentialsProvider(token string, header TokenTransportHeader) *TokenAuthCredentialsProvider
func (*TokenAuthCredentialsProvider) Authenticate ¶
func (t *TokenAuthCredentialsProvider) Authenticate(config *openapi.Configuration) error
type TokenTransportHeader ¶
type TokenTransportHeader string
const ( AuthorizationTokenHeader TokenTransportHeader = "Authorization" XChromaTokenHeader TokenTransportHeader = "X-Chroma-Token" )
type ULIDGenerator ¶
type ULIDGenerator struct{}
func NewULIDGenerator ¶
func NewULIDGenerator() *ULIDGenerator
func (*ULIDGenerator) Generate ¶
func (u *ULIDGenerator) Generate(_ string) string
type UUIDGenerator ¶
type UUIDGenerator struct{}
func NewUUIDGenerator ¶
func NewUUIDGenerator() *UUIDGenerator
func (*UUIDGenerator) Generate ¶
func (u *UUIDGenerator) Generate(_ string) string
Click to show internal directories.
Click to hide internal directories.