Help us shape the future of Go! Take the 2026 Go Developer Survey

embedding

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FastEmbed

type FastEmbed struct {
	Connector  connector.Connector
	Concurrent int
	Dimension  int
	Model      string
	Host       string
	Key        string
}

FastEmbed embedding function

func NewFastEmbed

func NewFastEmbed(options FastEmbedOptions) (*FastEmbed, error)

NewFastEmbed create a new FastEmbed embedding function with options

func NewFastEmbedWithDefaults

func NewFastEmbedWithDefaults(connectorName string) (*FastEmbed, error)

NewFastEmbedWithDefaults create a new FastEmbed embedding function with default settings

func (*FastEmbed) EmbedDocuments

func (e *FastEmbed) EmbedDocuments(ctx context.Context, texts []string, callback ...types.EmbeddingProgress) (*types.EmbeddingResults, error)

EmbedDocuments embed documents with optional progress callback

func (*FastEmbed) EmbedQuery

func (e *FastEmbed) EmbedQuery(ctx context.Context, text string, callback ...types.EmbeddingProgress) (*types.EmbeddingResult, error)

EmbedQuery embed query using FastEmbed API with optional progress callback

func (*FastEmbed) GetDimension

func (e *FastEmbed) GetDimension() int

GetDimension returns the embedding dimension

func (*FastEmbed) GetHost

func (e *FastEmbed) GetHost() string

GetHost returns the FastEmbed service host

func (*FastEmbed) GetModel

func (e *FastEmbed) GetModel() string

GetModel returns the current model being used

func (*FastEmbed) HasKey

func (e *FastEmbed) HasKey() bool

HasKey returns whether key authentication is configured

type FastEmbedOptions

type FastEmbedOptions struct {
	ConnectorName string // Connector name
	Concurrent    int    // Maximum concurrent requests
	Dimension     int    // Embedding dimension
	Model         string // Model name (optional, can be overridden by connector)
	Host          string // FastEmbed service host (optional, can be overridden by connector)
	Key           string // FastEmbed service key (optional, can be overridden by connector)
}

FastEmbedOptions defines the options for FastEmbed embedding

type Openai

type Openai struct {
	Connector  connector.Connector
	Concurrent int
	Dimension  int
	Model      string
}

Openai embedding function

func NewOpenai

func NewOpenai(options OpenaiOptions) (*Openai, error)

NewOpenai create a new Openai embedding function with options

func NewOpenaiWithDefaults

func NewOpenaiWithDefaults(connectorName string) (*Openai, error)

NewOpenaiWithDefaults create a new Openai embedding function with default settings

func (*Openai) EmbedDocuments

func (e *Openai) EmbedDocuments(ctx context.Context, texts []string, callback ...types.EmbeddingProgress) (*types.EmbeddingResults, error)

EmbedDocuments embed documents with optional progress callback

func (*Openai) EmbedQuery

func (e *Openai) EmbedQuery(ctx context.Context, text string, callback ...types.EmbeddingProgress) (*types.EmbeddingResult, error)

EmbedQuery embed query using direct POST request with optional progress callback

func (*Openai) GetDimension

func (e *Openai) GetDimension() int

GetDimension returns the embedding dimension

func (*Openai) GetModel

func (e *Openai) GetModel() string

GetModel returns the current model being used

type OpenaiOptions

type OpenaiOptions struct {
	ConnectorName string // Connector name
	Concurrent    int    // Maximum concurrent requests
	Dimension     int    // Embedding dimension
	Model         string // Model name (optional, can be overridden by connector)
}

OpenaiOptions defines the options for OpenAI embedding

Jump to

Keyboard shortcuts

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