vectorizer

package
v1.24.18 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOpenAIDocumentType    = "text"
	DefaultOpenAIModel           = "ada"
	DefaultVectorizeClassName    = true
	DefaultPropertyIndexed       = true
	DefaultVectorizePropertyName = false
	DefaultBaseURL               = "https://api.openai.com"
	DefaultApiVersion            = "2024-02-01"
)
View Source
const (
	TextEmbedding3Small = "text-embedding-3-small"
	TextEmbedding3Large = "text-embedding-3-large"
)

Variables

View Source
var (
	TextEmbedding3SmallDefaultDimensions int64 = 1536
	TextEmbedding3LargeDefaultDimensions int64 = 3072
)

Functions

func NewClassSettings

func NewClassSettings(cfg moduletools.ClassConfig) *classSettings

func PickDefaultDimensions added in v1.23.6

func PickDefaultDimensions(model string) *int64

func PickDefaultModelVersion

func PickDefaultModelVersion(model, docType string) string

Types

type ClassSettings

type ClassSettings interface {
	PropertyIndexed(property string) bool
	VectorizePropertyName(propertyName string) bool
	VectorizeClassName() bool
	Model() string
	Type() string
	ModelVersion() string
	ResourceName() string
	DeploymentID() string
	BaseURL() string
	ApiVersion() string
	IsAzure() bool
}

IndexCheck returns whether a property of a class should be indexed

type Client

type Client interface {
	Vectorize(ctx context.Context, input string,
		config ent.VectorizationConfig) (*ent.VectorizationResult, error)
	VectorizeQuery(ctx context.Context, input []string,
		config ent.VectorizationConfig) (*ent.VectorizationResult, error)
}

type Vectorizer

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

func New

func New(client Client) *Vectorizer

func (*Vectorizer) Texts

func (v *Vectorizer) Texts(ctx context.Context, inputs []string,
	cfg moduletools.ClassConfig,
) ([]float32, error)

Jump to

Keyboard shortcuts

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