Documentation ¶
Index ¶
- Constants
- Variables
- func Convert2Float32[T any](embedding []T) []float32
- func StartEmbeddedPostgres(cfg *config.Config) (*postgres.EmbeddedPostgres, error)
- func StartFerretDB(database *postgres.EmbeddedPostgres, cfg *config.Config) (*ferretdb.FerretDB, error)
- type CohereEmbedding
- type Collection
- type Data
- type HNSWIndex
- type Kaer
- type Meta
Constants ¶
View Source
const ( InternalDocName = "_m_doc" InternalIdName = "_m_id" InternalEmbeddingName = "_m_embedding" MetaPersistBatch = 1000 )
View Source
const CohereMaxTexts = 96
View Source
const CohereTextMaxLen = 512
View Source
const HnswGrowSize = 1000
Variables ¶
View Source
var ( ErrCollectionNotFound = errors.New("collection not found") ErrFieldLengthMismatch = errors.New("documents and metadatas are mismatch") ErrMetaCorrupted = errors.New("meta corrupted") )
View Source
var ErrTooManyTexts error = errors.New("too many texts")
Functions ¶
func Convert2Float32 ¶
func StartEmbeddedPostgres ¶
func StartEmbeddedPostgres(cfg *config.Config) (*postgres.EmbeddedPostgres, error)
func StartFerretDB ¶
Types ¶
type CohereEmbedding ¶
type CohereEmbedding struct {
// contains filtered or unexported fields
}
func NewCohereEmbedding ¶
func NewCohereEmbedding(cfg *config.CohereCfg) (*CohereEmbedding, error)
func (*CohereEmbedding) GetEmbedding ¶
func (c *CohereEmbedding) GetEmbedding(texts []string) ([][]float32, error)
type Collection ¶
type Collection struct { *mongo.Collection // contains filtered or unexported fields }
func NewCollection ¶
func NewCollection(ctx context.Context, meta *Meta, collection *mongo.Collection, name string, cfg *config.Config) (*Collection, error)
func (*Collection) Insert ¶
func (c *Collection) Insert(data *Data) error
type HNSWIndex ¶
func NewHNSWIndexFromFile ¶
type Kaer ¶
type Kaer struct {
// contains filtered or unexported fields
}
func (*Kaer) CreateCollection ¶
func (*Kaer) GetCollection ¶
Click to show internal directories.
Click to hide internal directories.