embedding

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package embedding contains the implementation to create vector embeddings from text using different APIs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureOpenAIOptions added in v0.0.26

type AzureOpenAIOptions struct {
	OpenAIOptions
	APIVersion string
	Deployment string
}

type Fake

type Fake struct {
	Size int
}

func NewFake

func NewFake(size int) *Fake

func (*Fake) EmbedDocuments

func (e *Fake) EmbedDocuments(ctx context.Context, texts []string) ([][]float64, error)

func (*Fake) EmbedQuery

func (e *Fake) EmbedQuery(ctx context.Context, text string) ([]float64, error)

type OpenAI added in v0.0.6

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

func NewAzureOpenAI added in v0.0.26

func NewAzureOpenAI(apiKey, baseURL string, optFns ...func(o *AzureOpenAIOptions)) (*OpenAI, error)

func NewOpenAI added in v0.0.6

func NewOpenAI(apiKey string, optFns ...func(o *OpenAIOptions)) (*OpenAI, error)

func (*OpenAI) EmbedDocuments added in v0.0.6

func (e *OpenAI) EmbedDocuments(ctx context.Context, texts []string) ([][]float64, error)

func (*OpenAI) EmbedQuery added in v0.0.6

func (e *OpenAI) EmbedQuery(ctx context.Context, text string) ([]float64, error)

type OpenAIOptions added in v0.0.6

type OpenAIOptions struct {
	// Model name to use.
	ModelName              string
	EmbeddingContextLength int
	// Maximum number of texts to embed in each batch
	ChunkSize int
}

Jump to

Keyboard shortcuts

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