Get Image Embeddings - Get Image Embeddings
Return the embedding vectors for given images.
The method makes a REST API call to the /images/embeddings
route on the given endpoint.
POST https:///images/embeddings?api-version=2024-05-01-preview
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
extra-parameters |
Controls what happens if extra parameters, undefined by the REST API,
are passed in the JSON request payload.
This sets the HTTP request header |
Request Body
Name | Required | Type | Description |
---|---|---|---|
input | True |
Input image to embed. To embed multiple inputs in a single request, pass an array. The input must not exceed the max input tokens for the model. |
|
dimensions |
integer (int32) |
Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter. |
|
encoding_format |
Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter. |
||
input_type |
Optional. The type of the input. Returns a 422 error if the model doesn't support the value or parameter. |
||
model |
string |
ID of the specific AI model to use, if more than one model is available on the endpoint. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
The request has succeeded. |
|
Other Status Codes |
An unexpected error response. Headers x-ms-error-code: string |
Security
api-key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
Name | Description |
---|---|
https://ml.azure.com/.default |
Examples
maximum set image embeddings |
minimum set image embeddings |
maximum set image embeddings
Sample request
POST https:///images/embeddings?api-version=2024-05-01-preview
{
"input": [
{
"image": "puqkvvlvgcjyzughesnkena",
"text": "azrzyjsmnuefqpowpvfmyobeehqsni"
}
],
"dimensions": 1024,
"encoding_format": "float",
"input_type": "text",
"model": "my-model-name"
}
Sample response
{
"id": "cknxthfa",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"object": "list",
"model": "my-model-name",
"usage": {
"prompt_tokens": 15,
"total_tokens": 15
}
}
minimum set image embeddings
Sample request
POST https:///images/embeddings?api-version=2024-05-01-preview
{
"input": [
{
"image": "gvmojtfooxixxzayrditjlyymg"
}
]
}
Sample response
{
"id": "cknxthfa",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
],
"object": "list",
"model": "my-model-name",
"usage": {
"prompt_tokens": 15,
"total_tokens": 15
}
}
Definitions
Name | Description |
---|---|
Azure. |
The error object. |
Azure. |
A response containing error details. |
Azure. |
An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. |
Embedding |
Specifies the types of embeddings to generate. Compressed embeddings types like |
Embedding |
Represents the input types used for embedding search. |
Embedding |
Representation of a single embeddings relatedness comparison. |
Embeddings |
Representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios. |
Embeddings |
Measurement of the amount of tokens used in this request and response. |
Extra |
Controls what happens if extra parameters, undefined by the REST API, are passed in the JSON request payload. |
Image |
Represents an image with optional text. |
Image |
The configuration information for an image embeddings request. |
Azure.Core.Foundations.Error
The error object.
Name | Type | Description |
---|---|---|
code |
string |
One of a server-defined set of error codes. |
details |
An array of details about specific errors that led to this reported error. |
|
innererror |
An object containing more specific information than the current object about the error. |
|
message |
string |
A human-readable representation of the error. |
target |
string |
The target of the error. |
Azure.Core.Foundations.ErrorResponse
A response containing error details.
Name | Type | Description |
---|---|---|
error |
The error object. |
Azure.Core.Foundations.InnerError
An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
Name | Type | Description |
---|---|---|
code |
string |
One of a server-defined set of error codes. |
innererror |
Inner error. |
EmbeddingEncodingFormat
Specifies the types of embeddings to generate. Compressed embeddings types like uint8
, int8
, ubinary
and
binary
, may reduce storage costs without sacrificing the integrity of the data. Returns a 422 error if the
model doesn't support the value or parameter. Read the model's documentation to know the values supported by
the your model.
Value | Description |
---|---|
base64 |
Get back binary representation of the embeddings encoded as Base64 string. OpenAI Python library retrieves embeddings from the API as encoded binary data, rather than using intermediate decimal representations as is usually done. |
binary |
Get back signed binary embeddings |
float |
Get back full precision embeddings |
int8 |
Get back signed int8 embeddings |
ubinary |
Get back unsigned binary embeddings |
uint8 |
Get back unsigned int8 embeddings |
EmbeddingInputType
Represents the input types used for embedding search.
Value | Description |
---|---|
document |
Indicates the input represents a document that is stored in a vector database. |
query |
Indicates the input represents a search query to find the most relevant documents in your vector database. |
text |
Indicates the input is a general text input. |
EmbeddingItem
Representation of a single embeddings relatedness comparison.
Name | Type | Description |
---|---|---|
embedding |
number[] (float) |
List of embedding values for the input prompt. These represent a measurement of the vector-based relatedness of the provided input. Or a base64 encoded string of the embedding vector. |
index |
integer (int32) |
Index of the prompt to which the EmbeddingItem corresponds. |
object |
enum:
embedding |
The object type of this embeddings item. Will always be |
EmbeddingsResult
Representation of the response data from an embeddings request. Embeddings measure the relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
Name | Type | Description |
---|---|---|
data |
Embedding values for the prompts submitted in the request. |
|
id |
string |
Unique identifier for the embeddings result. |
model |
string |
The model ID used to generate this result. |
object |
enum:
list |
The object type of the embeddings result. Will always be |
usage |
Usage counts for tokens input using the embeddings API. |
EmbeddingsUsage
Measurement of the amount of tokens used in this request and response.
Name | Type | Description |
---|---|---|
prompt_tokens |
integer (int32) |
Number of tokens in the request. |
total_tokens |
integer (int32) |
Total number of tokens transacted in this request/response. Should equal the number of tokens in the request. |
ExtraParameters
Controls what happens if extra parameters, undefined by the REST API, are passed in the JSON request payload.
Value | Description |
---|---|
drop |
The service will ignore (drop) extra parameters in the request payload. It will only pass the known parameters to the back-end AI model. |
error |
The service will error if it detected extra parameters in the request payload. This is the service default. |
pass-through |
The service will pass extra parameters to the back-end AI model. |
ImageEmbeddingInput
Represents an image with optional text.
Name | Type | Description |
---|---|---|
image |
string |
The input image encoded in base64 string as a data URL. Example: |
text |
string |
Optional. The text input to feed into the model (like DINO, CLIP). Returns a 422 error if the model doesn't support the value or parameter. |
ImageEmbeddingsOptions
The configuration information for an image embeddings request.
Name | Type | Description |
---|---|---|
dimensions |
integer (int32) |
Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter. |
encoding_format |
Optional. The number of dimensions the resulting output embeddings should have. Passing null causes the model to use its default value. Returns a 422 error if the model doesn't support the value or parameter. |
|
input |
Input image to embed. To embed multiple inputs in a single request, pass an array. The input must not exceed the max input tokens for the model. |
|
input_type |
Optional. The type of the input. Returns a 422 error if the model doesn't support the value or parameter. |
|
model |
string |
ID of the specific AI model to use, if more than one model is available on the endpoint. |