Embeddings
Last updated
Was this helpful?
Last updated
Was this helpful?
POST /embeddings
Generate embeddings using the selected Large Language Model (LLM).
The embeddings.create
method in the Portkey SDK facilitates the generation of embeddings using various LLMs. This method provides a straightforward interface similar to the OpenAI API for generating embeddings.
configParams (Object): Additional configuration options for the request. This is an optional parameter that can include custom config options for this specific request. These will override the configs set in the Portkey Client.
The response will conform to the Embedding Object schema from the Portkey API, typically including a list of embedding vectors consistent with the format provided by OpenAI for embedding objects.
This endpoint allows you to generate embeddings for text inputs using a specific model. The response will be an Embedding Object consistent with format.
requestParams (Object): Parameters for the embedding request. All are supported. These parameters include the input text and model, and are automatically transformed by Portkey for LLMs other than OpenAI. Parameters not supported by other LLMs will be omitted.
Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for text-embedding-ada-002
), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens.
The quick brown fox jumped over the lazy dog
The string that will be turned into an embedding.
The array of strings that will be turned into an embedding.
The array of integers that will be turned into an embedding.
The array of arrays containing integers that will be turned into an embedding.
ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
text-embedding-3-small
The format to return the embeddings in. Can be either float
or base64
.
float
Example: float
Available options: The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3
and later models.
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
user-1234
OK