openaichat

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatOpenAI

type ChatOpenAI struct {
	StripNewLines bool
	BatchSize     int
	// contains filtered or unexported fields
}

ChatOpenAI is the embedder using the OpenAI api.

func NewChatOpenAI

func NewChatOpenAI(opts ...ChatOption) (ChatOpenAI, error)

NewChatOpenAI creates a new ChatOpenAI with options. Options for client, strip new lines and batch.

func (ChatOpenAI) EmbedDocuments

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

func (ChatOpenAI) EmbedQuery

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

type ChatOption

type ChatOption func(p *ChatOpenAI)

func WithBatchSize

func WithBatchSize(batchSize int) ChatOption

WithBatchSize is an option for specifying the batch size.

func WithClient

func WithClient(client openai.Chat) ChatOption

WithClient is an option for providing the LLM client.

func WithStripNewLines

func WithStripNewLines(stripNewLines bool) ChatOption

WithStripNewLines is an option for specifying the should it strip new lines.

Jump to

Keyboard shortcuts

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