embeddings

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmbeddingData

type EmbeddingData struct {
	// The index of the embedding in the list of embeddings.
	Index int `json:"index"`

	// The object type, which is always "embedding".
	Object string `json:"object,omitempty"`

	// The embedding vector, which is a list of floats.
	Embedding []float64 `json:"embedding"`
}

type TextEmbeddingsRequest

type TextEmbeddingsRequest struct {
	// Input Input text to embed (required)
	Input []string `json:"input,omitempty"`

	// Model ID of the model to use (required)
	Model string `json:"model,omitempty"`

	// Dimensions (optional) The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
	Dimensions int `json:"dimensions,omitempty"`

	// EncodingFormat (optional) "float" or "base64"
	EncodingFormat string `json:"encoding_format,omitempty"`

	// User (optional) A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	User string `json:"user,omitempty"`
}

func (*TextEmbeddingsRequest) InputRuneCount

func (te *TextEmbeddingsRequest) InputRuneCount() int

func (*TextEmbeddingsRequest) String

func (te *TextEmbeddingsRequest) String() string

type TextEmbeddingsResponse

type TextEmbeddingsResponse struct {
	Data   []EmbeddingData `json:"data"`
	Model  string          `json:"model"`
	Object string          `json:"object"`
	Usage  Usage           `json:"usage"`
}

func (*TextEmbeddingsResponse) Embedding

func (te *TextEmbeddingsResponse) Embedding() []float64

func (*TextEmbeddingsResponse) String

func (te *TextEmbeddingsResponse) String() string

type Usage

type Usage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

func (*Usage) Add

func (u *Usage) Add(a *Usage)

func (*Usage) String

func (u *Usage) String() string

Jump to

Keyboard shortcuts

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