Skip to content

Embeddings

Create embeddings
embeddings.create(**kwargs) -> CreateEmbeddingResponse { data, model, object, usage }
POST/embeddings
ModelsExpand Collapse
class CreateEmbeddingResponse { data, model, object, usage }
data: Array[Embedding { embedding, index, object } ]

The list of embeddings generated by the model.

embedding: Array[Float]

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

index: Integer

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: { prompt_tokens, total_tokens}

The usage information for the request.

prompt_tokens: Integer

The number of tokens used by the prompt.

total_tokens: Integer

The total number of tokens used by the request.

class Embedding { embedding, index, object }

Represents an embedding vector returned by embedding endpoint.

embedding: Array[Float]

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

index: Integer

The index of the embedding in the list of embeddings.

object: :embedding

The object type, which is always "embedding".

EmbeddingModel = :"text-embedding-ada-002" | :"text-embedding-3-small" | :"text-embedding-3-large"
Accepts one of the following:
:"text-embedding-ada-002"
:"text-embedding-3-small"
:"text-embedding-3-large"