onex

package
v0.2.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EmbeddingQualificationThreshold defines the minimum acceptable ratio of
	// successful embeddings to inputs.
	EmbeddingQualificationThreshold = 0.8
)

Variables

This section is empty.

Functions

func NewEmbedder

func NewEmbedder(typed Embedder, opts ...Option) *onexEmbedder

NewEmbedder creates a new instance of *onexEmbedder with specified options.

Types

type Embedder

type Embedder interface {
	Embedding(ctx context.Context, input any) string
}

Embedder interface defines a method for embedding input data.

type EmbeddingData

type EmbeddingData struct {
	Extra Extra     `json:"extra,omitempty"`
	Label string    `json:"label,omitempty"`
	Text  string    `json:"text,omitempty"`
	Emb   []float32 `json:"emb,omitempty"`
}

EmbeddingData represents the structure of data to be embedded.

type EmbeddingType

type EmbeddingType int

EmbeddingType represents the type of embedding being performed.

const (
	// TextEmbeddingType indicates an embedding type for text data.
	TextEmbeddingType EmbeddingType = iota
	// ImageEmbeddingType indicates an embedding type for image data.
	ImageEmbeddingType
)

type Extra

type Extra struct {
	ID string `json:"id,omitempty"`
}

type Option

type Option func(emb *onexEmbedder)

Option is a function type that modifies the onexEmbedder configuration.

func WithMaxConcurrency

func WithMaxConcurrency(concurrency int) Option

WithMaxConcurrency returns an Option that sets the maximum concurrency level for the embedder.

func WithRateLimiter

func WithRateLimiter(rl ratelimit.Limiter) Option

WithRateLimiter returns an Option that sets a custom rate limiter for the embedder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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