Embeddings
Learn how to convert a text into embedding vectors and find the similarity ratio between two separate texts.
The embeddings endpoint
Embedding is a method of representing data in a vector of continuous numbers. We can provide these vectors to machine learning algorithms and models. Similar texts will have the same embedding vectors, and two different texts will have very different embeddings. The OpenAI API takes text as input and returns the embedding vector.
The following URL uses the POST
method which can be used to call the embeddings endpoint:
https://api.openai.com/v1/embeddings
Understanding the embeddings endpoint
Let’s look at the embeddings endpoint in more detail, reviewing the request parameters and the response parameters.
Request parameters
Let’s look at the parameters that are required to make a request at the embeddings endpoint.
Fields | Format | Type | Description |
| String | Required | The ID of the engine to use for this request. |
| String/array | Required | Input text for embedding, encoded as either a string or an array of tokens. For embedding multiple inputs within a single request, provide an array consisting of strings or arrays of tokens. The input size should not surpass the maximum input token limit for the model (8192 tokens for |
| String | Optional | The format in which embeddings is returned. The returned format can either be |
| Integer | Optional | The specified number of dimensions for the resulting output embeddings. This feature is supported starting from |
| String | Optional | A unique identifier that represents your end-user, aiding OpenAI in monitoring and identifying potential misuse or abuse. |
Note: You can learn more about the
model
...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy