Skip to content

Embeddings

Create embeddings
CreateEmbeddingResponse embeddings().create(EmbeddingCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/embeddings
ModelsExpand Collapse
class CreateEmbeddingResponse:
List<Embedding> data

The list of embeddings generated by the model.

List<double> embedding

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

long index

The index of the embedding in the list of embeddings.

JsonValue; object_ "embedding"constant"embedding"constant

The object type, which is always "embedding".

String model

The name of the model used to generate the embedding.

JsonValue; object_ "list"constant"list"constant

The object type, which is always "list".

Usage usage

The usage information for the request.

long promptTokens

The number of tokens used by the prompt.

long totalTokens

The total number of tokens used by the request.

class Embedding:

Represents an embedding vector returned by embedding endpoint.

List<double> embedding

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

long index

The index of the embedding in the list of embeddings.

JsonValue; object_ "embedding"constant"embedding"constant

The object type, which is always "embedding".

enum EmbeddingModel:
TEXT_EMBEDDING_ADA_002("text-embedding-ada-002")
TEXT_EMBEDDING_3_SMALL("text-embedding-3-small")
TEXT_EMBEDDING_3_LARGE("text-embedding-3-large")