Documentation
¶
Index ¶
- type ConsistentHashEmbeddingFunction
- type Distance
- type DistanceMetric
- type DistanceMetricOperator
- type Distances
- type Embedding
- func NewEmbeddingFromFloat32(embedding []float32) Embedding
- func NewEmbeddingFromFloat64(embedding []float64) Embedding
- func NewEmbeddingFromInt32(embedding []int32) Embedding
- func NewEmbeddingsFromFloat32(lst [][]float32) ([]Embedding, error)
- func NewEmbeddingsFromInt32(lst [][]int32) ([]Embedding, error)
- func NewEmbeddingsFromInterface(lst []interface{}) ([]Embedding, error)
- func NewEmptyEmbedding() Embedding
- func NewEmptyEmbeddings() []Embedding
- func NewInt32Embedding(embedding []int32) Embedding
- type EmbeddingFunction
- type EmbeddingModel
- type Embeddings
- type Float32Embedding
- func (e *Float32Embedding) Compare(other Embedding, metric DistanceMetricOperator) float32
- func (e *Float32Embedding) ContentAsFloat32() []float32
- func (e *Float32Embedding) ContentAsInt32() []int32
- func (e *Float32Embedding) FromFloat32(content ...float32) error
- func (e *Float32Embedding) IsDefined() bool
- func (e *Float32Embedding) Len() int
- func (e *Float32Embedding) MarshalJSON() ([]byte, error)
- func (e *Float32Embedding) UnmarshalJSON(b []byte) error
- type Int32Embedding
- func (e *Int32Embedding) Compare(other Embedding, metric DistanceMetricOperator) float32
- func (e *Int32Embedding) ContentAsFloat32() []float32
- func (e *Int32Embedding) ContentAsInt32() []int32
- func (e *Int32Embedding) FromFloat32(_ ...float32) error
- func (e *Int32Embedding) FromInt32(content ...int32) error
- func (e *Int32Embedding) IsDefined() bool
- func (e *Int32Embedding) Len() int
- func (e *Int32Embedding) MarshalJSON() ([]byte, error)
- func (e *Int32Embedding) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsistentHashEmbeddingFunction ¶
type ConsistentHashEmbeddingFunction struct {
// contains filtered or unexported fields
}
func (*ConsistentHashEmbeddingFunction) EmbedDocuments ¶
func (*ConsistentHashEmbeddingFunction) EmbedQuery ¶
type DistanceMetric ¶
type DistanceMetric string
const ( L2 DistanceMetric = "l2" COSINE DistanceMetric = "cosine" IP DistanceMetric = "ip" )
type DistanceMetricOperator ¶
type Embedding ¶
type Embedding interface {
Len() int
ContentAsFloat32() []float32
ContentAsInt32() []int32
FromFloat32(content ...float32) error
Compare(other Embedding, metric DistanceMetricOperator) float32
IsDefined() bool
}
func NewEmbeddingFromFloat32 ¶
func NewEmbeddingFromFloat64 ¶
func NewEmbeddingFromInt32 ¶
func NewEmbeddingsFromInt32 ¶
func NewEmptyEmbedding ¶
func NewEmptyEmbedding() Embedding
func NewEmptyEmbeddings ¶
func NewEmptyEmbeddings() []Embedding
func NewInt32Embedding ¶
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)
}
func NewConsistentHashEmbeddingFunction ¶
func NewConsistentHashEmbeddingFunction() EmbeddingFunction
type EmbeddingModel ¶
type EmbeddingModel string
type Embeddings ¶
type Embeddings []Embedding
type Float32Embedding ¶
type Float32Embedding struct {
ArrayOfFloat32 *[]float32
}
func (*Float32Embedding) Compare ¶
func (e *Float32Embedding) Compare(other Embedding, metric DistanceMetricOperator) float32
func (*Float32Embedding) ContentAsFloat32 ¶
func (e *Float32Embedding) ContentAsFloat32() []float32
func (*Float32Embedding) ContentAsInt32 ¶
func (e *Float32Embedding) ContentAsInt32() []int32
func (*Float32Embedding) FromFloat32 ¶
func (e *Float32Embedding) FromFloat32(content ...float32) error
func (*Float32Embedding) IsDefined ¶
func (e *Float32Embedding) IsDefined() bool
func (*Float32Embedding) Len ¶
func (e *Float32Embedding) Len() int
func (*Float32Embedding) MarshalJSON ¶
func (e *Float32Embedding) MarshalJSON() ([]byte, error)
func (*Float32Embedding) UnmarshalJSON ¶
func (e *Float32Embedding) UnmarshalJSON(b []byte) error
type Int32Embedding ¶
type Int32Embedding struct {
ArrayOfInt32 *[]int32
}
func (*Int32Embedding) Compare ¶
func (e *Int32Embedding) Compare(other Embedding, metric DistanceMetricOperator) float32
func (*Int32Embedding) ContentAsFloat32 ¶
func (e *Int32Embedding) ContentAsFloat32() []float32
func (*Int32Embedding) ContentAsInt32 ¶
func (e *Int32Embedding) ContentAsInt32() []int32
func (*Int32Embedding) FromFloat32 ¶
func (e *Int32Embedding) FromFloat32(_ ...float32) error
func (*Int32Embedding) FromInt32 ¶
func (e *Int32Embedding) FromInt32(content ...int32) error
func (*Int32Embedding) IsDefined ¶
func (e *Int32Embedding) IsDefined() bool
func (*Int32Embedding) Len ¶
func (e *Int32Embedding) Len() int
func (*Int32Embedding) MarshalJSON ¶
func (e *Int32Embedding) MarshalJSON() ([]byte, error)
func (*Int32Embedding) UnmarshalJSON ¶
func (e *Int32Embedding) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.