Skip to content

Embeddings

Create embeddings
client.Embeddings.New(ctx, body) (*CreateEmbeddingResponse, error)
POST/embeddings
ModelsExpand Collapse
type CreateEmbeddingResponse struct{…}
Data []Embedding

The list of embeddings generated by the model.

Embedding []float64

The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the embedding guide.

Index int64

The index of the embedding in the list of embeddings.

Object Embedding

The object type, which is always "embedding".

Model string

The name of the model used to generate the embedding.

Object List

The object type, which is always "list".

Usage CreateEmbeddingResponseUsage

The usage information for the request.

PromptTokens int64

The number of tokens used by the prompt.

TotalTokens int64

The total number of tokens used by the request.

type Embedding struct{…}

Represents an embedding vector returned by embedding endpoint.

Embedding []float64

The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the embedding guide.

Index int64

The index of the embedding in the list of embeddings.

Object Embedding

The object type, which is always "embedding".

type EmbeddingModel string
Accepts one of the following:
const EmbeddingModelTextEmbeddingAda002 EmbeddingModel = "text-embedding-ada-002"
const EmbeddingModelTextEmbedding3Small EmbeddingModel = "text-embedding-3-small"
const EmbeddingModelTextEmbedding3Large EmbeddingModel = "text-embedding-3-large"