Get Image Embeddings - Get Image Embeddings
傳回指定影像的內嵌向量。
方法會呼叫指定端點上 /images/embeddings
路由的 REST API。
POST https:///images/embeddings?api-version=2024-05-01-preview
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
api-version
|
query | True |
string minLength: 1 |
要用於這項作業的 API 版本。 |
要求標頭
名稱 | 必要 | 類型 | Description |
---|---|---|---|
extra-parameters |
控制如果 REST API 未定義的額外參數傳入 JSON 要求承載,會發生什麼情況。
這會 |
要求本文
名稱 | 必要 | 類型 | Description |
---|---|---|---|
input | True |
輸入要內嵌的影像。 若要在單一要求中內嵌多個輸入,請傳遞陣列。 輸入不能超過模型的最大輸入令牌。 |
|
dimensions |
integer (int32) |
自選。 產生的輸出內嵌應具有的維度數目。 傳遞 null 會導致模型使用其預設值。 如果模型不支援值或參數,則傳回 422 錯誤。 |
|
encoding_format |
自選。 產生的輸出內嵌應具有的維度數目。 傳遞 null 會導致模型使用其預設值。 如果模型不支援值或參數,則傳回 422 錯誤。 |
||
input_type |
自選。 輸入的類型。 如果模型不支援值或參數,則傳回 422 錯誤。 |
||
model |
string |
如果端點上有一個以上的模型,則為要使用的特定 AI 模型標識碼。 |
回應
名稱 | 類型 | Description |
---|---|---|
200 OK |
要求已成功。 |
|
Other Status Codes |
未預期的錯誤回應。 標題 x-ms-error-code: string |
安全性
api-key
類型:
apiKey
位於:
header
OAuth2Auth
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
範圍
名稱 | Description |
---|---|
https://ml.azure.com/.default |
範例
maximum set image embeddings |
minimum set image embeddings |
maximum set image embeddings
範例要求
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"
}
範例回覆
{
"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
範例要求
POST https:///images/embeddings?api-version=2024-05-01-preview
{
"input": [
{
"image": "gvmojtfooxixxzayrditjlyymg"
}
]
}
範例回覆
{
"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
}
}
定義
名稱 | Description |
---|---|
Azure. |
error 物件。 |
Azure. |
包含錯誤詳細數據的回應。 |
Azure. |
物件,包含有關錯誤的更特定資訊。 根據Microsoft一個 API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。 |
Embedding |
指定要產生的內嵌類型。 壓縮的內嵌類型,例如 |
Embedding |
表示用於內嵌搜尋的輸入類型。 |
Embedding |
單一內嵌關聯性比較的表示。 |
Embeddings |
來自內嵌要求之回應數據的表示。 內嵌會測量文字字串的相關性,通常用於搜尋、叢集、建議和其他類似案例。 |
Embeddings |
測量此要求和回應中使用的令牌數量。 |
Extra |
控制如果 REST API 未定義的額外參數傳入 JSON 要求承載,會發生什麼情況。 |
Image |
表示具有選擇性文字的影像。 |
Image |
映射內嵌要求的組態資訊。 |
Azure.Core.Foundations.Error
error 物件。
名稱 | 類型 | Description |
---|---|---|
code |
string |
其中一組伺服器定義的錯誤碼。 |
details |
導致此錯誤之特定錯誤的詳細數據陣列。 |
|
innererror |
物件,包含與目前對象有關錯誤更具體的資訊。 |
|
message |
string |
錯誤的人類可讀取表示法。 |
target |
string |
錯誤的目標。 |
Azure.Core.Foundations.ErrorResponse
包含錯誤詳細數據的回應。
名稱 | 類型 | Description |
---|---|---|
error |
error 物件。 |
Azure.Core.Foundations.InnerError
物件,包含有關錯誤的更特定資訊。 根據Microsoft一個 API 指導方針 - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses。
名稱 | 類型 | Description |
---|---|---|
code |
string |
其中一組伺服器定義的錯誤碼。 |
innererror |
內部錯誤。 |
EmbeddingEncodingFormat
指定要產生的內嵌類型。 壓縮的內嵌類型,例如 uint8
、int8
、ubinary
和 binary
,可能會降低儲存成本,而不會犧牲數據的完整性。 如果模型不支援值或參數,則傳回 422 錯誤。 閱讀模型的檔,以瞭解模型所支援的值。
值 | Description |
---|---|
base64 |
取得編碼為Base64字串之內嵌的二進位表示法。 OpenAI Python 連結庫會從 API 擷取內嵌作為編碼的二進位數據,而不是像往常一樣使用中繼十進位表示法。 |
binary |
取得已簽署的二進位內嵌 |
float |
取得完整精確度內嵌 |
int8 |
取得已登入的 int8 內嵌 |
ubinary |
取得未簽署的二進位內嵌 |
uint8 |
取得未簽署的 int8 內嵌 |
EmbeddingInputType
表示用於內嵌搜尋的輸入類型。
值 | Description |
---|---|
document |
表示輸入代表儲存在向量資料庫中的檔。 |
query |
表示輸入代表搜尋查詢,以在向量資料庫中尋找最相關的檔。 |
text |
表示輸入是一般文字輸入。 |
EmbeddingItem
單一內嵌關聯性比較的表示。
名稱 | 類型 | Description |
---|---|---|
embedding |
number[] (float) |
輸入提示的內嵌值清單。 這些代表所提供輸入之向量相關性的測量。 或內嵌向量的base64編碼字串。 |
index |
integer (int32) |
EmbeddingItem 對應之提示的索引。 |
object |
enum:
embedding |
這個內嵌項目的物件類型。 一律會 |
EmbeddingsResult
來自內嵌要求之回應數據的表示。 內嵌會測量文字字串的相關性,通常用於搜尋、叢集、建議和其他類似案例。
名稱 | 類型 | Description |
---|---|---|
data |
內嵌要求中提交的提示值。 |
|
id |
string |
內嵌結果的唯一標識碼。 |
model |
string |
用來產生此結果的模型標識碼。 |
object |
enum:
list |
內嵌結果的物件類型。 一律會 |
usage |
使用內嵌 API 輸入令牌的使用量計數。 |
EmbeddingsUsage
測量此要求和回應中使用的令牌數量。
名稱 | 類型 | Description |
---|---|---|
prompt_tokens |
integer (int32) |
要求中的令牌數目。 |
total_tokens |
integer (int32) |
在此要求/回應中交易的令牌總數。 應該等於要求中的令牌數目。 |
ExtraParameters
控制如果 REST API 未定義的額外參數傳入 JSON 要求承載,會發生什麼情況。
值 | Description |
---|---|
drop |
服務會忽略要求承載中的額外參數。。 它只會將已知參數傳遞至後端 AI 模型。 |
error |
如果服務偵測到要求承載中的額外參數,服務將會發生錯誤。 這是服務預設值。 |
pass-through |
服務會將額外的參數傳遞至後端 AI 模型。 |
ImageEmbeddingInput
表示具有選擇性文字的影像。
名稱 | 類型 | Description |
---|---|---|
image |
string |
以base64字串編碼為資料URL的輸入影像。 範例: |
text |
string |
自選。 要饋送至模型的文字輸入(例如 DINO、CLIP)。 如果模型不支援值或參數,則傳回 422 錯誤。 |
ImageEmbeddingsOptions
映射內嵌要求的組態資訊。
名稱 | 類型 | Description |
---|---|---|
dimensions |
integer (int32) |
自選。 產生的輸出內嵌應具有的維度數目。 傳遞 null 會導致模型使用其預設值。 如果模型不支援值或參數,則傳回 422 錯誤。 |
encoding_format |
自選。 產生的輸出內嵌應具有的維度數目。 傳遞 null 會導致模型使用其預設值。 如果模型不支援值或參數,則傳回 422 錯誤。 |
|
input |
輸入要內嵌的影像。 若要在單一要求中內嵌多個輸入,請傳遞陣列。 輸入不能超過模型的最大輸入令牌。 |
|
input_type |
自選。 輸入的類型。 如果模型不支援值或參數,則傳回 422 錯誤。 |
|
model |
string |
如果端點上有一個以上的模型,則為要使用的特定 AI 模型標識碼。 |