models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package models provides pre-configured providers for popular embedding models. It includes automatic model type detection and factory functions for easy model loading.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BGEProvider

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

BGEProvider creates a provider for BGE models

func NewBGEProvider

func NewBGEProvider(modelPath string) (*BGEProvider, error)

NewBGEProvider creates a new BGE provider

func (*BGEProvider) Dimension

func (p *BGEProvider) Dimension() int

Dimension returns the embedding dimension

func (*BGEProvider) Embed

func (p *BGEProvider) Embed(ctx context.Context, texts []string) ([][]float32, error)

Embed generates embeddings for the given texts

type CustomModel

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

CustomModel is a placeholder for model implementation

func NewCustomModel

func NewCustomModel(dimension int, modelPath string) (*CustomModel, error)

NewCustomModel creates a new custom model

func (*CustomModel) Close

func (m *CustomModel) Close() error

Close closes the model

func (*CustomModel) Run

func (m *CustomModel) Run(inputs map[string]interface{}) (map[string]interface{}, error)

Run runs inference on the given inputs

type GenericProvider

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

GenericProvider is a generic provider for any model type

func (*GenericProvider) Dimension

func (p *GenericProvider) Dimension() int

Dimension returns the embedding dimension

func (*GenericProvider) Embed

func (p *GenericProvider) Embed(ctx context.Context, texts []string) ([][]float32, error)

Embed generates embeddings for the given texts

type ModelInfo

type ModelInfo struct {
	Type      ModelType
	Name      string
	Dimension int
	ModelPath string
}

ModelInfo contains information about a model including its type, name, and dimensions.

func NewModelInfo

func NewModelInfo(modelPath string) (*ModelInfo, error)

NewModelInfo creates a new ModelInfo instance by analyzing the model file path.

type ModelType

type ModelType string

ModelType defines the type of embedding model.

const (
	// ModelTypeBERT represents BERT models
	ModelTypeBERT ModelType = "bert"
	// ModelTypeSentenceBERT represents Sentence-BERT models
	ModelTypeSentenceBERT ModelType = "sentence-bert"
	// ModelTypeBGE represents BGE models
	ModelTypeBGE ModelType = "bge"
	// ModelTypeGPT represents GPT models
	ModelTypeGPT ModelType = "gpt"
	// ModelTypeFastText represents FastText models
	ModelTypeFastText ModelType = "fasttext"
	// ModelTypeGloVe represents GloVe models
	ModelTypeGloVe ModelType = "glove"
)

type Provider

type Provider interface {
	embedding.Provider
}

Provider is a generic interface for all model providers

func NewProvider

func NewProvider(modelPath string) (Provider, error)

NewProvider creates a new provider based on the model path

type SentenceBERTProvider

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

SentenceBERTProvider creates a provider for Sentence-BERT models

func NewSentenceBERTProvider

func NewSentenceBERTProvider(modelPath string) (*SentenceBERTProvider, error)

NewSentenceBERTProvider creates a new Sentence-BERT provider

func (*SentenceBERTProvider) Dimension

func (p *SentenceBERTProvider) Dimension() int

Dimension returns the embedding dimension

func (*SentenceBERTProvider) Embed

func (p *SentenceBERTProvider) Embed(ctx context.Context, texts []string) ([][]float32, error)

Embed generates embeddings for the given texts

Jump to

Keyboard shortcuts

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