embed

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const TypeDocument = "document"
View Source
const TypeNone = ""
View Source
const TypeQuery = "query"

Variables

This section is empty.

Functions

This section is empty.

Types

type Embeder

type Embeder interface {
	Provider() string
	Embed(embed Request) (*Response, error)
}

type Model

type Model struct {
	Provider string `json:"provider"`
	Name     string `json:"name"`

	Type Type `json:"type,omitempty"`

	Description string `json:"description,omitempty"`

	InputMaxTokens   int `json:"input_max_tokens,omitempty"`
	OutputDimensions int `json:"output_dimensions,omitempty"`
}

func ToModel added in v0.11.1

func ToModel(fqn string) (Model, error)

func (Model) FQN

func (m Model) FQN() string

func (Model) String

func (m Model) String() string

func (Model) WithType added in v0.11.0

func (m Model) WithType(mode Type) Model

type Request

type Request struct {
	Ctx context.Context `json:"-"`

	Model Model `json:"model"`

	Text string `json:"text"`
}

type Response

type Response struct {
	Embedding []float64       `json:"embedding"`
	Metadata  models.Metadata `json:"metadata,omitempty"`
}

func (*Response) AsFloat32 added in v0.9.1

func (r *Response) AsFloat32() []float32

func (*Response) AsFloat64 added in v0.9.1

func (r *Response) AsFloat64() []float64

type Type added in v0.11.0

type Type string

Jump to

Keyboard shortcuts

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