defaultef

package
v0.0.0-...-243f1f3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LibTokenizersVersion  = "0.9.0"
	LibOnnxRuntimeVersion = "1.21.0"

	ChromaCacheDir = ".cache/chroma/"
)

Variables

This section is empty.

Functions

func EnsureDefaultEmbeddingFunctionModel

func EnsureDefaultEmbeddingFunctionModel() error

func EnsureLibTokenizersSharedLibrary

func EnsureLibTokenizersSharedLibrary() error

func EnsureOnnxRuntimeSharedLibrary

func EnsureOnnxRuntimeSharedLibrary() error

func ExpandDims

func ExpandDims(input []int64, shape []int64) ([][][]int64, error)

func ReshapeFlattenedTensor

func ReshapeFlattenedTensor[T Number](flatTensor []T, shape []int) (interface{}, error)

Types

type AtomicRefCounter

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

func (*AtomicRefCounter) Decrement

func (arc *AtomicRefCounter) Decrement()

func (*AtomicRefCounter) GetCount

func (arc *AtomicRefCounter) GetCount() int32

func (*AtomicRefCounter) Increment

func (arc *AtomicRefCounter) Increment()

type DefaultEmbeddingFunction

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

func NewDefaultEmbeddingFunction

func NewDefaultEmbeddingFunction(opts ...Option) (*DefaultEmbeddingFunction, func() error, error)

func (*DefaultEmbeddingFunction) Close

func (e *DefaultEmbeddingFunction) Close() error

func (*DefaultEmbeddingFunction) EmbedDocuments

func (e *DefaultEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]embeddings.Embedding, error)

func (*DefaultEmbeddingFunction) EmbedQuery

func (e *DefaultEmbeddingFunction) EmbedQuery(ctx context.Context, document string) (embeddings.Embedding, error)

type EmbeddingInput

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

func NewEmbeddingInput

func NewEmbeddingInput(inputIDs []int64, attnMask []int64, typeIDs []int64, numInputs, vlen int64) (*EmbeddingInput, error)

func (*EmbeddingInput) Close

func (ei *EmbeddingInput) Close() error

type Number

type Number interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64
}

Number is a constraint that permits any number type

type Option

type Option func(p *DefaultEmbeddingFunction) error

type Tensor2D

type Tensor2D[T Number] [][]T

func ConvertTensor2D

func ConvertTensor2D[S Number, D Number](src Tensor2D[S]) Tensor2D[D]

ConvertTensor2D converts a Tensor2D of one numeric type to another

type Tensor3D

type Tensor3D[T Number] [][][]T

Tensor3D is a generic 3D tensor

func BroadcastTo

func BroadcastTo[T Number](input Tensor3D[T], targetShape [3]int) Tensor3D[T]

BroadcastTo simulates np.broadcast_to for any 3D tensor

func ConvertTensor3D

func ConvertTensor3D[S Number, D Number](src Tensor3D[S]) Tensor3D[D]

ConvertTensor3D converts a Tensor3D of one numeric type to another

func (Tensor3D[T]) Sum

func (t Tensor3D[T]) Sum(axis int) ([][]T, error)

Sum calculates the sum along a specified axis

Jump to

Keyboard shortcuts

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