本文提供 Azure OpenAI 的推斷 REST API 端點詳細資料。
API 規格
對 Azure OpenAI 模型和資源的管理與互動,分別由三個主要 API 介面執行:
- 控制平面
- 資料平面 - 製作
- 資料平面 - 推斷
每個 API 介面/規格都會封裝一組不同的 Azure OpenAI 功能。 每個 API 都各有獨特的預覽版和穩定/正式發行 (GA) API 版本。 預覽版本目前通常會遵循每月頻率。
Important
現在有新的預覽推斷 API。 在我們的 API 生命週期指南中深入瞭解。
| API | 最新預覽版本 | 最新 GA 版本 | Specifications | Description |
|---|---|---|---|---|
| 控制平面 | 2025-07-01-preview |
2025-06-01 |
規格檔案 | 控制平面 API 用於 建立資源、 模型部署和其他更高層級資源管理工作等作業。 控制平面也會控管如何使用 Azure Resource Manager、Bicep、Terraform 和 Azure CLI 這類功能。 |
| 資料平面 | v1 preview |
v1 |
規格檔案 | 資料平面 API 會控制推斷和編寫作業。 |
Authentication
Azure OpenAI 提供兩種驗證方法。 您可以使用 API 金鑰或 Microsoft Entra ID。
API 金鑰驗證:在這類型的驗證中,所有 API 要求都必須在
api-keyHTTP 標頭中包含 API 金鑰。 此快速入門提供如何使用這類型驗證進行呼叫的指引。Microsoft Entra ID 驗證:您可以使用 Microsoft Entra 權杖來驗證 API 呼叫。 驗證權杖會包含在要求中作為
Authorization標頭。 提供的權杖前面必須加上Bearer,例如Bearer YOUR_AUTH_TOKEN。 您可以閱讀我們的操作指南,了解如何使用 Microsoft Entra ID 進行驗證。
REST API 版本設定
服務 API 使用 api-version 查詢參數設定版本。 所有版本都遵循 YYYY-MM-DD 日期結構。 例如:
POST https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=2024-06-01
資料平面推斷
本文的其餘部分涵蓋 2025-04-01-preview Azure OpenAI 數據平面推斷規格的預覽版本。
如果您要尋找最新 GA API 版本的文件,請參閱最新 GA 資料平面推斷 API
完成 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/completions?api-version=2025-04-01-preview
建立所提供提示、參數和所選模型的完成。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| best_of | 整數 | 產生 best_of 完成伺服器端,並傳回「最佳」項目 (具有每個語彙基元最高對數機率的項目)。 結果不能串流。搭配 n 使用時,best_of 會控制候選完成的數目,n 指定傳回的數量—best_of 必須大於 n。注意:因為此參數會產生許多完成項,所以會快速消耗語彙基元配額。 請謹慎使用並確保您對 max_tokens 和 stop 設定合理。 |
No | 1 |
| echo | boolean | 回應完成以外的提示 | No | False |
| frequency_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止在文字中的出現頻率來打壓新權杖,降低模型重複完全相同行的可能性。 | No | 0 |
| logit_bias | 物件 | 修改在完成時出現指定權杖的可能性。 接受 JSON 物件,此物件會將語彙基元 (由 GPT 語彙基元化工具中的語彙基元識別碼所指定) 對應至 -100 到 100 的相關偏差值。 在數學上,偏差會先加到模型產生的對數,再進行取樣。 確切的效果會因模型而異,但介於 -1 到 1 之間的值應該會降低或提高選取的可能性;而 -100 或 100 之類的值應會導致禁止選取或獨佔選取相關權杖。 例如,您可以傳遞 {"50256": -100} 以防止產生 <|endoftext|> 語彙基元。 |
No | None |
| logprobs | 整數 | 包括 logprobs 個最可能的輸出語彙基元以及所選語彙基元的對數機率。 例如,如果 logprobs 為 5,API 會傳回 5 個最有可能令牌的清單。 API 一律會傳回取樣令牌的logprob,因此回應中可能會有最多logprobs+1個元素。logprobs 的最大值為 5。 |
No | None |
| max_tokens | 整數 | 完成中可產生的權杖數目上限。 提示的權杖計數加上 max_tokens 不能超過模型的內容長度。 |
No | 16 |
| n | 整數 | 每個提示要產生的完成項數量。 注意:因為此參數會產生許多完成項,所以會快速消耗語彙基元配額。 請謹慎使用並確保您對 max_tokens 和 stop 設定合理。 |
No | 1 |
| presence_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止是否出現在文字中來打壓新權杖,提高模型討論新主題的可能性。 | No | 0 |
| 提示 | 字串或陣列 | 產生完成的提示,編碼為字串、字串陣列、語彙基元陣列或語彙基元陣列的陣列。 請注意, <|endoftext|> 是模型在定型期間看到的檔分隔符,因此如果未指定提示,則模型會產生如同從新文件的開頭一樣。 |
Yes | |
| seed | 整數 | 如果有指定,我們的系統會盡最大努力以決定性方式取樣,讓具有相同 seed 和參數的要求能夠重複傳回相同的結果。不保證決定性,且您應參照 system_fingerprint 回應參數來監視後端的變更。 |
No | |
| stop | 字串或陣列 | 最多有四個序列,API 會在這些序列中停止生成更多的標記。 傳回的文字不會包含停止序列。 | No | |
| 串流 | boolean | 是否要串流回部分進度。 如果已設定,token 會以僅限數據的 伺服器傳送事件 形式發送,而數據流會在發送 data: [DONE] 訊息後終止。
範例 Python 程式碼。 |
No | False |
| suffix | 字串 | 完成插入文字之後的尾碼。 僅 gpt-3.5-turbo-instruct 支援此參數。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 等較高的值會讓輸出更隨機,而較低的值,例如 0.2,可讓輸出更專注且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | createCompletionResponse |
狀態碼:預設值
描述:服務無法使用
| Content-Type | Type | Description |
|---|---|---|
| application/json | errorResponse |
Examples
Example
建立所提供提示、參數和所選模型的完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/completions?api-version=2025-04-01-preview
{
"prompt": [
"tell me a joke about mango"
],
"max_tokens": 32,
"temperature": 1.0,
"n": 1
}
回應:狀態碼:200
{
"body": {
"id": "cmpl-7QmVI15qgYVllxK0FtxVGG6ywfzaq",
"created": 1686617332,
"choices": [
{
"text": "es\n\nWhat do you call a mango who's in charge?\n\nThe head mango.",
"index": 0,
"finish_reason": "stop",
"logprobs": null
}
],
"usage": {
"completion_tokens": 20,
"prompt_tokens": 6,
"total_tokens": 26
}
}
}
內嵌 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/embeddings?api-version=2025-04-01-preview
取得可供機器學習模型和演算法輕鬆取用之給定輸入的向量表示法。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | 已部署之模型的部署標識碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| dimensions | 整數 | 產生的輸出內嵌應具有的維度數目。 僅支援 text-embedding-3 和更新模型。 |
No | |
| encoding_format | 字串 | 用以傳回內嵌的格式。 可以是 float 或 base64。 預設為 float。 |
No | |
| 輸入 | 字串或陣列 | 要內嵌的輸入文字,編碼為權杖字串或陣列。 若要在單一要求中內嵌多個輸入,請傳遞字串陣列或權杖陣列的陣列。 輸入不能超過模型的輸入語彙基元上限 (text-embedding-ada-002 適用 8,192 個語彙基元) 不能是空的字串,而且任何陣列都必須是 2,048 個維度或更少。 |
Yes | |
| input_type | 字串 | 要使用的內嵌搜尋輸入類型 | No | |
| 使用者 | 字串 | 代表終端使用者的唯一識別碼,有助於監視和偵測濫用。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | 物件 |
Examples
Example
傳回給定提示的內嵌。
POST https://{endpoint}/openai/deployments/{deployment-id}/embeddings?api-version=2025-04-01-preview
{
"input": [
"this is a test"
]
}
回應:狀態碼:200
{
"body": {
"data": [
{
"index": 0,
"embedding": [
-0.012838088,
-0.007421397,
-0.017617522,
-0.028278312,
-0.018666342,
0.01737855,
-0.01821495,
-0.006950092,
-0.009937238,
-0.038580645,
0.010674067,
0.02412286,
-0.013647936,
0.013189907,
0.0021125758,
0.012406612,
0.020790534,
0.00074595667,
0.008397198,
-0.00535031,
0.008968075,
0.014351576,
-0.014086051,
0.015055214,
-0.022211088,
-0.025198232,
0.0065186154,
-0.036350243,
0.009180495,
-0.009698266,
0.009446018,
-0.008463579,
-0.0020113448
]
}
],
"usage": {
"prompt_tokens": 4,
"total_tokens": 4
}
}
}
聊天完成 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
建立聊天訊息的完成
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| audio | 物件 | 音訊輸出的參數。 使用 modalities: ["audio"] 要求音訊輸出時需要。 |
No | |
| └─ 格式 | 列舉 | 指定輸出音訊格式。 必須是 wav、mp3、flac、opus 或 pcm16 其中之一。 可能的值: wav、mp3、flac、opus、pcm16 |
No | |
| ‧----語音 | 列舉 | 指定語音類型。 支援的語音為alloy、、echo、fableonyx、、 nova和 shimmer。可能的值: alloy、、、echofableonyx、nova、shimmer |
No | |
| data_sources | 陣列 | 加以使用的 Azure OpenAI 聊天延伸模組的設定項目。 此額外規格只與 Azure OpenAI 相容。 |
No | |
| frequency_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止在文字中的出現頻率來打壓新權杖,降低模型重複完全相同行的可能性。 |
No | 0 |
| function_call | string 或 chatCompletionFunctionCallOption | 已淘汰,改用 tool_choice。控制模型所呼叫的函式 (若有)。 none 表示模型不會呼叫函式,而是會產生訊息。auto 表示模型可選擇產生訊息或呼叫函式。透過 {"name": "my_function"} 指定特定函式會強制模型呼叫該函式。當沒有任何函式存在時, none 為預設值。
如果函式存在,auto 為預設值。 |
No | |
| functions | 陣列 | 已淘汰,改用 tools。模型可能會為其產生 JSON 輸入的函數清單。 |
No | |
| logit_bias | 物件 | 修改在完成時出現指定權杖的可能性。 接受 JSON 物件,此物件會將權杖 (由權杖化工具中的語彙基元識別碼所指定) 對應至 -100 到 100 的相關聯偏差值。 在數學上,偏差會先加到模型產生的對數,再進行取樣。 確切的效果會因模型而異,但介於 -1 到 1 之間的值應該會降低或提高選取的可能性;而 -100 或 100 之類的值應會導致禁止選取或獨佔選取相關權杖。 |
No | None |
| logprobs | boolean | 是否要傳回輸出權杖的對數機率。 如果為 true,則會傳回在 content 的 message 中所傳回每個輸出權杖的對數機率。 |
No | False |
| max_completion_tokens | 整數 | 可針對完成產生的語彙基元數目上限,包括可見的輸出語彙基元和推理語彙基元。 | No | |
| max_tokens | 整數 | 聊天完成中可產生的權杖數目上限。 輸入權杖和產生權杖的總長度受限於模型的內容長度。 |
No | |
| messages | 陣列 | 目前比較交談的訊息清單。 範例 Python 程式碼。 | Yes | |
| 中繼資料 | 物件 | 開發人員定義的標籤和值,用於篩選儲存完成結果儀表板中的完成項目。 | No | |
| modalities | ChatCompletionModalities | 您希望模型根據此要求產生的輸出類型。 大部分模型都能夠產生文字,這是預設值: ["text"]gpt-4o-audio-preview 模型也可以用來產生音訊。 若要要求此模型同時產生文字和音訊回應,您可以使用:["text", "audio"] |
No | |
| n | 整數 | 針對每個輸入訊息產生多少聊天完成選項。 會根據所有選擇中產生之語彙基元的數目來向您收費。 將 n 保留為 1 以將成本降至最低。 |
No | 1 |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| 預測 | PredictionContent | 預測輸出的設定,這可在模型回應大部分提前已知時,大幅改善回應時間。 最常見的情況是您要重新產生檔案,但只對大部分內容進行了少許變更。 | No | |
| presence_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止是否出現在文字中來打壓新權杖,提高模型討論新主題的可能性。 |
No | 0 |
| reasoning_effort | 列舉 |
僅限 o1 模型 限制推理模型的推理工作。 目前支援的值為 low、medium 和 high。 減少推理工作可能會導致回應更快,以及回應中用於推理的權杖較少。可能的值: low、、 mediumhigh |
No | |
| response_format | ResponseFormatText 或 ResponseFormatJsonObject 或 ResponseFormatJsonSchema | 物件,指定模型必須輸出的格式。 相容於 GPT-4o、GPT-4o mini、GPT-4 Turbo,以及所有比 還要新的 gpt-3.5-turbo-1106 Turbo 模型。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,保證模型符合您提供的 JSON 架構。設定為 { "type": "json_object" } 會啟用 JSON 模式,保證模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| seed | 整數 | 這項功能在 Beta 版中。 如果有指定,我們的系統會盡最大努力以決定性方式取樣,讓具有相同 seed 和參數的要求能夠重複傳回相同的結果。不保證決定性,且您應參照 system_fingerprint 回應參數來監視後端的變更。 |
No | |
| stop | 字串或陣列 | 最多 4 個序列,API 將在每個序列中停止產生更多的令牌。 |
No | |
| 儲存 | boolean | 是否要儲存此聊天完成要求的輸出,以用於我們的模型擷取或評估產品。 | No | |
| 串流 | boolean | 如果設定,則會傳送部分訊息差異,就像在 ChatGPT 中一樣。 當語彙基元可用時,它們會作為僅含資料的伺服器傳送事件來傳送,並由 data: [DONE] 訊息來終止串流。
範例 Python 程式碼。 |
No | False |
| stream_options | chatCompletionStreamOptions | 串流回應的選項。 只有當您設定 stream: true 時,才需要設定此選項。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 等較高的值會讓輸出更隨機,而較低的值,例如 0.2,可讓輸出更專注且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| tool_choice | chatCompletionToolChoiceOption | 控制模型所呼叫的工具 (若有)。
none 表示模型不會呼叫任何工具,而是會產生訊息。
auto 表示模型可以選擇產生訊息或是呼叫一或多個工具。
required 表示模型必須呼叫一或多個工具。 透過 {"type": "function", "function": {"name": "my_function"}} 指定特定工具會強制模型呼叫該工具。
當沒有任何工具存在時,none 為預設值。
當有工具存在時,auto 為預設值。 |
No | |
| tools | 陣列 | 模型可呼叫的工具清單。 目前僅支援函式作為工具。 使用此參數可提供產生 JSON 輸入的函式清單。 最多支援 128 個函式。 |
No | |
| top_logprobs | 整數 | 介於 0 到 20 之間的整數,其會指定最有可能在每個語彙基元位置傳回的語彙基元數目,每個都有相關聯的對數機率。
如果使用此參數,則 logprobs 必須設定為 true。 |
No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 |
No | |
| user_security_context | userSecurityContext | 使用者安全性內容包含數個參數,描述 AI 應用程式本身,以及與 AI 應用程式互動的終端使用者。 這些欄位提供保護 AI 應用程式的完整方法,進而協助安全性作業小組調查及減輕安全性事件。 深入了解如何使用適用於雲端的 Microsoft Defender 保護 AI 應用程式。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | 物件 |
狀態碼:預設值
描述:服務無法使用
| Content-Type | Type | Description |
|---|---|---|
| application/json | errorResponse |
Examples
Example
建立所提供提示、參數和所選模型的完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "system",
"content": "you are a helpful assistant that talks like a pirate"
},
{
"role": "user",
"content": "can you tell me how to care for a parrot?"
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Ahoy matey! So ye be wantin' to care for a fine squawkin' parrot, eh? Well, shiver me timbers, let ol' Cap'n Assistant share some wisdom with ye! Here be the steps to keepin' yer parrot happy 'n healthy:\n\n1. Secure a sturdy cage: Yer parrot be needin' a comfortable place to lay anchor! Be sure ye get a sturdy cage, at least double the size of the bird's wingspan, with enough space to spread their wings, yarrrr!\n\n2. Perches 'n toys: Aye, parrots need perches of different sizes, shapes, 'n textures to keep their feet healthy. Also, a few toys be helpin' to keep them entertained 'n their minds stimulated, arrrh!\n\n3. Proper grub: Feed yer feathered friend a balanced diet of high-quality pellets, fruits, 'n veggies to keep 'em strong 'n healthy. Give 'em fresh water every day, or ye\u00e2\u20ac\u2122ll have a scurvy bird on yer hands!\n\n4. Cleanliness: Swab their cage deck! Clean their cage on a regular basis: fresh water 'n food daily, the floor every couple of days, 'n a thorough scrubbing ev'ry few weeks, so the bird be livin' in a tidy haven, arrhh!\n\n5. Socialize 'n train: Parrots be a sociable lot, arrr! Exercise 'n interact with 'em daily to create a bond 'n maintain their mental 'n physical health. Train 'em with positive reinforcement, treat 'em kindly, yarrr!\n\n6. Proper rest: Yer parrot be needin' \u00e2\u20ac\u2122bout 10-12 hours o' sleep each night. Cover their cage 'n let them slumber in a dim, quiet quarter for a proper night's rest, ye scallywag!\n\n7. Keep a weather eye open for illness: Birds be hidin' their ailments, arrr! Be watchful for signs of sickness, such as lethargy, loss of appetite, puffin' up, or change in droppings, and make haste to a vet if need be.\n\n8. Provide fresh air 'n avoid toxins: Parrots be sensitive to draft and pollutants. Keep yer quarters well ventilated, but no drafts, arrr! Be mindful of toxins like Teflon fumes, candles, or air fresheners.\n\nSo there ye have it, me hearty! With proper care 'n commitment, yer parrot will be squawkin' \"Yo-ho-ho\" for many years to come! Good luck, sailor, and may the wind be at yer back!"
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
根據 Azure 搜尋服務資料和系統指派的受控識別來建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "azure_search",
"parameters": {
"endpoint": "https://your-search-endpoint.search.windows.net/",
"index_name": "{index name}",
"authentication": {
"type": "system_assigned_managed_identity"
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content.",
"title": "Citation Title",
"filepath": "contoso.txt",
"url": "https://contoso.blob.windows.net/container/contoso.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
根據 Azure 搜尋服務影像向量資料來建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "azure_search",
"parameters": {
"endpoint": "https://your-search-endpoint.search.windows.net/",
"index_name": "{index name}",
"query_type": "vector",
"fields_mapping": {
"image_vector_fields": [
"image_vector"
]
},
"authentication": {
"type": "api_key",
"key": "{api key}"
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion."
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
根據 Azure 搜尋服務向量資料、先前的助理訊息和使用者指派的受控識別來建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a cat?"
},
{
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"intent": "cat care"
}
},
{
"role": "user",
"content": "how about dog?"
}
],
"data_sources": [
{
"type": "azure_search",
"parameters": {
"endpoint": "https://your-search-endpoint.search.windows.net/",
"authentication": {
"type": "user_assigned_managed_identity",
"managed_identity_resource_id": "/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{resource-name}"
},
"index_name": "{index name}",
"query_type": "vector",
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": "{embedding deployment name}"
},
"in_scope": true,
"top_n_documents": 5,
"strictness": 3,
"role_information": "You are an AI assistant that helps people find information.",
"fields_mapping": {
"content_fields_separator": "\\n",
"content_fields": [
"content"
],
"filepath_field": "filepath",
"title_field": "title",
"url_field": "url",
"vector_fields": [
"contentvector"
]
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content 2.",
"title": "Citation Title 2",
"filepath": "contoso2.txt",
"url": "https://contoso.blob.windows.net/container/contoso2.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
為提供的 Azure Cosmos DB 建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "azure_cosmos_db",
"parameters": {
"authentication": {
"type": "connection_string",
"connection_string": "mongodb+srv://rawantest:{password}$@{cluster-name}.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false&maxIdleTimeMS=120000"
},
"database_name": "vectordb",
"container_name": "azuredocs",
"index_name": "azuredocindex",
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": "{embedding deployment name}"
},
"fields_mapping": {
"content_fields": [
"content"
],
"vector_fields": [
"contentvector"
]
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content.",
"title": "Citation Title",
"filepath": "contoso.txt",
"url": "https://contoso.blob.windows.net/container/contoso.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
為提供的 Mongo DB 建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "mongo_db",
"parameters": {
"authentication": {
"type": "username_and_password",
"username": "<username>",
"password": "<password>"
},
"endpoint": "<endpoint_name>",
"app_name": "<application name>",
"database_name": "sampledb",
"collection_name": "samplecollection",
"index_name": "sampleindex",
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": "{embedding deployment name}"
},
"fields_mapping": {
"content_fields": [
"content"
],
"vector_fields": [
"contentvector"
]
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content.",
"title": "Citation Title",
"filepath": "contoso.txt",
"url": "https://contoso.blob.windows.net/container/contoso.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
為提供的 Elasticsearch 建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "elasticsearch",
"parameters": {
"endpoint": "https://your-elasticsearch-endpoint.eastus.azurecontainer.io",
"index_name": "{index name}",
"authentication": {
"type": "key_and_key_id",
"key": "{key}",
"key_id": "{key id}"
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content.",
"title": "Citation Title",
"filepath": "contoso.txt",
"url": "https://contoso.blob.windows.net/container/contoso.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
Example
為提供的 Pinecone 資源建立完成。
POST https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2025-04-01-preview
{
"messages": [
{
"role": "user",
"content": "can you tell me how to care for a dog?"
}
],
"data_sources": [
{
"type": "pinecone",
"parameters": {
"authentication": {
"type": "api_key",
"key": "{api key}"
},
"environment": "{environment name}",
"index_name": "{index name}",
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": "{embedding deployment name}"
},
"fields_mapping": {
"title_field": "title",
"url_field": "url",
"filepath_field": "filepath",
"content_fields": [
"content"
],
"content_fields_separator": "\n"
}
}
}
]
}
回應:狀態碼:200
{
"body": {
"id": "chatcmpl-7R1nGnsXO8n4oi9UPz2f3UHdgAYMn",
"created": 1686676106,
"choices": [
{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Content of the completion [doc1].",
"context": {
"citations": [
{
"content": "Citation content.",
"title": "Citation Title",
"filepath": "contoso.txt",
"url": "https://contoso.blob.windows.net/container/contoso.txt",
"chunk_id": "0"
}
],
"intent": "dog care"
}
}
}
],
"usage": {
"completion_tokens": 557,
"prompt_tokens": 33,
"total_tokens": 590
}
}
}
謄寫 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/transcriptions?api-version=2025-04-01-preview
將音訊謄寫為輸入語言。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:multipart/form-data
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型號 | 字串 | 要使用的模型識別碼。 選項為 gpt-4o-transcribe、 gpt-4o-mini-transcribe、 gpt-4o-mini-transcribe-2025-12-15、 whisper-1gpt-4o-transcribe-diarize和 。 |
Yes | |
| 檔案 | 字串 | 要謄寫的音訊檔案物件。 | Yes | |
| 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式提供輸入語言可改善精確度和延遲。 | No | |
| 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 提示應該符合音訊語言。 | No | |
| response_format | audioResponseFormat | 定義輸出的格式。 | No | |
| temperature | number | 取樣溫度,介於 0 到 1 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 如果設定為 0,模型會使用對數機率自動增加溫度,直到達到特定閾值為止。 | No | 0 |
| timestamp_granularities[] | 陣列 | 針對此謄寫填入的時間戳記細微度。
response_format 必須設定為 verbose_json 以使用時間戳記細微度。 支援使用這兩個選項之一或同時使用:word 或 segment。 注意:區段時間戳沒有額外的延遲,但產生文字時間戳會產生額外的延遲。 |
No | ['segment'] |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | 物件 | |
| text/plain | 字串 | 輸出格式中的轉錄文字(當 response_format 是 text、vtt 或 srt 其中之一時)。 |
Examples
Example
從提供的口語音訊資料中取得謄寫的文字和相關聯的中繼資料。
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/transcriptions?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"text": "A structured object when requesting json or verbose_json"
}
}
Example
從提供的口語音訊資料中取得謄寫的文字和相關聯的中繼資料。
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/transcriptions?api-version=2025-04-01-preview
"---multipart-boundary\nContent-Disposition: form-data; name=\"file\"; filename=\"file.wav\"\nContent-Type: application/octet-stream\n\nRIFF..audio.data.omitted\n---multipart-boundary--"
回應:狀態碼:200
{
"type": "string",
"example": "plain text when requesting text, srt, or vtt"
}
翻譯 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/translations?api-version=2025-04-01-preview
將輸入音訊謄寫並翻譯為英文。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:multipart/form-data
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 檔案 | 字串 | 要翻譯的音訊檔案。 | Yes | |
| 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 提示應以英文顯示。 | No | |
| response_format | audioResponseFormat | 定義輸出的格式。 | No | |
| temperature | number | 取樣溫度,介於 0 到 1 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 如果設定為 0,模型會使用對數機率自動增加溫度,直到達到特定閾值為止。 | No | 0 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | 物件 | |
| text/plain | 字串 | 輸出格式的謄寫文字 (當 response_format 是文字、vtt 或 srt 的其中之一時)。 |
Examples
Example
從提供的口語音訊資料中取得英文謄寫文字和相關聯的中繼資料。
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/translations?api-version=2025-04-01-preview
"---multipart-boundary\nContent-Disposition: form-data; name=\"file\"; filename=\"file.wav\"\nContent-Type: application/octet-stream\n\nRIFF..audio.data.omitted\n---multipart-boundary--"
回應:狀態碼:200
{
"body": {
"text": "A structured object when requesting json or verbose_json"
}
}
Example
從提供的口語音訊資料中取得英文謄寫文字和相關聯的中繼資料。
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/translations?api-version=2025-04-01-preview
"---multipart-boundary\nContent-Disposition: form-data; name=\"file\"; filename=\"file.wav\"\nContent-Type: application/octet-stream\n\nRIFF..audio.data.omitted\n---multipart-boundary--"
回應:狀態碼:200
{
"type": "string",
"example": "plain text when requesting text, srt, or vtt"
}
語音 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/speech?api-version=2025-04-01-preview
從輸入文字產生音訊。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:multipart/form-data
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 輸入 | 字串 | 要合成音訊的文字。 長度上限是 4,096 個字元。 | Yes | |
| response_format | 列舉 | 要用來合成音訊的格式。 可能的值: mp3、、、opusaacflac、wav、pcm |
No | |
| speed | number | 合成音訊的速度。 請選取 0.25 到 4.0 之間的值。
1.0 是預設值。 |
No | 1.0 |
| voice | 列舉 | 要用於語音合成的聲音。 可能的值: alloy、、、echofableonyx、nova、shimmer |
Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/octet-stream | 字串 |
Examples
Example
從提供的文字合成音訊。
POST https://{endpoint}/openai/deployments/{deployment-id}/audio/speech?api-version=2025-04-01-preview
{
"input": "Hi! What are you going to make?",
"voice": "fable",
"response_format": "mp3"
}
回應:狀態碼:200
{
"body": "101010101"
}
影像產生 - 建立
POST https://{endpoint}/openai/deployments/{deployment-id}/images/generations?api-version=2025-04-01-preview
根據給定的 DALL-E 或 gpt-image-1 系列模型部署的文字說明產生一批圖像
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 背景 | imageBackground | 允許設定所產生影像背景的透明度。 此參數僅支援 gpt-image-1 系列模型。 | No | auto |
| n | 整數 | 要產生的映像數目。 針對 dall-e-3,僅支持 n=1。 | No | 1 |
| output_compression | 整數 | 所產生影像的壓縮層級 (0-100%)。 此參數僅支援帶有 jpeg 輸出格式的 gpt-image-1 系列模型。 | No | 100 |
| output_format | imagesOutputFormat | 傳回所產生影像的檔案格式。 僅支援 GPT-Image-1 系列機型。 | No | png |
| 提示 | 字串 | 所需映像的文字描述。 GPT-image-1 系列最大長度為 32000 字元,dall-e-3 則為 4000 字元 | Yes | |
| partial_images | 整數 | 要產生的部分影像數目。 此參數用於傳回部分影像的串流回應。 值必須介於 0 到 3 之間。 當設定為 0 時,回應會是一個串流事件中傳送的單一影像。 請注意,如果完整影像生成速度更快,則可能會在所有部分影像完全生成之前,先行傳送最終影像。 | 0 | |
| 串流 | boolean | 在串流模式中編輯影像。 | no | false |
| quality | imageQuality | 將產生之影像的品質。 | No | auto |
| response_format | imagesResponseFormat | 傳回所產生影像的格式。 這個參數不支援 gpt-image-1-series 模型,因為 -series 模型總是會回傳 base64 編碼的影像。可能的值: url、b64_json。 |
No | url |
| size | imageSize | 產生的映像大小。 | No | auto |
| 樣式 | imageStyle | 所產生影像的樣式。 僅支援 dall-e-3。 | No | vivid |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | generateImagesResponse |
狀態碼:預設值
描述:發生錯誤。
| Content-Type | Type | Description |
|---|---|---|
| application/json | dalleErrorResponse |
Examples
Example
根據提示建立影像。
POST https://{endpoint}/openai/deployments/{deployment-id}/images/generations?api-version=2025-04-01-preview
{
"prompt": "In the style of WordArt, Microsoft Clippy wearing a cowboy hat.",
"n": 1,
"style": "natural",
"quality": "standard"
}
回應:狀態碼:200
{
"body": {
"created": 1698342300,
"data": [
{
"revised_prompt": "A vivid, natural representation of Microsoft Clippy wearing a cowboy hat.",
"prompt_filter_results": {
"sexual": {
"severity": "safe",
"filtered": false
},
"violence": {
"severity": "safe",
"filtered": false
},
"hate": {
"severity": "safe",
"filtered": false
},
"self_harm": {
"severity": "safe",
"filtered": false
},
"profanity": {
"detected": false,
"filtered": false
},
"custom_blocklists": {
"filtered": false,
"details": []
}
},
"url": "https://dalletipusw2.blob.core.windows.net/private/images/e5451cc6-b1ad-4747-bd46-b89a3a3b8bc3/generated_00.png?se=2023-10-27T17%3A45%3A09Z&...",
"content_filter_results": {
"sexual": {
"severity": "safe",
"filtered": false
},
"violence": {
"severity": "safe",
"filtered": false
},
"hate": {
"severity": "safe",
"filtered": false
},
"self_harm": {
"severity": "safe",
"filtered": false
}
}
}
]
}
}
影像生成 - 編輯
POST https://{endpoint}/openai/deployments/{deployment-id}/images/edits?api-version=2025-04-01-preview
在指定的 gpt-image-1 模型部署中,根據文字敘述編輯圖像。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| deployment-id | 路徑 | Yes | 字串 | |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:multipart/form-data
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 圖片 | 字串或陣列 | 要編輯的影像。 必須是支援的影像檔或影像陣列。 每個影像都應該是 png 或 jpg 檔案,小於 50MB。 | Yes | |
| 輸入精確度 | 字串 | 控制模型將發揮多少努力來比對輸入影像的樣式和特徵,尤其是臉部特徵。 此參數僅支援 gpt-image-1 系列模型。 支援 high 與 low。 |
no |
low。 |
| 遮罩 | 字串 | 其他影像,其完全透明區域 (例如,其中 Alpha 為零) 表示應編輯影像的位置。 如果提供多個影像,遮罩將會套用至第一個影像。 必須是有效的 PNG 檔案,小於 4MB,且與影像具有相同的維度。 | No | |
| n | 整數 | 要產生的映像數目。 必須介於 1 到 10 之間。 | No | 1 |
| 提示 | 字串 | 所需映像的文字描述。 最大長度為32000個字元。 | Yes | |
| quality | imageQuality | 將產生之影像的品質。 | No | auto |
| partial_images | 要產生的部分影像數目。 此參數用於傳回部分影像的串流回應。 值必須介於 0 到 3 之間。 當設定為 0 時,回應會是一個串流事件中傳送的單一影像。 請注意,如果完整影像生成速度更快,則可能會在所有部分影像完全生成之前,先行傳送最終影像。 | |||
| 串流 | boolean | 在串流模式中編輯影像。 | no | false |
| response_format | imagesResponseFormat | 傳回所產生影像的格式。 | No | url |
| size | imageSize | 產生的映像大小。 | No | auto |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | generateImagesResponse |
狀態碼:預設值
描述:發生錯誤。
| Content-Type | Type | Description |
|---|---|---|
| application/json | dalleErrorResponse |
列出 - 助理
GET https://{endpoint}/openai/assistants?api-version=2025-04-01-preview
傳回助理清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listAssistantsResponse |
Examples
Example
傳回助理清單。
GET https://{endpoint}/openai/assistants?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "asst_abc123",
"object": "assistant",
"created_at": 1707257477,
"name": "Stock Analyst",
"description": null,
"model": "gpt-4-1106-preview",
"instructions": "You are a financial analyst that analyzes stock market prices and other financial data present on user uploaded files or by calling external APIs.",
"tools": [
{
"type": "code_interpreter"
}
],
"tool_resources": {},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
},
{
"id": "asst_abc456",
"object": "assistant",
"created_at": 1698982718,
"name": "My Assistant",
"description": null,
"model": "gpt-4-turbo",
"instructions": "You are a helpful assistant designed to make me better at coding!",
"tools": [],
"tool_resources": {},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
},
{
"id": "asst_abc789",
"object": "assistant",
"created_at": 1698982643,
"name": null,
"description": null,
"model": "gpt-4-turbo",
"instructions": null,
"tools": [],
"tool_resources": {},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
],
"first_id": "asst_abc123",
"last_id": "asst_abc789",
"has_more": false
}
}
建立 - 助理
POST https://{endpoint}/openai/assistants?api-version=2025-04-01-preview
使用模型和指示建立助理。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 助理的描述。 長度上限為 512 個字元。 |
No | |
| instructions | 字串 | 助理所使用的系統指示。 長度上限為 256,000 個字元。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | Yes | ||
| name | 字串 | 助理的名稱。 最大長度為 256 個字元。 |
No | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此助理的向量存放區。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| └─ 向量存儲 | 陣列 | 一個協助程式,用來建立具有 file_ids 的向量存放區,並將其附加至此助理。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 在助理上啟用的工具清單。 每個助理最多可以有 128 個工具。 工具可以屬於 code_interpreter、retrieval 或 function 類型。 |
No | [] |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | assistantObject |
Examples
Example
使用模型和指示建立助理。
POST https://{endpoint}/openai/assistants?api-version=2025-04-01-preview
{
"name": "Math Tutor",
"instructions": "When a customer asks about a specific math problem, use Python to evaluate their query.",
"tools": [
{
"type": "code_interpreter"
}
],
"model": "gpt-4-1106-preview"
}
回應:狀態碼:200
{
"body": {
"id": "asst_4nsG2qgNzimRPE7MazXTXbU7",
"object": "assistant",
"created_at": 1707295707,
"name": "Math Tutor",
"description": null,
"model": "gpt-4-1106-preview",
"instructions": "When a customer asks about a specific math problem, use Python to evaluate their query.",
"tools": [
{
"type": "code_interpreter"
}
],
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
}
取得 - 助理
GET https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
擷取助理。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| assistant_id | 路徑 | Yes | 字串 | 要擷取的助理識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | assistantObject |
Examples
Example
擷取助理。
GET https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "asst_abc123",
"object": "assistant",
"created_at": 1699009709,
"name": "HR Helper",
"description": null,
"model": "gpt-4-turbo",
"instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies.",
"tools": [
{
"type": "file_search"
}
],
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
}
修改 - 助理
POST https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
修改助理。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| assistant_id | 路徑 | Yes | 字串 | 待修改助理的識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 助理的描述。 長度上限為 512 個字元。 |
No | |
| instructions | 字串 | 助理所使用的系統指示。 長度上限為 32768 個字元。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | No | ||
| name | 字串 | 助理的名稱。 最大長度為 256 個字元。 |
No | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 覆寫可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 覆寫附加至此助理的向量存放區。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 在助理上啟用的工具清單。 每個助理最多可以有 128 個工具。 工具可以屬於 code_interpreter、retrieval 或 function 類型。 |
No | [] |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | assistantObject |
Examples
Example
修改助理。
POST https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
{
"instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",
"tools": [
{
"type": "file_search"
}
],
"model": "gpt-4-turbo"
}
回應:狀態碼:200
{
"body": {
"id": "asst_123",
"object": "assistant",
"created_at": 1699009709,
"name": "HR Helper",
"description": null,
"model": "gpt-4-turbo",
"instructions": "You are an HR bot, and you have access to files to answer employee questions about company policies. Always response with info from either of the files.",
"tools": [
{
"type": "file_search"
}
],
"tool_resources": {
"file_search": {
"vector_store_ids": []
}
},
"metadata": {},
"top_p": 1.0,
"temperature": 1.0,
"response_format": "auto"
}
}
刪除 - 助理
DELETE https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
刪除助理。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| assistant_id | 路徑 | Yes | 字串 | 要刪除之助理的標識碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | deleteAssistantResponse |
Examples
Example
刪除助理。
DELETE https://{endpoint}/openai/assistants/{assistant_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "asst_4nsG2qgNzimRPE7MazXTXbU7",
"object": "assistant.deleted",
"deleted": true
}
}
建立 - 執行緒
POST https://{endpoint}/openai/threads?api-version=2025-04-01-preview
建立執行緒。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| messages | 陣列 | 要啟動線程的訊息清單。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| tool_resources | 物件 | 可供此執行緒中的助理工具使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此執行緒的向量存放區。 最多可以有 1 個向量存放區附加至執行緒。 |
No | |
| └─ 向量存儲 | 陣列 | 一個協助程式,用來建立具有 file_ids 的向量存放區,並將其附加至此執行緒。 最多可以有 1 個向量存放區附加至執行緒。 |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | threadObject |
Examples
Example
建立執行緒。
POST https://{endpoint}/openai/threads?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"object": "thread",
"created_at": 1707297136,
"metadata": {}
}
}
取得 - 執行緒
GET https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
擷取執行緒。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 要擷取的線程識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | threadObject |
Examples
Example
擷取執行緒。
GET https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"object": "thread",
"created_at": 1707297136,
"metadata": {},
"tool_resources": {
"code_interpreter": {
"file_ids": []
}
}
}
}
修改 - 執行緒
POST https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
修改執行緒。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 要修改之線程的標識碼。 只有metadata可以變更。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| tool_resources | 物件 | 可供此執行緒中的助理工具使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此執行緒的向量存放區。 最多可以有 1 個向量存放區附加至執行緒。 |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | threadObject |
Examples
Example
修改執行緒。
POST https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
{
"metadata": {
"modified": "true",
"user": "abc123"
}
}
回應:狀態碼:200
{
"body": {
"id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"object": "thread",
"created_at": 1707297136,
"metadata": {
"modified": "true",
"user": "abc123"
},
"tool_resources": {}
}
}
刪除 - 執行緒
DELETE https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
刪除執行緒。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 要刪除之執行緒的識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | deleteThreadResponse |
Examples
Example
刪除線程。
DELETE https://{endpoint}/openai/threads/{thread_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"object": "thread.deleted",
"deleted": true
}
}
列出 - 訊息
GET https://{endpoint}/openai/threads/{thread_id}/messages?api-version=2025-04-01-preview
傳回給定執行緒的訊息清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 訊息所屬線程的標識碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| run_id | 查詢 | No | 字串 | 依產生訊息的執行識別碼來篩選訊息。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listMessagesResponse |
Examples
Example
列出訊息
GET https://{endpoint}/openai/threads/{thread_id}/messages?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "msg_abc123",
"object": "thread.message",
"created_at": 1699016383,
"assistant_id": null,
"thread_id": "thread_abc123",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "How does AI work? Explain it in simple terms.",
"annotations": []
}
}
],
"attachments": [],
"metadata": {}
},
{
"id": "msg_abc456",
"object": "thread.message",
"created_at": 1699016383,
"assistant_id": null,
"thread_id": "thread_abc123",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "Hello, what is AI?",
"annotations": []
}
}
],
"attachments": [],
"metadata": {}
}
],
"first_id": "msg_abc123",
"last_id": "msg_abc456",
"has_more": false
}
}
建立 - 訊息
POST https://{endpoint}/openai/threads/{thread_id}/messages?api-version=2025-04-01-preview
建立訊息。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 用於創建訊息的線程標識碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| attachments | 陣列 | 附加至訊息的檔案清單,以及應新增檔案的工具。 | No | |
| 內容 | 字串 | 訊息的內容。 | Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 角色 | 字串 | 正在建立訊息的實體角色。 允許的值包括: - user:表示訊息由實際使用者所傳送,且多數情況下應用來代表使用者產生的訊息。- assistant:表示訊息由助理所產生。 使用此值,將來自助理的訊息插入對話中。 |
Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | messageObject |
Examples
Example
建立訊息。
POST https://{endpoint}/openai/threads/{thread_id}/messages?api-version=2025-04-01-preview
{
"role": "user",
"content": "What is the cube root of the sum of 12, 14, 1234, 4321, 90000, 123213541223, 443123123124, 5423324234, 234324324234, 653434534545, 200000000, 98237432984, 99999999, 99999999999, 220000000000, 3309587702? Give me the answer rounded to the nearest integer without commas or spaces."
}
回應:狀態碼:200
{
"body": {
"id": "msg_as3XIk1tpVP3hdHjWBGg3uG4",
"object": "thread.message",
"created_at": 1707298421,
"assistant_id": null,
"thread_id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "What is the cube root of the sum of 12, 14, 1234, 4321, 90000, 123213541223, 443123123124, 5423324234, 234324324234, 653434534545, 200000000, 98237432984, 99999999, 99999999999, 220000000000, 3309587702? Give me the answer rounded to the nearest integer without commas or spaces.",
"annotations": []
}
}
],
"attachments": [],
"metadata": {}
}
}
取得 - 訊息
GET https://{endpoint}/openai/threads/{thread_id}/messages/{message_id}?api-version=2025-04-01-preview
擷取訊息。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 這個訊息所屬之線程的標識碼。 |
| message_id | 路徑 | Yes | 字串 | 要擷取之訊息的識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | messageObject |
Examples
Example
擷取訊息。
GET https://{endpoint}/openai/threads/{thread_id}/messages/{message_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "msg_as3XIk1tpVP3hdHjWBGg3uG4",
"object": "thread.message",
"created_at": 1707298421,
"thread_id": "thread_v7V4csrNOxtNmgcwGg496Smx",
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "What is the cube root of the sum of 12, 14, 1234, 4321, 90000, 123213541223, 443123123124, 5423324234, 234324324234, 653434534545, 200000000, 98237432984, 99999999, 99999999999, 220000000000, 3309587702? Give me the answer rounded to the nearest integer without commas or spaces.",
"annotations": []
}
}
],
"file_ids": [],
"assistant_id": null,
"run_id": null,
"metadata": {}
}
}
修改 - 訊息
POST https://{endpoint}/openai/threads/{thread_id}/messages/{message_id}?api-version=2025-04-01-preview
修改訊息。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 這個訊息所屬線程的標識碼。 |
| message_id | 路徑 | Yes | 字串 | 要修改之訊息的識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | messageObject |
Examples
Example
修改訊息。
POST https://{endpoint}/openai/threads/{thread_id}/messages/{message_id}?api-version=2025-04-01-preview
{
"metadata": {
"modified": "true",
"user": "abc123"
}
}
回應:狀態碼:200
{
"body": {
"id": "msg_abc123",
"object": "thread.message",
"created_at": 1699017614,
"assistant_id": null,
"thread_id": "thread_abc123",
"run_id": null,
"role": "user",
"content": [
{
"type": "text",
"text": {
"value": "How does AI work? Explain it in simple terms.",
"annotations": []
}
}
],
"file_ids": [],
"metadata": {
"modified": "true",
"user": "abc123"
}
}
}
建立 - 執行緒和執行
POST https://{endpoint}/openai/threads/runs?api-version=2025-04-01-preview
在單一要求中建立執行緒並執行。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| assistant_id | 字串 | 用來執行此執行的助理識別碼。 | Yes | |
| instructions | 字串 | 覆寫助理的預設系統訊息。 這有助於修改個別執行的行為。 | No | |
| max_completion_tokens | 整數 | 在執行過程中可能使用的完成權杖數目上限。 執行會盡可能在多個執行回合中僅使用指定數目的完成語彙基元。 如果執行超過指定的完成權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| max_prompt_tokens | 整數 | 在執行過程中可能使用的提示權杖數目上限。 執行過程會在每個回合中盡量只使用指定數量的提示令牌。 如果執行超過指定的提示權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | 要用來執行此執行之模型的標識碼。 在這裡提供的值將會覆寫與助理相關聯的模型。 若未提供,則會使用與助理相關聯的模型。 | No | |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| stream_options | chatCompletionStreamOptions | 串流回應的選項。 只有當您設定 stream: true 時,才需要設定此選項。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| 執行緒 | createThreadRequest | No | ||
| tool_choice | assistantsApiToolChoiceOption | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫工具,而是會產生訊息。auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。 |
No | |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此助理之向量存放區的識別碼。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 覆寫助理可用於此執行的工具。 這有助於修改個別執行的行為。 | No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
| truncation_strategy | truncationObject | 決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
在單一要求中建立執行緒並執行。
POST https://{endpoint}/openai/threads/runs?api-version=2025-04-01-preview
{
"assistant_id": "asst_abc123",
"thread": {
"messages": [
{
"role": "user",
"content": "Explain deep learning to a 5 year old."
}
]
}
}
回應:狀態碼:200
{
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699076792,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "queued",
"started_at": null,
"expires_at": 1699077392,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"required_action": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "You are a helpful assistant.",
"tools": [],
"tool_resources": {},
"metadata": {},
"temperature": 1.0,
"top_p": 1.0,
"max_completion_tokens": null,
"max_prompt_tokens": null,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"incomplete_details": null,
"usage": null,
"response_format": "auto",
"tool_choice": "auto"
}
}
列出 - 執行
GET https://{endpoint}/openai/threads/{thread_id}/runs?api-version=2025-04-01-preview
傳回屬於執行緒的執行清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 該執行程序所屬線程的識別碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listRunsResponse |
Examples
Example
傳回屬於執行緒的執行清單。
GET https://{endpoint}/openai/threads/{thread_id}/runs?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699075072,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "completed",
"started_at": 1699075072,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699075073,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": null,
"incomplete_details": null,
"tools": [
{
"type": "code_interpreter"
}
],
"tool_resources": {
"code_interpreter": {
"file_ids": [
"file-abc123",
"file-abc456"
]
}
},
"metadata": {},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
},
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
},
{
"id": "run_abc456",
"object": "thread.run",
"created_at": 1699063290,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "completed",
"started_at": 1699063290,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699063291,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": null,
"incomplete_details": null,
"tools": [
{
"type": "code_interpreter"
}
],
"tool_resources": {
"code_interpreter": {
"file_ids": [
"file-abc123",
"file-abc456"
]
}
},
"metadata": {},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
},
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
}
],
"first_id": "run_abc123",
"last_id": "run_abc456",
"has_more": false
}
}
建立 - 執行
POST https://{endpoint}/openai/threads/{thread_id}/runs?api-version=2025-04-01-preview
建立執行。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 要執行的線程標識碼。 |
| include[] | 查詢 | No | 陣列 | 要包含在回應中的其他欄位清單。 目前唯一支援的值是 step_details.tool_calls[*].file_search.results[*].content 擷取檔案搜尋結果內容。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| additional_instructions | 字串 | 在執行的指令結尾附加其他指令。 這有助於修改個別執行的行為,而無須覆寫其他指令。 | No | |
| additional_messages | 陣列 | 在建立執行之前,將其他訊息新增至執行緒。 | No | |
| assistant_id | 字串 | 用來執行此執行的助理識別碼。 | Yes | |
| instructions | 字串 | 覆寫助理的預設系統訊息。 這有助於修改個別執行的行為。 | No | |
| max_completion_tokens | 整數 | 在執行過程中可能使用的完成權杖數目上限。 執行會盡可能在多個執行回合中僅使用指定數目的完成語彙基元。 如果執行超過指定的完成權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| max_prompt_tokens | 整數 | 在執行過程中可能使用的提示權杖數目上限。 執行過程會在每個回合中盡量只使用指定數量的提示令牌。 如果執行超過指定的提示權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | 要用來執行此執行的模型識別碼。 在這裡提供的值將會覆寫與助理相關聯的模型。 若未提供,則會使用與助理相關聯的模型。 | No | |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_choice | assistantsApiToolChoiceOption | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫工具,而是會產生訊息。auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。 |
No | |
| tools | 陣列 | 覆寫助理可用於此執行的工具。 這有助於修改個別執行的行為。 | No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
| truncation_strategy | truncationObject | 決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
建立執行。
POST https://{endpoint}/openai/threads/{thread_id}/runs?api-version=2025-04-01-preview
{
"assistant_id": "asst_abc123"
}
回應:狀態碼:200
{
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699063290,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "queued",
"started_at": 1699063290,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699063291,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": null,
"incomplete_details": null,
"tools": [
{
"type": "code_interpreter"
}
],
"metadata": {},
"usage": null,
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
}
}
取得 - 執行
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}?api-version=2025-04-01-preview
擷取執行。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 執行之線程的標識碼。 |
| run_id | 路徑 | Yes | 字串 | 要擷取的執行識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
取得執行。
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "run_HsO8tYM4K5AAMAHgK0J3om8Q",
"object": "thread.run",
"created_at": 1707303196,
"assistant_id": "asst_JtTwHk28cIocgFXZPCBxhOzl",
"thread_id": "thread_eRNwflE3ncDYak1np6MdMHJh",
"status": "completed",
"started_at": 1707303197,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1707303201,
"last_error": null,
"model": "gpt-4-1106-preview",
"instructions": "You are an AI model that empowers every person and every organization on the planet to achieve more.",
"tools": [],
"file_ids": [],
"metadata": {}
}
}
修改 - 執行
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}?api-version=2025-04-01-preview
修改執行。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 執行之線程的標識碼。 |
| run_id | 路徑 | Yes | 字串 | 要修改的執行識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
修改執行。
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}?api-version=2025-04-01-preview
{
"metadata": {
"user_id": "user_abc123"
}
}
回應:狀態碼:200
{
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699075072,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "completed",
"started_at": 1699075072,
"expires_at": null,
"cancelled_at": null,
"failed_at": null,
"completed_at": 1699075073,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": null,
"incomplete_details": null,
"tools": [
{
"type": "code_interpreter"
}
],
"tool_resources": {
"code_interpreter": {
"file_ids": [
"file-abc123",
"file-abc456"
]
}
},
"metadata": {
"user_id": "user_abc123"
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
},
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
}
}
提交 - 要執行的工具輸出
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/submit_tool_outputs?api-version=2025-04-01-preview
當執行具有 status: "requires_action",且 required_action.type 為 submit_tool_outputs 時,可使用此端點在工具呼叫全部完成後提交其輸出。 所有輸出必須在單一要求中提交。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 這個執行所屬之線程的標識碼。 |
| run_id | 路徑 | Yes | 字串 | 需要工具輸出提交的執行識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| tool_outputs | 陣列 | 要提交輸出的工具清單。 | Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
當執行具有 status: "requires_action",且 required_action.type 為 submit_tool_outputs 時,可使用此端點在工具呼叫全部完成後提交其輸出。 所有輸出必須在單一要求中提交。
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/submit_tool_outputs?api-version=2025-04-01-preview
{
"tool_outputs": [
{
"tool_call_id": "call_001",
"output": "70 degrees and sunny."
}
]
}
回應:狀態碼:200
{
"body": {
"id": "run_123",
"object": "thread.run",
"created_at": 1699075592,
"assistant_id": "asst_123",
"thread_id": "thread_123",
"status": "queued",
"started_at": 1699075592,
"expires_at": 1699076192,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": null,
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}
],
"metadata": {},
"usage": null,
"temperature": 1.0,
"top_p": 1.0,
"max_prompt_tokens": 1000,
"max_completion_tokens": 1000,
"truncation_strategy": {
"type": "auto",
"last_messages": null
},
"response_format": "auto",
"tool_choice": "auto"
}
}
取消 - 執行
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/cancel?api-version=2025-04-01-preview
取消處於 in_progress 的執行。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 這個執行所屬線程的標識碼。 |
| run_id | 路徑 | Yes | 字串 | 要取消的執行識別碼。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runObject |
Examples
Example
取消處於 in_progress 的執行。
POST https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/cancel?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "run_abc123",
"object": "thread.run",
"created_at": 1699076126,
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"status": "cancelling",
"started_at": 1699076126,
"expires_at": 1699076726,
"cancelled_at": null,
"failed_at": null,
"completed_at": null,
"last_error": null,
"model": "gpt-4-turbo",
"instructions": "You summarize books.",
"tools": [
{
"type": "file_search"
}
],
"tool_resources": {
"file_search": {
"vector_store_ids": [
"vs_123"
]
}
},
"metadata": {},
"usage": null,
"temperature": 1.0,
"top_p": 1.0,
"response_format": "auto"
}
}
列出 - 執行步驟
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/steps?api-version=2025-04-01-preview
傳回屬於某執行的執行步驟清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 執行和執行步驟所屬執行緒的識別碼。 |
| run_id | 路徑 | Yes | 字串 | 執行步驟所屬的執行識別碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| api-version | 查詢 | Yes | 字串 | |
| include[] | 查詢 | No | 陣列 | 要包含在回應中的其他欄位清單。 目前唯一支援的值是 step_details.tool_calls[*].file_search.results[*].content 擷取檔案搜尋結果內容。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listRunStepsResponse |
Examples
Example
傳回屬於某執行的執行步驟清單。
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/steps?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "step_abc123",
"object": "thread.run.step",
"created_at": 1699063291,
"run_id": "run_abc123",
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"type": "message_creation",
"status": "completed",
"cancelled_at": null,
"completed_at": 1699063291,
"expired_at": null,
"failed_at": null,
"last_error": null,
"step_details": {
"type": "message_creation",
"message_creation": {
"message_id": "msg_abc123"
}
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
}
}
],
"first_id": "step_abc123",
"last_id": "step_abc456",
"has_more": false
}
}
取得 - 執行步驟
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/steps/{step_id}?api-version=2025-04-01-preview
擷取執行步驟。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| thread_id | 路徑 | Yes | 字串 | 執行和執行步驟所屬的執行緒識別碼。 |
| run_id | 路徑 | Yes | 字串 | 執行步驟所屬的執行識別碼。 |
| step_id | 路徑 | Yes | 字串 | 要擷取的執行步驟識別碼。 |
| include[] | 查詢 | No | 陣列 | 要包含在回應中的其他欄位清單。 目前唯一支援的值是 step_details.tool_calls[*].file_search.results[*].content 擷取檔案搜尋結果內容。 |
| api-version | 查詢 | Yes | 字串 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | runStepObject |
Examples
Example
擷取執行步驟。
GET https://{endpoint}/openai/threads/{thread_id}/runs/{run_id}/steps/{step_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "step_abc123",
"object": "thread.run.step",
"created_at": 1699063291,
"run_id": "run_abc123",
"assistant_id": "asst_abc123",
"thread_id": "thread_abc123",
"type": "message_creation",
"status": "completed",
"cancelled_at": null,
"completed_at": 1699063291,
"expired_at": null,
"failed_at": null,
"last_error": null,
"step_details": {
"type": "message_creation",
"message_creation": {
"message_id": "msg_abc123"
}
},
"usage": {
"prompt_tokens": 123,
"completion_tokens": 456,
"total_tokens": 579
}
}
}
列出 - 向量存放區
GET https://{endpoint}/openai/vector_stores?api-version=2025-04-01-preview
傳回向量存放區的清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listVectorStoresResponse |
Examples
Example
傳回向量存放區的清單。
GET https://{endpoint}/openai/vector_stores?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
},
{
"id": "vs_abc456",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ v2",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
],
"first_id": "vs_abc123",
"last_id": "vs_abc456",
"has_more": false
}
}
建立 - 向量存放區
POST https://{endpoint}/openai/vector_stores?api-version=2025-04-01-preview
建立向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | autoChunkingStrategyRequestParam 或 staticChunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 僅在 file_ids 非空時適用。 |
No | |
| expires_after | vectorStoreExpirationAfter | 向量存放區的到期原則。 | No | |
| file_ids | 陣列 | 向量存放區應使用的檔案識別碼清單。 適用於 file_search 之類可存取檔案的工具。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| name | 字串 | 向量存放區的名稱。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreObject |
Examples
Example
建立向量存放區。
POST https://{endpoint}/openai/vector_stores?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
}
取得 - 向量存放區
GET https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
擷取向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 要擷取之向量存放區的標識碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreObject |
Examples
Example
擷取向量存放區。
GET https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776
}
}
修改 - 向量存放區
POST https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
修改向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 待修改的向量存放區識別碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| expires_after | vectorStoreExpirationAfter | 向量存放區的到期原則。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| name | 字串 | 向量存放區的名稱。 | No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreObject |
Examples
Example
修改向量存放區。
POST https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
{
"name": "Support FAQ"
}
回應:狀態碼:200
{
"body": {
"id": "vs_abc123",
"object": "vector_store",
"created_at": 1699061776,
"name": "Support FAQ",
"bytes": 139920,
"file_counts": {
"in_progress": 0,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 3
}
}
}
刪除 - 向量存放區
DELETE https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
刪除向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 要刪除之向量存放區的標識碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | deleteVectorStoreResponse |
Examples
Example
刪除向量存放區。
DELETE https://{endpoint}/openai/vector_stores/{vector_store_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "vs_abc123",
"object": "vector_store.deleted",
"deleted": true
}
}
列出 - 向量存放區檔案
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/files?api-version=2025-04-01-preview
傳回向量存放區檔案的清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案所屬向量存放區的標識碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| 篩選 | 查詢 | No | 字串 可能的值: in_progress、、completed、 failedcancelled |
依檔案狀態篩選。
in_progress、completed、failed、cancelled其中之一。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listVectorStoreFilesResponse |
Examples
Example
傳回向量存放區檔案的清單。
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/files?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
},
{
"id": "file-abc456",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
}
],
"first_id": "file-abc123",
"last_id": "file-abc456",
"has_more": false
}
}
建立 - 向量存放區檔案
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/files?api-version=2025-04-01-preview
將檔案附加至向量存放區,以建立向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 待建立檔案的向量存放區識別碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | chunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 |
No | |
| file_id | 字串 | 向量存放區應使用的檔案識別碼。 適用於 file_search 之類可存取檔案的工具。 |
Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileObject |
Examples
Example
將檔案附加至向量存放區,以建立向量存放區。
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/files?api-version=2025-04-01-preview
{
"file_id": "file-abc123"
}
回應:狀態碼:200
{
"body": {
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"usage_bytes": 1234,
"vector_store_id": "vs_abcd",
"status": "completed",
"last_error": null
}
}
取得 - 向量存放區檔案
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}?api-version=2025-04-01-preview
擷取向量存放區檔案。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案所屬向量存放區的標識碼。 |
| file_id | 路徑 | Yes | 字串 | 正在擷取之檔案的標識碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileObject |
Examples
Example
擷取向量存放區檔案。
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abcd",
"status": "completed",
"last_error": null
}
}
刪除 - 向量存放區檔案
DELETE https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}?api-version=2025-04-01-preview
刪除向量存放區檔案。 這會從向量存放區中移除檔案,但不會刪除檔案本身。 若要刪除檔案,請使用刪除檔案端點。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案所屬向量存放區的標識碼。 |
| file_id | 路徑 | Yes | 字串 | 要刪除之檔案的標識碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | deleteVectorStoreFileResponse |
Examples
Example
刪除向量存放區檔案。 這會從向量存放區中移除檔案,但不會刪除檔案本身。 若要刪除檔案,請使用刪除檔案端點。
DELETE https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "file_abc123",
"object": "vector_store.file.deleted",
"deleted": true
}
}
Updatevectorstorefileattributes
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}?api-version=2025-04-01-preview
更新向量存放區檔案上的屬性。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案所屬向量存放區的標識碼。 |
| file_id | 路徑 | Yes | 字串 | 用於更新屬性的檔案ID。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| attributes | VectorStoreFileAttributes | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元、布爾值或數位的字串。 |
Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileObject |
擷取向量存放區檔案內容
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/files/{file_id}/content?api-version=2025-04-01-preview
擷取向量儲存庫檔案的解析內容。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 向量存放區的標識碼。 |
| file_id | 路徑 | Yes | 字串 | 向量存放區內的檔案識別碼。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | VectorStoreFileContentResponse |
搜尋向量存放區
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/search?api-version=2025-04-01-preview
根據查詢和檔案屬性篩選來搜尋相關區塊的向量存放區。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 要搜尋之向量存放區的標識碼。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filters | ComparisonFilter 或 CompoundFilter | 根據檔案屬性來套用的過濾器。 | No | |
| max_num_results | 整數 | 要傳回的結果數目上限。 此數字應介於 1 到 50 之間。 | No | 10 |
| 查詢 | 字串或陣列 | 搜尋的查詢字串 | Yes | |
| ranking_options | 物件 | 搜尋的排名選項。 | No | |
| └─ ranker | 列舉 | 可能的值: auto、 default-2024-11-15 |
No | |
| └─ score_threshold | number | No | 0 | |
| rewrite_query | boolean | 是否要重寫向量搜尋的自然語言查詢。 | No | False |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | VectorStoreSearchResultsPage |
建立 - 向量存放區檔案批次
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches?api-version=2025-04-01-preview
建立向量存放區檔案批次。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 待建立檔案批次的向量存放區識別碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | chunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 |
No | |
| file_ids | 陣列 | 向量存放區應使用的檔案識別碼清單。 適用於 file_search 之類可存取檔案的工具。 |
Yes |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileBatchObject |
Examples
Example
建立向量存放區檔案批次。
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches?api-version=2025-04-01-preview
{
"file_ids": [
"file-abc123",
"file-abc456"
]
}
回應:狀態碼:200
{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 1,
"completed": 1,
"failed": 0,
"cancelled": 0,
"total": 0
}
}
取得 - 向量存放區檔案批次
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}?api-version=2025-04-01-preview
擷取向量存放區檔案批次。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案批次所屬向量存放區的標識碼。 |
| batch_id | 路徑 | Yes | 字串 | 正在擷取之檔案批次的識別碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileBatchObject |
Examples
Example
擷取向量存放區檔案批次。
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 1,
"completed": 1,
"failed": 0,
"cancelled": 0,
"total": 0
}
}
}
取消 - 向量存放區檔案批次
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel?api-version=2025-04-01-preview
取消向量存放區檔案批次。 這會嘗試盡快取消處理此批次中的檔案。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案批次所屬向量存放區的標識碼。 |
| batch_id | 路徑 | Yes | 字串 | 要取消之檔案批次的標識碼。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | vectorStoreFileBatchObject |
Examples
Example
取消向量存放區檔案批次。 這會嘗試盡快取消處理此批次中的檔案。
POST https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1699061776,
"vector_store_id": "vs_abc123",
"status": "cancelling",
"file_counts": {
"in_progress": 12,
"completed": 3,
"failed": 0,
"cancelled": 0,
"total": 15
}
}
}
列出 - 向量存放區檔案批次檔案
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}/files?api-version=2025-04-01-preview
傳回批次中的向量存放區檔案清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| vector_store_id | 路徑 | Yes | 字串 | 檔案所屬向量存放區的標識碼。 |
| batch_id | 路徑 | Yes | 字串 | 檔案所屬檔案批次的標識碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
依 created_at 物件的時間戳排序順序。
asc 表示遞增順序和 desc 遞減順序。 |
| after | 查詢 | No | 字串 | 用於分頁的游標。
after 是在清單中定義您的位置的物件識別碼。 例如,如果您提出清單要求並收到 100 個物件 (結尾為 obj_foo),則後續呼叫可以包含 after=obj_foo 來擷取清單的下一頁。 |
| before | 查詢 | No | 字串 | 用於分頁的游標。
before 是在清單中定義您的位置的物件識別碼。 例如,如果您提出列表請求並收到 100 個物件,並以 obj_foo 開始,您可以在後續呼叫中包含 before=obj_foo,以便擷取列表的上一頁。 |
| 篩選 | 查詢 | No | 字串 可能的值: in_progress、、completed、 failedcancelled |
依檔案狀態篩選。
in_progress、completed、failed、cancelled其中之一。 |
| api-version | 查詢 | Yes | 字串 | API 版本 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | listVectorStoreFilesResponse |
Examples
Example
傳回向量存放區檔案的清單。
GET https://{endpoint}/openai/vector_stores/{vector_store_id}/file_batches/{batch_id}/files?api-version=2025-04-01-preview
回應:狀態碼:200
{
"body": {
"object": "list",
"data": [
{
"id": "file-abc123",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
},
{
"id": "file-abc456",
"object": "vector_store.file",
"created_at": 1699061776,
"vector_store_id": "vs_abc123"
}
],
"first_id": "file-abc123",
"last_id": "file-abc456",
"has_more": false
}
}
建立 - Realtimesession
POST https://{endpoint}/openai/realtimeapi/sessions?api-version=2025-04-01-preview
建立暫時 API 令牌,以搭配即時 API 在用戶端應用程式中使用。 可以配置與 session.update 用戶端事件相同的會話參數。
用於回應工作階段物件,加上包含可用暫時性 API 權杖的 client_secret 金鑰,可用來驗證即時 API 的瀏覽器用戶端。
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| input_audio_format | 列舉 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸入音訊必須是 16 位元 PCM、取樣速率為 24kHz、單通道 (mono),以及由小到大的位元組順序。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| input_audio_noise_reduction | 物件 | 輸入音訊雜訊減少的設定。 這可設定為 null 以關閉。雜訊減少會先篩選新增至輸入音訊緩衝區的音訊,再將其傳送至 VAD 和模型。 篩選音訊可以改善 VAD 和回合偵測精確度(減少誤判)和模型效能,方法是改善對輸入音訊的感知。 |
No | |
| \---- 類型 | 列舉 | 減少雜訊的類型。
near_field 適用於耳機麥克風等近距離麥克風,far_field 適用於遠場麥克風,例如筆記型電腦或會議室麥克風。可能的值: near_field、 far_field |
No | |
| input_audio_transcription | 物件 | 輸入音訊轉譯的設定,預設為關閉,且可設定為 null 關閉一次。 輸入音訊轉譯不是模型的原生,因為模型會直接取用音訊。 轉錄會透過 轉錄端點 以異步方式執行,應被視為輸入音訊內容的參考,而非模型準確聽到的內容。 用戶端可以選擇性地設定語言和提示進行轉譯,這些會為轉譯服務提供額外的指引。 |
No | |
| └─ 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式 en提供輸入語言可改善精確度和延遲。 |
No | |
| └─ model | 字串 | 用於轉錄的模型,目前的選項有 gpt-4o-transcribe、 gpt-4o-transcribe-diarize、 gpt-4o-mini-transcribegpt-4o-mini-transcribe-2025-12-15whisper-1、 和 。 |
No | |
| └─ 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 針對 whisper-1,提示是關鍵詞清單。針對 gpt-4o-transcribe 模型,提示是自由文字字串,例如「預期出現與技術相關的詞語」。 |
No | |
| instructions | 字串 | 加在模型呼叫前面的預設系統指示 (亦即系統訊息)。 此欄位可讓客戶端引導模型以取得所需的回應。 模型可以指示回應內容和格式(例如“非常簡潔”、“行為友好”、“以下是良好的回應範例”)和音訊行為(例如,“快速說話”、“插入情感到您的聲音”、“經常笑”)。 模型不保證遵循這些指示,但這些指示為模型提供了實現期望行為的指引。 請注意,如果未設定此欄位,伺服器將使用預設指示,並且這些指示會在會話開始時顯示於 session.created 事件中。 |
No | |
| max_response_output_tokens | 整數或字串 | 單一助理回應的輸出權杖數目上限,包含工具呼叫。 提供介於 1 到 4096 之間的整數來限制輸出標記,或使用 inf 來指定該模型的最大可用標記數。 預設為 inf。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| 型號 | 字串 | 用於此工作階段的部署名稱。 |
No | |
| output_audio_format | 列舉 | 輸出音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸出音訊的取樣速率為 24kHz。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| temperature | number | 模型的取樣溫度限制為 [0.6, 1.2]。 對於音訊模型,強烈建議溫度為 0.8,以獲得最佳效能。 |
No | 0.8 |
| tool_choice | 字串 | 模型選擇工具的方式。 選項為 auto、 none、 required或 指定函式。 |
No | auto |
| tools | 陣列 | 模型可用的工具 (函式)。 | No | |
| turn_detection | 物件 | 回合偵測、乙太伺服器 VAD 或語意 VAD 的設定。 這可以設定為 null 關閉,在此情況下,客戶端必須手動觸發模型回應。伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 語意 VAD 更進階,並使用回合偵測模型(結合 VAD)來語意估計使用者是否已完成說話,然後根據這個機率動態設定逾時。 例如,如果使用者音訊以 uhhm 結尾,模型會認為回合結束的機率較低,並等待更長時間讓使用者繼續說話。 這對於更自然的對話很有用,但延遲可能較高。 |
No | |
| └─ create_response (建立回應) | boolean | 是否要在發生 VAD 停止事件時自動產生回應。 |
No | True |
| └─ 渴望 | 列舉 | 僅適用於 semantic_vad 模式。 模型回應的積極程度。
low 會等候較長的時間讓用戶繼續說話, high 將會更快回應。
auto 是預設值,相當於 medium。可能的值: low、、medium、 highauto |
No | |
| └─ 中斷響應 | boolean | 當發生 VAD 啟動事件時,是否要自動中斷任何正在進行的回應,並輸出到預設的對話(例如 conversation 和 auto) 。 |
No | True |
| └─ prefix_padding_ms | 整數 | 僅適用於 server_vad 模式。 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 僅適用於 server_vad 模式。 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | 僅適用於 server_vad 模式。 VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 列舉 | 回合偵測的類型。 可能的值: server_vad、 semantic_vad |
No | |
| voice | VoiceIdsShared | No |
Responses
狀態碼:200
描述:已成功建立會話。
| Content-Type | Type | Description |
|---|---|---|
| application/json | RealtimeSessionCreateResponse |
建立 - Transcriptionrealtimesession
POST https://{endpoint}/openai/realtimeapi/transcription_sessions?api-version=2025-04-01-preview
建立短暫有效的 API 令牌,專門用於在用戶端應用程式中搭配即時 API 實現即時轉譯。
可以配置與 transcription_session.update 用戶端事件相同的會話參數。
用於回應工作階段物件,加上包含可用暫時性 API 權杖的 client_secret 金鑰,可用來驗證即時 API 的瀏覽器用戶端。
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| include | 陣列 | 要包含在謄寫中的項目集。 目前可用的專案如下: - item.input_audio_transcription.logprobs |
No | |
| input_audio_format | 列舉 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸入音訊必須是 16 位元 PCM、取樣速率為 24kHz、單通道 (mono),以及由小到大的位元組順序。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| input_audio_noise_reduction | 物件 | 輸入音訊雜訊減少的設定。 這可設定為 null 以關閉。雜訊減少會先篩選新增至輸入音訊緩衝區的音訊,再將其傳送至 VAD 和模型。 篩選音訊可以改善 VAD 和回合偵測精確度(減少誤判)和模型效能,方法是改善對輸入音訊的感知。 |
No | |
| \---- 類型 | 列舉 | 減少雜訊的類型。
near_field 適用於耳機麥克風等近距離麥克風,far_field 適用於遠場麥克風,例如筆記型電腦或會議室麥克風。可能的值: near_field、 far_field |
No | |
| input_audio_transcription | 物件 | 輸入音訊轉譯的組態。 用戶端可以選擇性地設定語言和提示進行轉譯,這些會為轉譯服務提供額外的指引。 |
No | |
| └─ 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式 en提供輸入語言可改善精確度和延遲。 |
No | |
| └─ model | 列舉 | 用於轉錄的模型,目前選項為 gpt-4o-transcribe、 gpt-4o-mini-transcribe、 gpt-4o-mini-transcribe-2025-12-15和 whisper-1。可能的值: gpt-4o-transcribe、、gpt-4o-mini-transcribe、 gpt-4o-mini-transcribe-2025-12-15whisper-1 |
No | |
| └─ 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 針對 whisper-1,提示是關鍵詞清單。針對 gpt-4o-transcribe 模型,提示是自由文字字串,例如「預期出現與技術相關的詞語」。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| turn_detection | 物件 | 回合偵測、乙太伺服器 VAD 或語意 VAD 的設定。 這可以設定為 null 關閉,在此情況下,客戶端必須手動觸發模型回應。伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 語意 VAD 更進階,並使用回合偵測模型(結合 VAD)來語意估計使用者是否已完成說話,然後根據這個機率動態設定逾時。 例如,如果使用者音訊以 uhhm 結尾,模型會認為回合結束的機率較低,並等待更長時間讓使用者繼續說話。 這對於更自然的對話很有用,但延遲可能較高。 |
No | |
| └─ create_response (建立回應) | boolean | 是否要在發生 VAD 停止事件時自動產生回應。 不適用於謄寫工作階段。 |
No | True |
| └─ 渴望 | 列舉 | 僅適用於 semantic_vad 模式。 模型回應的積極程度。
low 會等候較長的時間讓用戶繼續說話, high 將會更快回應。
auto 是預設值,相當於 medium。可能的值: low、、medium、 highauto |
No | |
| └─ 中斷響應 | boolean | 當發生 VAD 啟動事件時,是否要自動中斷任何正在進行的回應,並輸出到預設的對話(例如 conversation 和 auto) 。 不適用於謄寫工作階段。 |
No | True |
| └─ prefix_padding_ms | 整數 | 僅適用於 server_vad 模式。 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 僅適用於 server_vad 模式。 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | 僅適用於 server_vad 模式。 VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 列舉 | 回合偵測的類型。 可能的值: server_vad、 semantic_vad |
No |
Responses
狀態碼:200
描述:已成功建立會話。
| Content-Type | Type | Description |
|---|---|---|
| application/json | RealtimeTranscriptionSessionCreateResponse |
Responses
POST https://{endpoint}/openai/responses?api-version=2025-04-01-preview
建立模型回應。
請求主體
Content-Type:application/json
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| include | 陣列 | No | ||
| 輸入 | 字串或陣列 | 模型輸入 | Yes | |
| instructions | 字串 | 將系統訊息或開發人員訊息插入至模型上下文的第一個項目。 搭配 previous_response_id使用 時,將不會將先前回應的指示傳遞至下一個回應。 這可讓您輕鬆地在新回應中交換系統(或開發人員)訊息。 |
No | |
| max_output_tokens | 整數 | 可針對響應產生的令牌數目的上限,包括可見的輸出令牌和對話狀態。 |
No | |
| parallel_tool_calls | boolean | 是否允許模型平行執行工具呼叫。 |
No | True |
| previous_response_id | 字串 | 先前回應模型的唯一識別碼。 使用這個功能來建立多輪對話。 深入瞭解交談狀態。 |
No | |
| reasoning | Reasoning | 推理模型的組態選項。 | No | |
| 儲存 | boolean | 是否要儲存產生的模型回應,以便稍後透過 API 擷取。 |
No | True |
| 串流 | boolean | 如果設定為 true,模型響應資料將會隨著使用 伺服器傳送的事件產生而串流至用戶端。 如需詳細資訊,請參閱下方的串流一節。 |
No | False |
| 收發簡訊 | 物件 | 來自模型的文字回應組態選項。 可以是純文字或結構化 JSON 數據。 瞭解詳情: - 文字輸入和輸出 - 結構化輸出 |
No | |
| └─ 格式 | TextResponseFormatConfiguration | 物件,指定模型必須輸出的格式。{ "type": "json_schema" }設定會啟用結構化輸出,以確保模型符合您提供的 JSON 架構。預設格式為 { "type": "text" },且沒有其他選項。不建議使用 gpt-4o 和較新的模型: 設定為 { "type": "json_object" } 可啟用較舊的 JSON 模式,以確保模型產生的訊息為有效的 JSON。 對於支援 json_schema 的模型,建議使用該選項。 |
No | |
| tool_choice | ToolChoiceOptions 或 ToolChoiceTypes 或 ToolChoiceFunction | 模型應該如何選取產生回應時要使用的工具(或工具)。
tools請參閱 參數,以瞭解如何指定模型可以呼叫的工具。 |
No | |
| tools | 陣列 | 模型可能會在產生回應時呼叫的工具陣列。 您可以藉由設定 tool_choice 參數來指定要使用的工具。您可以提供模型的兩種工具類別如下: - 內建工具:OpenAI 所提供的工具,可擴充 模型的功能 |
No | |
| truncation | 列舉 | 用於模型回應的截斷策略。 - auto:如果此回應的內容和先前的內容超過模型的內容視窗大小,模型會藉由移除交談中間的輸入項目來調整回應,使其符合內容視窗。 - disabled (預設值):如果模型響應超過模型的內容視窗大小,要求將會失敗,並出現 400 錯誤。可能的值: auto、 disabled |
No |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | response | |
| text/event-stream | responseStreamEvent |
狀態碼:預設值
描述:服務無法使用
| Content-Type | Type | Description |
|---|---|---|
| application/json | errorResponse |
回應應用程式介面 - 輸入項目
GET https://{endpoint}/openai/responses/{response_id}?api-version=2025-04-01-preview
擷取具有指定標識碼的模型回應。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| response_id | 路徑 | Yes | 字串 | 要擷取的回應的識別碼。 |
| include | 查詢 | No | 陣列 | 要包含在回應中的其他欄位。 如需更多資訊,請參閱上述建立回應的 include 參數。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | response |
狀態碼:預設值
描述:服務無法使用
| Content-Type | Type | Description |
|---|---|---|
| application/json | errorResponse |
刪除回應
DELETE https://{endpoint}/openai/responses/{response_id}?api-version=2025-04-01-preview
刪除具有指定標識碼的模型回應。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| response_id | 路徑 | Yes | 字串 | 要刪除的回應識別碼。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
狀態代碼: 404
描述:找不到
| Content-Type | Type | Description |
|---|---|---|
| application/json | error |
狀態碼:預設值
描述:服務無法使用
| Content-Type | Type | Description |
|---|---|---|
| application/json | errorResponse |
回應 API - 回應項目清單
GET https://{endpoint}/openai/responses/{response_id}/input_items?api-version=2025-04-01-preview
傳回指定回應的輸入項目清單。
URI 參數
| Name | In | Required | 類型 | Description |
|---|---|---|---|---|
| 端點 | 路徑 | Yes | 字串網址 | 支援的 Azure OpenAI 端點 (通訊協定和主機名稱,例如:https://aoairesource.openai.azure.com。以您的 Azure OpenAI 資源名稱取代「aoairesource」)。 https://{your-resource-name}.openai.azure.com |
| response_id | 路徑 | Yes | 字串 | 要擷取輸入項目的回應識別碼。 |
| limit | 查詢 | No | 整數 | 要傳回的物件數目限制。 限制的範圍可以介於 1 到 100 之間,預設值為 20。 |
| 順序 | 查詢 | No | 字串 可能的值: asc、 desc |
傳回輸入項目的順序。 預設值為 asc。- asc:以遞增順序回傳輸入項目。- desc:以遞減順序回傳輸入項目。 |
| after | 查詢 | No | 字串 | 用於分頁的項目識別碼,列出之後的項目。 |
| before | 查詢 | No | 字串 | 用於分頁的項目識別碼,列出之前的項目。 |
請求標頭
使用令牌型驗證或 API 金鑰。 建議使用令牌型驗證進行驗證,且更安全。
| Name | Required | 類型 | Description |
|---|---|---|---|
| Authorization | True | 字串 |
範例:Authorization: Bearer {Azure_OpenAI_Auth_Token}若要使用 Azure CLI 產生驗證權杖: az account get-access-token --resource https://cognitiveservices.azure.com類型:oauth2 授權 URL: https://login.microsoftonline.com/common/oauth2/v2.0/authorize範圍: https://cognitiveservices.azure.com/.default |
| api-key | True | 字串 | 在這裡提供 Azure OpenAI API 金鑰 |
Responses
狀態碼:200
描述:確定
| Content-Type | Type | Description |
|---|---|---|
| application/json | responseItemList |
Components
errorResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 錯誤 | error | No |
errorBase
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | 字串 | No | ||
| 訊息 | 字串 | No |
錯誤
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| inner_error | innerError | 具有其他詳細資料的內部錯誤。 | No | |
| param | 字串 | No | ||
| 型別 | 字串 | No |
innerError
具有其他詳細資料的內部錯誤。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | innerErrorCode | 內部錯誤物件的錯誤碼。 | No | |
| content_filter_results | contentFilterPromptResults | 有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。 | No |
innerErrorCode
內部錯誤物件的錯誤碼。
| Property | Value |
|---|---|
| Description | 內部錯誤物件的錯誤碼。 |
| Type | 字串 |
| Values | ResponsibleAIPolicyViolation |
dalleErrorResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 錯誤 | dalleError | No |
dalleError
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| inner_error | dalleInnerError | 具有其他詳細資料的內部錯誤。 | No | |
| param | 字串 | No | ||
| 型別 | 字串 | No |
dalleInnerError
具有其他詳細資料的內部錯誤。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | innerErrorCode | 內部錯誤物件的錯誤碼。 | No | |
| content_filter_results | dalleFilterResults | 有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。 | No | |
| revised_prompt | 字串 | 用來產生影像的提示 (如果提示有任何修訂)。 | No |
contentFilterCompletionTextSpan
描述所產生完成文字內的範圍。 位移 0 是完成文字的第一個 UTF32 字碼指標。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| completion_end_offset | 整數 | 從範圍排除的第一個 UTF32 字碼指標。 此欄位一律等於空白範圍的 completion_start_offset。 此欄位一律大於非空白範圍的 completion_start_offset。 | Yes | |
| completion_start_offset | 整數 | 範圍啟始 UTF32 字碼指標的位移。 | Yes |
contentFilterResultBase
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filtered | boolean | Yes |
contentFilterSeverityResult
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filtered | boolean | Yes | ||
| severity | 字串 | No |
contentFilterDetectedResult
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| detected | boolean | No | ||
| filtered | boolean | Yes |
contentFilterDetectedWithCitationResult
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| citation | 物件 | No | ||
| └─ 網址 | 字串 | No | ||
| \---- 授權 | 字串 | No |
contentFilterDetectedWithCompletionTextSpansResult
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| details | 陣列 | No |
contentFilterIdResult
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filtered | boolean | Yes | ||
| id | 字串 | No |
contentFilterResultsBase
內容篩選結果的相關資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| custom_blocklists | contentFilterDetailedResults | 內容篩選結果,其中包含已篩選區段的內容篩選識別碼詳細資料。 | No | |
| 錯誤 | errorBase | No | ||
| hate | contentFilterSeverityResult | No | ||
| profanity | contentFilterDetectedResult | No | ||
| self_harm | contentFilterSeverityResult | No | ||
| sexual | contentFilterSeverityResult | No | ||
| violence | contentFilterSeverityResult | No |
contentFilterPromptResults
有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| custom_blocklists | contentFilterDetailedResults | 內容篩選結果,其中包含已篩選區段的內容篩選識別碼詳細資料。 | No | |
| 錯誤 | errorBase | No | ||
| hate | contentFilterSeverityResult | No | ||
| indirect_attack | contentFilterDetectedResult | No | ||
| jailbreak | contentFilterDetectedResult | No | ||
| profanity | contentFilterDetectedResult | No | ||
| self_harm | contentFilterSeverityResult | No | ||
| sexual | contentFilterSeverityResult | No | ||
| violence | contentFilterSeverityResult | No |
contentFilterChoiceResults
有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關第三方文字和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| custom_blocklists | contentFilterDetailedResults | 內容篩選結果,其中包含已篩選區段的內容篩選識別碼詳細資料。 | No | |
| 錯誤 | errorBase | No | ||
| hate | contentFilterSeverityResult | No | ||
| profanity | contentFilterDetectedResult | No | ||
| protected_material_code | contentFilterDetectedWithCitationResult | No | ||
| protected_material_text | contentFilterDetectedResult | No | ||
| self_harm | contentFilterSeverityResult | No | ||
| sexual | contentFilterSeverityResult | No | ||
| ungrounded_material | contentFilterDetectedWithCompletionTextSpansResult | No | ||
| violence | contentFilterSeverityResult | No |
contentFilterDetailedResults
內容篩選結果,其中包含已篩選區段的內容篩選識別碼詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| details | 陣列 | No | ||
| filtered | boolean | Yes |
promptFilterResult
要求中單一提示的內容篩選結果。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_filter_results | contentFilterPromptResults | 有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。 | No | |
| prompt_index | 整數 | No |
promptFilterResults
要求中零個或多個提示的內容篩選結果。 在串流要求中,不同提示的結果可能會在不同時間或依不同的順序抵達。
未定義此元件的屬性。
dalleContentFilterResults
內容篩選結果的相關資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| hate | contentFilterSeverityResult | No | ||
| self_harm | contentFilterSeverityResult | No | ||
| sexual | contentFilterSeverityResult | No | ||
| violence | contentFilterSeverityResult | No |
dalleFilterResults
有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| custom_blocklists | contentFilterDetailedResults | 內容篩選結果,其中包含已篩選區段的內容篩選識別碼詳細資料。 | No | |
| hate | contentFilterSeverityResult | No | ||
| jailbreak | contentFilterDetectedResult | No | ||
| profanity | contentFilterDetectedResult | No | ||
| self_harm | contentFilterSeverityResult | No | ||
| sexual | contentFilterSeverityResult | No | ||
| violence | contentFilterSeverityResult | No |
chatCompletionsRequestCommon
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| frequency_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止在文字中的出現頻率來打壓新權杖,降低模型重複完全相同行的可能性。 | No | 0 |
| logit_bias | 物件 | 修改在完成時出現指定權杖的可能性。 接受 json 物件,此物件會將權杖 (由權杖化工具中的權杖識別碼所指定) 對應至 -100 到 100 的相關偏差值。 在數學上,偏差會先加到模型產生的對數,再取樣。 確切的效果會因模型而異,但介於 -1 到 1 之間的值應該會降低或提高選取的可能性;而 -100 或 100 之類的值應會導致禁止選取或獨佔選取相關權杖。 | No | |
| max_completion_tokens | 整數 | 可針對完成產生的語彙基元數目上限,包括可見的輸出語彙基元和推理語彙基元。 | No | |
| max_tokens | 整數 | 所產生答案允許的權杖數目上限。 根據預設,模型可傳回的權杖數目會是 (4096 - 提示權杖)。 這與 o1 系列模型不相容。 | No | 4096 |
| 中繼資料 | 物件 | 開發人員定義的標籤和值,用於篩選儲存完成結果儀表板中的完成項目。 | No | |
| presence_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止是否出現在文字中來打壓新權杖,提高模型討論新主題的可能性。 | No | 0 |
| stop | 字串或陣列 | 最多 4 個序列,API 將在每個序列中停止產生更多的令牌。 | No | |
| 儲存 | boolean | 是否要儲存此聊天完成要求的輸出,以用於我們的模型擷取或評估產品。 | No | |
| 串流 | boolean | 如果設定,則會傳送部分訊息差異,就像在 ChatGPT 中一樣。 當語彙基元可用時,它們會作為僅含資料的伺服器傳送事件來傳送,並由 data: [DONE] 訊息來終止串流。 |
No | False |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助 Azure OpenAI 監視和偵測濫用。 | No |
createCompletionRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| best_of | 整數 | 產生 best_of 完成伺服器端,並傳回「最佳」項目 (具有每個語彙基元最高對數機率的項目)。 結果不能串流。搭配 n使用 時, best_of 會控制候選完成的數目,並 n 指定要傳回多少。
best_of 必須大於 n。注意:因為此參數會產生許多完成項,所以會快速消耗語彙基元配額。 請謹慎使用並確保您對 max_tokens 和 stop 設定合理。 |
No | 1 |
| echo | boolean | 回應完成以外的提示 |
No | False |
| frequency_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止在文字中的出現頻率來打壓新權杖,降低模型重複完全相同行的可能性。 |
No | 0 |
| logit_bias | 物件 | 修改在完成時出現指定權杖的可能性。 接受 JSON 物件,此物件會將語彙基元 (由 GPT 語彙基元化工具中的語彙基元識別碼所指定) 對應至 -100 到 100 的相關偏差值。 在數學上,偏差會先加到模型產生的對數,再取樣。 確切的效果會因模型而異,但介於 -1 到 1 之間的值應該會降低或提高選取的可能性;而 -100 或 100 之類的值應會導致禁止選取或獨佔選取相關權杖。 例如,您可以傳遞 {"50256": -100} 以防止產生 <|endoftext|> 語彙基元。 |
No | None |
| logprobs | 整數 | 包括 logprobs 個最可能的輸出語彙基元以及所選語彙基元的對數機率。 例如,如果 logprobs 為 5,則 API 將傳回 5 個最可能的語彙基元的清單。 API 將始終傳回取樣語彙基元的 logprob,因此回應中最多可能有 logprobs+1 個元素。logprobs 的最大值為 5。 |
No | None |
| max_tokens | 整數 | 完成時可以產生的最大令牌數目。 提示的權杖計數加上 max_tokens 不能超過模型的內容長度。 |
No | 16 |
| n | 整數 | 每個提示要產生的完成項數量。 注意:因為此參數會產生許多完成項,所以會快速消耗語彙基元配額。 請謹慎使用並確保您對 max_tokens 和 stop 設定合理。 |
No | 1 |
| presence_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止是否出現在文字中來打壓新權杖,提高模型討論新主題的可能性。 |
No | 0 |
| 提示 | 字串或陣列 | 產生完成的提示,編碼為字串、字串陣列、語彙基元陣列或語彙基元陣列的陣列。 請注意,<|endoftext|> 是模型在訓練期間看到的文件分隔符號,因此,若未指定提示,模型就會像是從新文件開始一樣產生。 |
Yes | |
| seed | 整數 | 如果有指定,我們的系統會盡最大努力以決定性方式取樣,讓具有相同 seed 和參數的要求能夠重複傳回相同的結果。不保證決定性,且您應參照 system_fingerprint 回應參數來監視後端的變更。 |
No | |
| stop | 字串或陣列 | 最多 4 個序列,API 將在每個序列中停止產生更多的令牌。 傳回的文字不會包含停止序列。 |
No | |
| 串流 | boolean | 是否要串流回部分進度。 如果已設定,token 會以僅限數據的 伺服器傳送事件 形式發送,而數據流會在發送 data: [DONE] 訊息後終止。
範例 Python 程式碼。 |
No | False |
| suffix | 字串 | 完成插入文字之後的尾碼。 僅 gpt-3.5-turbo-instruct 支援此參數。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 |
No |
createCompletionResponse
表示來自 API 的完成回應。 注意: 串流和非串流回應物件會共用相同的圖形 (與聊天端點不同)。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| choices | 陣列 | 輸入提示所產生模型的完成選項清單。 | Yes | |
| created | 整數 | 建立完成時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 完成的唯一識別碼。 | Yes | |
| 型號 | 字串 | 用於完成的模型。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 "text_completion" 可能的值: text_completion |
Yes | |
| prompt_filter_results | promptFilterResults | 要求中零個或多個提示的內容篩選結果。 在串流要求中,不同提示的結果可能會在不同時間或依不同的順序抵達。 | No | |
| system_fingerprint | 字串 | 此指紋代表模型執行時使用的後端組態。 可以搭配 seed 要求參數使用,以了解可能會影響決定性的後端變更是何時進行。 |
No | |
| 使用方式 | completionUsage | 完成要求的使用量統計資料。 | No |
createChatCompletionRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| audio | 物件 | 音訊輸出的參數。 使用 modalities: ["audio"] 要求音訊輸出時需要。 |
No | |
| └─ 格式 | 列舉 | 指定輸出音訊格式。 必須是 wav、mp3、flac、opus 或 pcm16 其中之一。 可能的值: wav、mp3、flac、opus、pcm16 |
No | |
| ‧----語音 | 列舉 | 指定語音類型。 支援的語音為alloy、、echo、fableonyx、、 nova和 shimmer。可能的值: alloy、、、echofableonyx、nova、shimmer |
No | |
| data_sources | 陣列 | 加以使用的 Azure OpenAI 聊天延伸模組的設定項目。 此額外規格僅與 Azure OpenAI 相容。 |
No | |
| frequency_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止在文字中的出現頻率來打壓新權杖,降低模型重複完全相同行的可能性。 |
No | 0 |
| function_call | string 或 chatCompletionFunctionCallOption | 已淘汰,改用 tool_choice。控制模型所呼叫的函式 (若有)。 none 表示模型不會呼叫函式,而是會產生訊息。auto 表示模型可選擇產生訊息或呼叫函式。透過 {"name": "my_function"} 指定特定函式會強制模型呼叫該函式。當沒有任何函式存在時, none 為預設值。
如果函式存在,auto 為預設值。 |
No | |
| functions | 陣列 | 已淘汰,改用 tools。模型可能會為其產生 JSON 輸入的函數清單。 |
No | |
| logit_bias | 物件 | 修改在完成時出現指定權杖的可能性。 接受 JSON 物件,此物件會將權杖 (由權杖化工具中的語彙基元識別碼所指定) 對應至 -100 到 100 的相關聯偏差值。 在數學上,偏差會先加到模型產生的對數,再取樣。 確切的效果會因模型而異,但介於 -1 到 1 之間的值應該會降低或提高選取的可能性;而 -100 或 100 之類的值應會導致禁止選取或獨佔選取相關權杖。 |
No | None |
| logprobs | boolean | 是否要傳回輸出權杖的對數機率。 如果為 true,則會傳回在 content 的 message 中所傳回每個輸出權杖的對數機率。 |
No | False |
| max_completion_tokens | 整數 | 可針對完成產生的語彙基元數目上限,包括可見的輸出語彙基元和推理語彙基元。 | No | |
| max_tokens | 整數 | 聊天完成中可產生的權杖數目上限。 輸入權杖和產生權杖的總長度受限於模型的內容長度。 |
No | |
| messages | 陣列 | 目前比較交談的訊息清單。 範例 Python 程式碼。 | Yes | |
| 中繼資料 | 物件 | 開發人員定義的標籤和值,用於篩選儲存完成結果儀表板中的完成項目。 | No | |
| modalities | ChatCompletionModalities | 您希望模型根據此要求產生的輸出類型。 大部分模型都能夠產生文字,這是預設值: ["text"]gpt-4o-audio-preview 模型也可以用來產生音訊。 若要要求此模型同時產生文字和音訊回應,您可以使用:["text", "audio"] |
No | |
| n | 整數 | 針對每個輸入訊息產生多少聊天完成選項。 請注意,您必須根據所有選擇中產生之語彙基元的數目來支付費用。 將 n 保留為 1 以將成本降至最低。 |
No | 1 |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| 預測 | PredictionContent | 預測輸出的設定,這可在模型回應大部分提前已知時,大幅改善回應時間。 最常見的情況是您要重新產生檔案,但只對大部分內容進行了少許變更。 | No | |
| presence_penalty | number | 介於 -2.0 和 2.0 之間的數字。 正值會根據權杖迄今為止是否出現在文字中來打壓新權杖,提高模型討論新主題的可能性。 |
No | 0 |
| reasoning_effort | 列舉 |
僅限 o1 模型 限制推理模型的推理工作。 目前支援的值為 low、medium 和 high。 減少推理工作可能會導致回應更快,以及回應中用於推理的權杖較少。可能的值: low、、 mediumhigh |
No | |
| response_format | ResponseFormatText 或 ResponseFormatJsonObject 或 ResponseFormatJsonSchema | 物件,指定模型必須輸出的格式。 相容於 GPT-4o、GPT-4o mini、GPT-4 Turbo,以及所有比 還要新的 gpt-3.5-turbo-1106 Turbo 模型。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,保證模型符合您提供的 JSON 架構。設定為 { "type": "json_object" } 會啟用 JSON 模式,保證模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| seed | 整數 | 這項功能在 Beta 版中。 如果有指定,我們的系統會盡最大努力以決定性方式取樣,讓具有相同 seed 和參數的要求能夠重複傳回相同的結果。不保證決定性,且您應參照 system_fingerprint 回應參數來監視後端的變更。 |
No | |
| stop | 字串或陣列 | 最多 4 個序列,API 將在每個序列中停止產生更多的令牌。 |
No | |
| 儲存 | boolean | 是否要儲存此聊天完成要求的輸出,以用於我們的模型擷取或評估產品。 | No | |
| 串流 | boolean | 如果設定,則會傳送部分訊息差異,就像在 ChatGPT 中一樣。 當語彙基元可用時,它們會作為僅含資料的伺服器傳送事件來傳送,並由 data: [DONE] 訊息來終止串流。
範例 Python 程式碼。 |
No | False |
| stream_options | chatCompletionStreamOptions | 串流回應的選項。 只有當您設定 stream: true 時,才需要設定此選項。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| tool_choice | chatCompletionToolChoiceOption | 控制模型所呼叫的工具 (若有)。
none 表示模型不會呼叫任何工具,而是會產生訊息。
auto 表示模型可以選擇產生訊息或是呼叫一或多個工具。
required 表示模型必須呼叫一或多個工具。 透過 {"type": "function", "function": {"name": "my_function"}} 指定特定工具會強制模型呼叫該工具。
當沒有任何工具存在時,none 為預設值。
當有工具存在時,auto 為預設值。 |
No | |
| tools | 陣列 | 模型可呼叫的工具清單。 目前僅支援函式作為工具。 使用此參數可提供產生 JSON 輸入的函式清單。 最多支援 128 個函式。 |
No | |
| top_logprobs | 整數 | 介於 0 到 20 之間的整數,其會指定最有可能在每個語彙基元位置傳回的語彙基元數目,每個都有相關聯的對數機率。
如果使用此參數,則 logprobs 必須設定為 true。 |
No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 |
No | |
| user_security_context | userSecurityContext | 使用者安全性內容包含數個參數,描述 AI 應用程式本身,以及與 AI 應用程式互動的終端使用者。 這些欄位提供保護 AI 應用程式的完整方法,進而協助安全性作業小組調查及減輕安全性事件。 深入了解如何使用適用於雲端的 Microsoft Defender 保護 AI 應用程式。 | No |
userSecurityContext
使用者安全性內容包含數個參數,描述 AI 應用程式本身,以及與 AI 應用程式互動的終端使用者。 這些欄位提供保護 AI 應用程式的完整方法,進而協助安全性作業小組調查及減輕安全性事件。 深入了解如何使用適用於雲端的 Microsoft Defender 保護 AI 應用程式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| application_name | 字串 | 應用程式的名稱。 此欄位中不應包含敏感性個人資訊。 | No | |
| end_user_id | 字串 | 此識別碼是用來驗證生成式 AI 應用程式內使用者之Microsoft Entra ID (先前稱為 Azure Active Directory) 使用者物件識別碼。 此欄位中不應包含敏感性個人資訊。 | No | |
| end_user_tenant_id | 字串 | 使用者所屬的 Microsoft 365 租用戶識別碼。 當生成式 AI 應用程式是多租用戶時,這是必要的。 | No | |
| source_ip | 字串 | 擷取原始用戶端的 IP 位址,同時接受 IPv4 和 IPv6 格式。 | No |
chatCompletionFunctions
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 函式用途的說明,由模型使用來選擇呼叫函式的時機和方式。 | No | |
| name | 字串 | 要呼叫之函式的名稱。 必須是 a-z、A-Z、0-9,或包含底線或虛線,長度上限為 64。 | Yes | |
| parameters | FunctionParameters | 函式接受的參數,描述為 JSON 結構描述物件。
請參閱指南以取得範例,並參閱 JSON 結構描述參考以取得有關該格式的文件。 省略 parameters 定義具有空白參數清單的函式。 |
No |
chatCompletionFunctionCallOption
透過 {"name": "my_function"} 指定特定函式會強制模型呼叫該函式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| name | 字串 | 要呼叫的函式名稱。 | Yes |
chatCompletionFunctionParameters
函式接受的參數,描述為 JSON 結構描述物件。 請參閱指南/ 以取得範例,並參閱 JSON 結構描述參考以取得有關該格式的文件。
未定義此元件的屬性。
chatCompletionRequestMessage
此元件可以是下列其中之一:
- ChatCompletionRequestDeveloperMessage
- chatCompletionRequestSystemMessage
- chatCompletionRequestUserMessage
- chatCompletionRequestAssistantMessage
- chatCompletionRequestToolMessage
- chatCompletionRequestFunctionMessage
ChatCompletionRequestDeveloperMessage
開發人員提供的指示,無論使用者傳送的訊息為何,模型都應該遵循。
使用 o1 模型和更新版本時,developer 訊息會取代先前的 system 訊息。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 開發人員訊息的內容。 | Yes | |
| name | 字串 | 參與者的選用名稱。 提供模型資訊以區分相同角色的參與者。 | No | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 developer。可能的值: developer |
Yes |
chatCompletionRequestSystemMessage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 系統訊息的內容。 | Yes | |
| name | 字串 | 參與者的選用名稱。 提供模型資訊以區分相同角色的參與者。 | No | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 system。可能的值: system |
Yes |
chatCompletionRequestUserMessage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 使用者訊息的內容。 |
Yes | |
| name | 字串 | 參與者的選用名稱。 提供模型資訊以區分相同角色的參與者。 | No | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 user。可能的值: user |
Yes |
chatCompletionRequestAssistantMessage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 助理訊息的內容。 除非指定了 tool_calls 或 function_call,否則為必要。 |
No | |
| function_call | 物件 | 已淘汰並取代為 tool_calls。 應呼叫函式的名稱和引數,如模型所產生。 |
No | |
| └─ 論點 | 字串 | 呼叫函數所使用的引數,由模型以 JSON 格式產生。 請注意,模型不一定會產生有效的 JSON,而且可能會產生函式架構未定義的幻覺參數。 在呼叫函式之前,請先驗證程式代碼中的引數。 | No | |
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| name | 字串 | 參與者的選用名稱。 提供模型資訊以區分相同角色的參與者。 | No | |
| refusal | 字串 | 助理的拒絕訊息。 | No | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 assistant。可能的值: assistant |
Yes | |
| tool_calls | chatCompletionMessageToolCalls | 模型所產生的工具呼叫,例如函式呼叫。 | No |
chatCompletionRequestToolMessage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 工具訊息的內容。 | Yes | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 tool。可能的值: tool |
Yes | |
| tool_call_id | 字串 | 此訊息正在回應的工具呼叫。 | Yes |
chatCompletionRequestFunctionMessage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串 | 函數訊息的內容。 | Yes | |
| name | 字串 | 要呼叫的函式名稱。 | Yes | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 function。可能的值: function |
Yes |
chatCompletionRequestDeveloperMessageContentPart
此元件可以是下列其中之一:
chatCompletionRequestSystemMessageContentPart
此元件可以是下列其中之一:
chatCompletionRequestUserMessageContentPart
此元件可以是下列其中之一:
- chatCompletionRequestMessageContentPartText
- chatCompletionRequestMessageContentPartImage
- chatCompletionRequestMessageContentPartAudio
chatCompletionRequestAssistantMessageContentPart
此元件可以是下列其中之一:
chatCompletionRequestToolMessageContentPart
此元件可以是下列其中之一:
chatCompletionRequestMessageContentPartText
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 字串 | 文字內容。 | Yes | |
| 型別 | 列舉 | 內容部分的類型。 可能的值: text |
Yes |
chatCompletionRequestMessageContentPartAudio
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| input_audio | 物件 | Yes | ||
| ‧---- 數據 | 字串 | Base64 編碼的音訊資料。 | No | |
| └─ 格式 | 列舉 | 編碼音訊資料的格式。 目前支援「wav」和「mp3」。 可能的值: wav、 mp3 |
No | |
| 型別 | 列舉 | 內容部分的類型。 一律為 input_audio。可能的值: input_audio |
Yes |
chatCompletionRequestMessageContentPartImage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| image_url | 物件 | Yes | ||
| |---- 詳細數據 | 列舉 | 指定影像的詳細程度。 若要深入了解,請參閱視覺指南。 可能的值: auto、、 lowhigh |
No | |
| └─ 網址 | 字串 | 影像的 URL 或 base64 編碼的影像資料。 | No | |
| 型別 | 列舉 | 內容部分的類型。 可能的值: image_url |
Yes |
chatCompletionRequestMessageContentPartRefusal
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| refusal | 字串 | 模型所產生的拒絕訊息。 | Yes | |
| 型別 | 列舉 | 內容部分的類型。 可能的值: refusal |
Yes |
azureChatExtensionConfiguration
單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。
###azureChatExtensionConfiguration 的鑑別子
此元件會使用 屬性 type 來區分不同的類型:
| 類型值 | Schema |
|---|---|
azure_search |
azureSearchChatExtensionConfiguration |
azure_cosmos_db |
azureCosmosDBChatExtensionConfiguration |
elasticsearch |
elasticsearchChatExtensionConfiguration |
mongo_db |
mongoDBChatExtensionConfiguration |
pinecone |
pineconeChatExtensionConfiguration |
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
azureChatExtensionType
單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。
| Property | Value |
|---|---|
| Description | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
| Type | 字串 |
| Values | azure_searchazure_cosmos_dbelasticsearchmongo_dbpinecone |
azureSearchChatExtensionConfiguration
Azure 搜尋服務在用作 Azure OpenAI 聊天延伸模組時,其可設定選項的特定表示法。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| parameters | azureSearchChatExtensionParameters | Azure 搜尋服務在用作 Azure OpenAI 聊天延伸模組時的參數。 | No | |
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
azureSearchChatExtensionParameters
Azure 搜尋服務在用作 Azure OpenAI 聊天延伸模組時的參數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| allow_partial_result | boolean | 如果指定為 true,系統將允許使用部分搜尋結果,要求將在所有查詢都失敗時失敗。 若未指定或指定為 false,要求將隨著任何搜尋查詢失敗而失敗。 | No | False |
| 認證 | onYourDataApiKeyAuthenticationOptions 或 onYourDataSystemAssignedManagedIdentityAuthenticationOptions 或 onYourDataUserAssignedManagedIdentityAuthenticationOptions 或 onYourDataAccessTokenAuthenticationOptions | Yes | ||
| embedding_dependency | onYourDataEndpointVectorizationSource 或 onYourDataDeploymentNameVectorizationSource 或 onYourDataIntegratedVectorizationSource | No | ||
| 端點 | 字串 | Azure 搜尋服務資源所要使用的絕對端點路徑。 | Yes | |
| fields_mapping | azureSearchIndexFieldMappingOptions | 選擇性設定,可控制使用已設定的 Azure 搜尋服務資源時處理欄位的方式。 | No | |
| 篩選 | 字串 | 搜尋篩選器。 | No | |
| in_scope | boolean | 查詢是否應限制為使用已編製索引的資料。 | No | |
| include_contexts | 陣列 | 輸出內容包含的屬性。 若未指定,則預設值為 citations 和 intent。 |
No | |
| index_name | 字串 | 要在參考的 Azure 搜尋服務資源中作為可用索引的索引名稱。 | Yes | |
| max_search_queries | 整數 | 針對一個使用者訊息應傳送給搜尋提供者的重寫查詢數目上限。 若未指定,系統會決定要傳送的查詢數目。 | No | |
| query_type | azureSearchQueryType | Azure 搜尋服務擷取查詢在用作 Azure OpenAI 聊天延伸模組時所應執行的類型。 | No | |
| semantic_configuration | 字串 | 查詢的其他語意設定。 | No | |
| strictness | 整數 | 已設定的搜尋相關性篩選嚴格度。 嚴格度越高,精確度就越高,但答案的召回率越低。 | No | |
| top_n_documents | 整數 | 要為設定的查詢顯示的已設定文件數目上限。 | No |
azureSearchIndexFieldMappingOptions
選擇性設定,可控制使用已設定的 Azure 搜尋服務資源時處理欄位的方式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_fields | 陣列 | 應視為內容的索引欄位名稱。 | No | |
| content_fields_separator | 字串 | 內容欄位應使用的分隔符號模式。 | No | |
| filepath_field | 字串 | 要用作檔案路徑的索引欄位名稱。 | No | |
| image_vector_fields | 陣列 | 代表影像向量資料的欄位名稱。 | No | |
| title_field | 字串 | 要用作標題的索引欄位名稱。 | No | |
| url_field | 字串 | 要用作 URL 的索引欄位名稱。 | No | |
| vector_fields | 陣列 | 代表向量資料的欄位名稱。 | No |
azureSearchQueryType
Azure 搜尋服務擷取查詢在用作 Azure OpenAI 聊天延伸模組時所應執行的類型。
| Property | Value |
|---|---|
| Description | Azure 搜尋服務擷取查詢在用作 Azure OpenAI 聊天延伸模組時所應執行的類型。 |
| Type | 字串 |
| Values | simplesemanticvectorvector_simple_hybridvector_semantic_hybrid |
azureCosmosDBChatExtensionConfiguration
Azure Cosmos DB 在用作 Azure OpenAI 聊天延伸模組時,其可設定選項的特定表示法。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| parameters | azureCosmosDBChatExtensionParameters | 使用 Azure Cosmos DB for MongoDB 虛擬核心時,要在設定 Azure OpenAI On Your Data 聊天延伸模組時使用的參數。 | No | |
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
azureCosmosDBChatExtensionParameters
使用 Azure Cosmos DB for MongoDB 虛擬核心時,要在設定 Azure OpenAI On Your Data 聊天延伸模組時使用的參數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| allow_partial_result | boolean | 如果指定為 true,系統將允許使用部分搜尋結果,要求將在所有查詢都失敗時失敗。 若未指定或指定為 false,要求將隨著任何搜尋查詢失敗而失敗。 | No | False |
| 認證 | onYourDataConnectionStringAuthenticationOptions | Azure OpenAI On Your Data 在使用連接字串時的驗證選項。 | Yes | |
| container_name | 字串 | Azure Cosmos DB 資源容器的名稱。 | Yes | |
| database_name | 字串 | 要與 Azure Cosmos DB 搭配使用的 MongoDB 虛擬核心資料庫名稱。 | Yes | |
| embedding_dependency | onYourDataEndpointVectorizationSource 或 onYourDataDeploymentNameVectorizationSource | Yes | ||
| fields_mapping | azureCosmosDBFieldMappingOptions | 選擇性設定,可控制使用已設定的 Azure Cosmos DB 資源時處理欄位的方式。 | Yes | |
| in_scope | boolean | 查詢是否應限制為使用已編製索引的資料。 | No | |
| include_contexts | 陣列 | 輸出內容包含的屬性。 若未指定,則預設值為 citations 和 intent。 |
No | |
| index_name | 字串 | 要與 Azure Cosmos DB 搭配使用的 MongoDB 虛擬核心索引名稱。 | Yes | |
| max_search_queries | 整數 | 針對一個使用者訊息應傳送給搜尋提供者的重寫查詢數目上限。 若未指定,系統會決定要傳送的查詢數目。 | No | |
| strictness | 整數 | 已設定的搜尋相關性篩選嚴格度。 嚴格度越高,精確度就越高,但答案的召回率越低。 | No | |
| top_n_documents | 整數 | 要為設定的查詢顯示的已設定文件數目上限。 | No |
azureCosmosDBFieldMappingOptions
選擇性設定,可控制使用已設定的 Azure Cosmos DB 資源時處理欄位的方式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_fields | 陣列 | 應視為內容的索引欄位名稱。 | Yes | |
| content_fields_separator | 字串 | 內容欄位應使用的分隔符號模式。 | No | |
| filepath_field | 字串 | 要用作檔案路徑的索引欄位名稱。 | No | |
| title_field | 字串 | 要用作標題的索引欄位名稱。 | No | |
| url_field | 字串 | 要用作 URL 的索引欄位名稱。 | No | |
| vector_fields | 陣列 | 代表向量資料的欄位名稱。 | Yes |
elasticsearchChatExtensionConfiguration
Elasticsearch 在用作 Azure OpenAI 聊天延伸模組時,其可設定選項的特定表示法。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| parameters | elasticsearchChatExtensionParameters | 將 Elasticsearch 設定®為 Azure OpenAI 聊天延伸模組時要使用的參數。 | No | |
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
elasticsearchChatExtensionParameters
將 Elasticsearch 設定®為 Azure OpenAI 聊天延伸模組時要使用的參數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| allow_partial_result | boolean | 如果指定為 true,系統將允許使用部分搜尋結果,要求將在所有查詢都失敗時失敗。 若未指定或指定為 false,要求將隨著任何搜尋查詢失敗而失敗。 | No | False |
| 認證 | onYourDataKeyAndKeyIdAuthenticationOptions 或 onYourDataEncodedApiKeyAuthenticationOptions | Yes | ||
| embedding_dependency | onYourDataEndpointVectorizationSource 或 onYourDataDeploymentNameVectorizationSource 或 onYourDataModelIdVectorizationSource | No | ||
| 端點 | 字串 | Elasticsearch® 的端點。 | Yes | |
| fields_mapping | elasticsearchIndexFieldMappingOptions | 可選擇的設定,用於控制使用已設定的 Elasticsearch® 資源時,欄位的處理方式。 | No | |
| in_scope | boolean | 查詢是否應限制為使用已編製索引的資料。 | No | |
| include_contexts | 陣列 | 輸出內容包含的屬性。 若未指定,則預設值為 citations 和 intent。 |
No | |
| index_name | 字串 | Elasticsearch® 的索引名稱。 | Yes | |
| max_search_queries | 整數 | 針對一個使用者訊息應傳送給搜尋提供者的重寫查詢數目上限。 若未指定,系統會決定要傳送的查詢數目。 | No | |
| query_type | elasticsearchQueryType | 使用 Elasticsearch® 檢索查詢做為 Azure OpenAI 聊天延伸模組時,應執行的查詢類型。 | No | |
| strictness | 整數 | 已設定的搜尋相關性篩選嚴格度。 嚴格度越高,精確度就越高,但答案的召回率越低。 | No | |
| top_n_documents | 整數 | 要為設定的查詢顯示的已設定文件數目上限。 | No |
elasticsearchIndexFieldMappingOptions
可選擇的設定,用於控制使用已設定的 Elasticsearch® 資源時,欄位的處理方式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_fields | 陣列 | 應視為內容的索引欄位名稱。 | No | |
| content_fields_separator | 字串 | 內容欄位應使用的分隔符號模式。 | No | |
| filepath_field | 字串 | 要用作檔案路徑的索引欄位名稱。 | No | |
| title_field | 字串 | 要用作標題的索引欄位名稱。 | No | |
| url_field | 字串 | 要用作 URL 的索引欄位名稱。 | No | |
| vector_fields | 陣列 | 代表向量資料的欄位名稱。 | No |
elasticsearchQueryType
使用 Elasticsearch® 檢索查詢做為 Azure OpenAI 聊天延伸模組時,應執行的查詢類型。
| Property | Value |
|---|---|
| Description | 使用 Elasticsearch® 檢索查詢做為 Azure OpenAI 聊天延伸模組時,應執行的查詢類型。 |
| Type | 字串 |
| Values | simplevector |
mongoDBChatExtensionConfiguration
將 Mongo DB 用作 Azure OpenAI 聊天延伸模組時的可設定選項的具體表示。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| parameters | mongoDBChatExtensionParameters | 使用 MongoDB 時要在設定 Azure OpenAI On Your Data 聊天延伸模組時要使用的參數。 | No | |
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
mongoDBChatExtensionParameters
使用 MongoDB 時要在設定 Azure OpenAI On Your Data 聊天延伸模組時要使用的參數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| allow_partial_result | boolean | 如果指定為 true,系統將允許使用部分搜尋結果,要求將在所有查詢都失敗時失敗。 若未指定或指定為 false,要求將隨著任何搜尋查詢失敗而失敗。 | No | False |
| app_name | 字串 | Mongo DB 應用程式的名稱。 | Yes | |
| 認證 | onYourDataUsernameAndPasswordAuthenticationOptions | 使用使用者名稱和密碼時,Azure OpenAI On Your Data 的驗證選項。 | Yes | |
| collection_name | 字串 | Mongo DB 集合的名稱。 | Yes | |
| database_name | 字串 | Mongo DB 資料庫的名稱。 | Yes | |
| embedding_dependency | onYourDataEndpointVectorizationSource 或 onYourDataDeploymentNameVectorizationSource | Yes | ||
| 端點 | 字串 | Mongo DB 叢集端點的名稱。 | Yes | |
| fields_mapping | mongoDBFieldMappingOptions | 用於控制使用已設定的 Mongo DB 資源時如何處理欄位的選用設定。 | Yes | |
| in_scope | boolean | 查詢是否應限制為使用已編製索引的資料。 | No | |
| include_contexts | 陣列 | 輸出內容包含的屬性。 若未指定,則預設值為 citations 和 intent。 |
No | |
| index_name | 字串 | Mongo DB 索引的名稱。 | Yes | |
| max_search_queries | 整數 | 針對一個使用者訊息應傳送給搜尋提供者的重寫查詢數目上限。 若未指定,系統會決定要傳送的查詢數目。 | No | |
| strictness | 整數 | 已設定的搜尋相關性篩選嚴格度。 嚴格度越高,精確度就越高,但答案的召回率越低。 | No | |
| top_n_documents | 整數 | 要為設定的查詢顯示的已設定文件數目上限。 | No |
mongoDBFieldMappingOptions
用於控制使用已設定的 Mongo DB 資源時如何處理欄位的選用設定。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_fields | 陣列 | 應視為內容的索引欄位名稱。 | Yes | |
| content_fields_separator | 字串 | 內容欄位應使用的分隔符號模式。 | No | |
| filepath_field | 字串 | 要用作檔案路徑的索引欄位名稱。 | No | |
| title_field | 字串 | 要用作標題的索引欄位名稱。 | No | |
| url_field | 字串 | 要用作 URL 的索引欄位名稱。 | No | |
| vector_fields | 陣列 | 代表向量資料的欄位名稱。 | Yes |
pineconeChatExtensionConfiguration
Pinecone 在用作 Azure OpenAI 聊天延伸模組時,其可設定選項的特定表示法。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| parameters | pineconeChatExtensionParameters | 用來設定 Azure OpenAI Pinecone 聊天延伸模組的參數。 | No | |
| 型別 | azureChatExtensionType | 單一 Azure OpenAI 聊天延伸模組的設定資料表示法。 這將由應使用 Azure OpenAI 聊天延伸模組來增強回應行為的聊天完成要求使用。 此設定的使用僅與 Azure OpenAI 相容。 |
Yes |
pineconeChatExtensionParameters
用來設定 Azure OpenAI Pinecone 聊天延伸模組的參數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| allow_partial_result | boolean | 如果指定為 true,系統將允許使用部分搜尋結果,要求將在所有查詢都失敗時失敗。 若未指定或指定為 false,要求將隨著任何搜尋查詢失敗而失敗。 | No | False |
| 認證 | onYourDataApiKeyAuthenticationOptions | Azure OpenAI On Your Data 在使用 API 金鑰時的驗證選項。 | Yes | |
| embedding_dependency | onYourDataDeploymentNameVectorizationSource | 套用向量搜尋時,Azure OpenAI On Your Data 所使用的向量化來源 (以相同 Azure OpenAI 資源中的內部內嵌模型部署名稱為基礎) 的詳細資料。 | Yes | |
| 環境 | 字串 | Pinecone 的環境名稱。 | Yes | |
| fields_mapping | pineconeFieldMappingOptions | 選擇性設定,可控制使用已設定的 Pinecone 資源時處理欄位的方式。 | Yes | |
| in_scope | boolean | 查詢是否應限制為使用已編製索引的資料。 | No | |
| include_contexts | 陣列 | 輸出內容包含的屬性。 若未指定,則預設值為 citations 和 intent。 |
No | |
| index_name | 字串 | Pinecone 資料庫索引的名稱。 | Yes | |
| max_search_queries | 整數 | 針對一個使用者訊息應傳送給搜尋提供者的重寫查詢數目上限。 若未指定,系統會決定要傳送的查詢數目。 | No | |
| strictness | 整數 | 已設定的搜尋相關性篩選嚴格度。 嚴格度越高,精確度就越高,但答案的召回率越低。 | No | |
| top_n_documents | 整數 | 要為設定的查詢顯示的已設定文件數目上限。 | No |
pineconeFieldMappingOptions
選擇性設定,可控制使用已設定的 Pinecone 資源時處理欄位的方式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_fields | 陣列 | 應視為內容的索引欄位名稱。 | Yes | |
| content_fields_separator | 字串 | 內容欄位應使用的分隔符號模式。 | No | |
| filepath_field | 字串 | 要用作檔案路徑的索引欄位名稱。 | No | |
| title_field | 字串 | 要用作標題的索引欄位名稱。 | No | |
| url_field | 字串 | 要用作 URL 的索引欄位名稱。 | No |
onYourDataAuthenticationOptions
Azure OpenAI On Your Data 的驗證選項。
onYourDataAuthenticationOptions 的鑑別子
此元件會使用 屬性 type 來區分不同的類型:
| 類型值 | Schema |
|---|---|
api_key |
onYourDataApiKeyAuthenticationOptions |
connection_string |
onYourDataConnectionStringAuthenticationOptions |
key_and_key_id |
onYourDataKeyAndKeyIdAuthenticationOptions |
encoded_api_key |
onYourDataEncodedApiKeyAuthenticationOptions |
access_token |
onYourDataAccessTokenAuthenticationOptions |
system_assigned_managed_identity |
onYourDataSystemAssignedManagedIdentityAuthenticationOptions |
user_assigned_managed_identity |
onYourDataUserAssignedManagedIdentityAuthenticationOptions |
username_and_password |
onYourDataUsernameAndPasswordAuthenticationOptions |
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataContextProperty
內容屬性。
| Property | Value |
|---|---|
| Description | 內容屬性。 |
| Type | 字串 |
| Values | citationsintentall_retrieved_documents |
onYourDataAuthenticationType
Azure OpenAI On Your Data 支援的驗證類型。
| Property | Value |
|---|---|
| Description | Azure OpenAI On Your Data 支援的驗證類型。 |
| Type | 字串 |
| Values | api_keyconnection_stringkey_and_key_idencoded_api_keyaccess_tokensystem_assigned_managed_identityuser_assigned_managed_identityusername_and_password |
onYourDataApiKeyAuthenticationOptions
Azure OpenAI On Your Data 在使用 API 金鑰時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| Key | 字串 | 要用於驗證的 API 金鑰。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataConnectionStringAuthenticationOptions
Azure OpenAI On Your Data 在使用連接字串時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| connection_string | 字串 | 要用於驗證的連接字串。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataKeyAndKeyIdAuthenticationOptions
Azure OpenAI On Your Data 在使用 Elasticsearch 金鑰/金鑰識別碼組合時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| Key | 字串 | 要用於驗證的 Elasticsearch 金鑰。 | No | |
| key_id | 字串 | 要用於驗證的 Elasticsearch 金鑰識別碼。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataEncodedApiKeyAuthenticationOptions
Azure OpenAI On Your Data 在使用 Elasticsearch 編碼 API 金鑰時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| encoded_api_key | 字串 | 要用於驗證的 Elasticsearch 編碼 API 金鑰。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataAccessTokenAuthenticationOptions
Azure OpenAI On Your Data 在使用存取權杖時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| access_token | 字串 | 要用於驗證的存取權杖。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataSystemAssignedManagedIdentityAuthenticationOptions
Azure OpenAI On Your Data 在使用系統指派的受控識別時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataUserAssignedManagedIdentityAuthenticationOptions
Azure OpenAI On Your Data 在使用使用者指派的受控識別時的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| managed_identity_resource_id | 字串 | 要用於驗證的使用者指派受控識別的資源識別碼。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes |
onYourDataUsernameAndPasswordAuthenticationOptions
使用使用者名稱和密碼時,Azure OpenAI On Your Data 的驗證選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 密碼 | 字串 | 密碼。 要用於驗證。 | No | |
| 型別 | onYourDataAuthenticationType | Azure OpenAI On Your Data 支援的驗證類型。 | Yes | |
| 使用者名稱 | 字串 | 要用於驗證的使用者名稱。 | No |
onYourDataVectorizationSource
使用向量搜尋的 Azure OpenAI On Your Data 向量化來源的抽象表示法。
此元件會使用 屬性 type 來區分不同的類型:
| 類型值 | Schema |
|---|---|
endpoint |
onYourDataEndpointVectorizationSource |
deployment_name |
onYourDataDeploymentNameVectorizationSource |
integrated |
onYourDataIntegratedVectorizationSource |
model_id |
onYourDataModelIdVectorizationSource |
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | onYourDataVectorizationSourceType | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 | Yes |
onYourDataVectorizationSourceType
代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。
| Property | Value |
|---|---|
| Description | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 |
| Type | 字串 |
| Values | endpointdeployment_nameintegratedmodel_id |
onYourDataEndpointVectorizationSource
套用向量搜尋時,Azure OpenAI On Your Data 所使用的向量化來源 (以公用 Azure OpenAI 的內嵌端點呼叫為基礎) 的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 認證 | onYourDataApiKeyAuthenticationOptions 或 onYourDataAccessTokenAuthenticationOptions | No | ||
| dimensions | 整數 | 內嵌應有的維度數目。 僅支援 text-embedding-3 和更新模型。 |
No | |
| 端點 | 字串 | 指定應從中擷取內嵌的資源端點 URL。 其格式應為 https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/embeddings。 不允許 api-版本查詢參數。 |
No | |
| 型別 | onYourDataVectorizationSourceType | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 | Yes |
onYourDataDeploymentNameVectorizationSource
套用向量搜尋時,Azure OpenAI On Your Data 所使用的向量化來源 (以相同 Azure OpenAI 資源中的內部內嵌模型部署名稱為基礎) 的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deployment_name | 字串 | 指定要用於向量化的模型部署名稱。 此模型部署必須位於相同的 Azure OpenAI 資源中,但 On Your Data 將會透過內部呼叫 (而非公用呼叫) 來使用此模型部署,因此即使在私人網路中也會啟用向量搜尋。 | No | |
| dimensions | 整數 | 內嵌應有的維度數目。 僅支援 text-embedding-3 和更新模型。 |
No | |
| 型別 | onYourDataVectorizationSourceType | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 | Yes |
onYourDataIntegratedVectorizationSource
表示在搜尋資源內定義的整合向量化工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | onYourDataVectorizationSourceType | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 | Yes |
onYourDataModelIdVectorizationSource
套用向量搜尋時,Azure OpenAI On Your Data 所使用的向量化來源 (以搜尋服務模型識別碼為基礎) 的詳細資料。 目前僅支援 Elasticsearch®。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| model_id | 字串 | 指定要用於向量化的模型識別碼。 此模型識別碼必須定義於搜尋服務中。 | No | |
| 型別 | onYourDataVectorizationSourceType | 代表 Azure OpenAI On Your Data 可用來設定資料向量化以用於向量搜尋的可用來源。 | Yes |
azureChatExtensionsMessageContext
一種表示法,在產生對應的聊天完成回應時若涉及 Azure OpenAI 聊天延伸模組,用來代表其他可用的內容資訊。 只有在使用的 Azure OpenAI 要求設定為使用相符的延伸模組時,才會填入此內容資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| all_retrieved_documents | 陣列 | 所有擷取的文件。 | No | |
| citations | 陣列 | 資料來源擷取結果,用於在回應中產生小幫手訊息。 | No | |
| 意圖 | 字串 | 從聊天記錄中偵測到的意圖,用來傳至下一個回合,以傳遞內容。 | No |
citation
聊天完成回應訊息的引文資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunk_id | 字串 | 引文的區塊識別碼。 | No | |
| 內容 | 字串 | 引文的內容。 | Yes | |
| filepath | 字串 | 引文的檔案路徑。 | No | |
| rerank_score | number | 所擷取文件的重新排名分數。 | No | |
| title | 字串 | 引文的標題。 | No | |
| url | 字串 | 引文的 URL。 | No |
retrievedDocument
擷取的文件。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunk_id | 字串 | 引文的區塊識別碼。 | No | |
| 內容 | 字串 | 引文的內容。 | Yes | |
| data_source_index | 整數 | 資料來源的索引。 | No | |
| filepath | 字串 | 引文的檔案路徑。 | No | |
| filter_reason | filterReason | 擷取的文件篩選的原因。 | No | |
| original_search_score | number | 所擷取文件的原始搜尋分數。 | No | |
| rerank_score | number | 所擷取文件的重新排名分數。 | No | |
| search_queries | 陣列 | 用來擷取文件的搜尋查詢。 | No | |
| title | 字串 | 引文的標題。 | No | |
| url | 字串 | 引文的 URL。 | No |
filterReason
擷取的文件篩選的原因。
| Property | Value |
|---|---|
| Description | 擷取的文件篩選的原因。 |
| Type | 字串 |
| Values | scorererank |
chatCompletionMessageToolCall
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | 模型所呼叫的函式。 | Yes | |
| └─ 論點 | 字串 | 呼叫函數所使用的引數,由模型以 JSON 格式產生。 請注意,模型不一定會產生有效的 JSON,而且可能會產生函式架構未定義的幻覺參數。 在呼叫函式之前,請先驗證程式代碼中的引數。 | No | |
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| id | 字串 | 工具呼叫的識別碼。 | Yes | |
| 型別 | toolCallType | 工具呼叫的類型,在此案例中為 function。 |
Yes |
toolCallType
工具呼叫的類型,在此案例中為 function。
| Property | Value |
|---|---|
| Description | 工具呼叫的類型,在此案例中為 function。 |
| Type | 字串 |
| Values | function |
chatCompletionRequestMessageTool
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串 | 訊息的內容。 | No | |
| tool_call_id | 字串 | 此訊息正在回應的工具呼叫。 | No |
chatCompletionRequestMessageFunction
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串 | 訊息的內容。 | No | |
| name | 字串 | 訊息的內容。 | No | |
| 角色 | 列舉 | 訊息作者的角色,在此案例中為 function。可能的值: function |
No |
createChatCompletionResponse
根據提供的輸入,表示模型傳回的聊天完成回應。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| choices | 陣列 | 聊天完成選項的清單。 如果 n 大於 1,則可以有多個。 |
Yes | |
| created | 整數 | 建立聊天完成時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 聊天完成的唯一識別碼。 | Yes | |
| 型號 | 字串 | 用於聊天完成的模型。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 chat.completion。可能的值: chat.completion |
Yes | |
| prompt_filter_results | promptFilterResults | 要求中零個或多個提示的內容篩選結果。 在串流要求中,不同提示的結果可能會在不同時間或依不同的順序抵達。 | No | |
| system_fingerprint | 字串 | 此指紋代表模型執行時使用的後端組態。 可以搭配 seed 要求參數使用,以了解可能會影響決定性的後端變更是何時進行。 |
No | |
| 使用方式 | completionUsage | 完成要求的使用量統計資料。 | No |
createChatCompletionStreamResponse
表示由模型 (根據所提供的輸入) 所傳回的聊天完成回應的串流區塊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| choices | 陣列 | 聊天完成選項的清單。 如果 n 大於 1,則可以包含多個元素。 |
Yes | |
| created | 整數 | 建立聊天完成時的 Unix 時間戳記 (以秒為單位)。 每個區塊都有相同的時間戳記。 | Yes | |
| id | 字串 | 聊天完成的唯一識別碼。 每個區塊都有相同的識別碼。 | Yes | |
| 型號 | 字串 | 產生完成項的模型。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 chat.completion.chunk。可能的值: chat.completion.chunk |
Yes | |
| system_fingerprint | 字串 | 此指紋代表模型執行時使用的後端組態。 可以搭配 seed 要求參數使用,以了解可能會影響決定性的後端變更是何時進行。 |
No |
chatCompletionStreamResponseDelta
串流模型回應所產生的聊天完成差異。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串 | 區塊訊息的內容。 | No | |
| function_call | 物件 | 已淘汰並取代為 tool_calls。 應呼叫函式的名稱和引數,如模型所產生。 |
No | |
| └─ 論點 | 字串 | 呼叫函數所使用的引數,由模型以 JSON 格式產生。 請注意,模型不一定會產生有效的 JSON,而且可能會產生函式架構未定義的幻覺參數。 在呼叫函式之前,請先驗證程式代碼中的引數。 | No | |
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| refusal | 字串 | 模型所產生的拒絕訊息。 | No | |
| 角色 | 列舉 | 此訊息作者的角色。 可能的值: system、、user、 assistanttool |
No | |
| tool_calls | 陣列 | No |
chatCompletionMessageToolCallChunk
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | No | ||
| └─ 論點 | 字串 | 呼叫函數所使用的引數,由模型以 JSON 格式產生。 請注意,模型不一定會產生有效的 JSON,而且可能會產生函式架構未定義的幻覺參數。 在呼叫函式之前,請先驗證程式代碼中的引數。 | No | |
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| id | 字串 | 工具呼叫的識別碼。 | No | |
| 索引 | 整數 | Yes | ||
| 型別 | 列舉 | 工具的類型。 目前僅支援 function。可能的值: function |
No |
chatCompletionStreamOptions
串流回應的選項。 只有當您設定 stream: true 時,才需要設定此選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| include_usage | boolean | 如果設定,則會在 data: [DONE] 訊息之前串流其他區塊。 此區塊上的 usage 欄位會顯示整個要求的語彙基元使用情況統計資料,而且 choices 欄位一律會是空的陣列。 所有其他區塊也會包含 usage 欄位,但具有 null 值。 |
No |
chatCompletionChoiceLogProbs
選擇的對數機率資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 陣列 | 具有對數機率資訊的訊息內容權杖清單。 | Yes | |
| refusal | 陣列 | 含記錄機率資訊的訊息拒絕語彙基元清單。 | No |
chatCompletionTokenLogprob
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| bytes | 陣列 | 一個整數清單,代表權杖的 UTF-8 位元組表示法。 如果由多個權杖代表字元,而且其位元組表示法必須合併以產生正確的文字表示法,則十分有用。 如果權杖沒有位元組表示法,則可以是 null。 |
Yes | |
| logprob | number | 此權杖的對數機率。 | Yes | |
| Token | 字串 | 語彙基元。 | Yes | |
| top_logprobs | 陣列 | 此權杖位置上最有可能的權杖和其對數機率清單。 在罕見的情況下,可能會少於所傳回的已要求 top_logprobs 數目。 |
Yes |
chatCompletionResponseMessage
模型產生的聊天完成訊息。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| audio | 物件 | 如果要求音訊輸出形式,此物件會包含模型音訊回應的相關數據。 | No | |
| ‧---- 數據 | 字串 | 以要求中指定的格式,模型所產生的 Base64 編碼音訊位元組。 |
No | |
| └─ 到期時間 | 整數 | 此音訊回應在伺服器上無法再存取以供多回合交談使用時的 Unix 時間戳記 (以秒為單位)。 |
No | |
| ‧----識別碼 | 字串 | 此音訊回應的唯一識別碼。 | No | |
| ‧---- 文字記錄 | 字串 | 模型所產生音訊的文字記錄。 | No | |
| 內容 | 字串 | 訊息的內容。 | Yes | |
| 內容 | azureChatExtensionsMessageContext | 一種表示法,在產生對應的聊天完成回應時若涉及 Azure OpenAI 聊天延伸模組,用來代表其他可用的內容資訊。 只有在使用的 Azure OpenAI 要求設定為使用相符的延伸模組時,才會填入此內容資訊。 | No | |
| function_call | chatCompletionFunctionCall | 已淘汰並取代為 tool_calls。 應呼叫函式的名稱和引數,如模型所產生。 |
No | |
| refusal | 字串 | 模型所產生的拒絕訊息。 | Yes | |
| 角色 | chatCompletionResponseMessageRole | 回應訊息作者的角色。 | Yes | |
| tool_calls | 陣列 | 模型所產生的工具呼叫,例如函式呼叫。 | No |
chatCompletionResponseMessageRole
回應訊息作者的角色。
| Property | Value |
|---|---|
| Description | 回應訊息作者的角色。 |
| Type | 字串 |
| Values | assistant |
chatCompletionToolChoiceOption
控制模型所呼叫的工具 (若有)。
none 表示模型不會呼叫任何工具,而是會產生訊息。
auto 表示模型可以選擇產生訊息或是呼叫一或多個工具。
required 表示模型必須呼叫一或多個工具。 透過 {"type": "function", "function": {"name": "my_function"}} 指定特定工具會強制模型呼叫該工具。
當沒有任何工具存在時,none 為預設值。
當有工具存在時,auto 為預設值。
此元件可以是下列其中之一:
chatCompletionNamedToolChoice
指定模型應使用的工具。 用來強制模型呼叫特定函式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | Yes | ||
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| 型別 | 列舉 | 工具的類型。 目前僅支援 function。可能的值: function |
Yes |
ParallelToolCalls
是否要在工具使用期間啟用平行函式呼叫。
未定義此元件的屬性。
PredictionContent
靜態預測輸出內容,例如要重新產生的文字檔案內容。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 字串或陣列 | 產生模型回應時應該相符的內容。 如果產生的權杖符合此內容,則可以更快速地傳回完整模型回應。 | Yes | |
| 型別 | 列舉 | 您想要提供的預測內容類型。 此類型目前一律為 content。可能的值: content |
Yes |
chatCompletionMessageToolCalls
模型所產生的工具呼叫,例如函式呼叫。
未定義此元件的屬性。
ChatCompletionModalities
您希望模型根據此要求產生的輸出類型。 大部分模型都能夠產生文字,這是預設值:
["text"]
gpt-4o-audio-preview 模型也可以用來產生音訊。 若要要求此模型同時產生文字和音訊回應,您可以使用:
["text", "audio"]
未定義此元件的屬性。
chatCompletionFunctionCall
已淘汰並取代為 tool_calls。 應呼叫函式的名稱和引數,如模型所產生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| arguments | 字串 | 呼叫函數所使用的引數,由模型以 JSON 格式產生。 請注意,模型不一定會產生有效的 JSON,而且可能會產生函式架構未定義的幻覺參數。 在呼叫函式之前,請先驗證程式代碼中的引數。 | Yes | |
| name | 字串 | 要呼叫的函式名稱。 | Yes |
completionUsage
完成要求的使用量統計資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| completion_tokens | 整數 | 已產生完成中的權杖數目。 | Yes | |
| completion_tokens_details | 物件 | 完成時所使用的權杖明細。 | No | |
| └─ 已接受的預測符號 | 整數 | 使用預測輸出時,在完成時出現的預測中的權杖數目。 | No | |
| └─ 音頻標籤 | 整數 | 模型所產生的音訊輸入權杖。 | No | |
| └─ 推理詞元 | 整數 | 模型為了推理所產生的權杖。 | No | |
| └─ rejected_prediction_tokens | 整數 | 使用預測輸出時,預測中未出現在完成中的標記數目。 不過,如同推理權杖,這些權杖仍會計入完成權杖總數中,以供計費、輸出和內容視窗限制之用。 | No | |
| prompt_tokens | 整數 | 提示中的權杖數目。 | Yes | |
| prompt_tokens_details | 物件 | 提示權杖的詳細資料。 | No | |
| └─ 音頻標籤 | 整數 | 提示中會出現音訊輸入權杖。 | No | |
| └─ cached_tokens | 整數 | 快取的提示權杖數目。 | No | |
| total_tokens | 整數 | 要求中使用的權杖總數 (提示 + 完成)。 | Yes |
chatCompletionTool
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | FunctionObject | Yes | ||
| 型別 | 列舉 | 工具的類型。 目前僅支援 function。可能的值: function |
Yes |
FunctionParameters
函式接受的參數,描述為 JSON 結構描述物件。 請參閱指南以取得範例,並參閱 JSON 結構描述參考以取得有關該格式的文件。
省略 parameters 定義具有空白參數清單的函式。
未定義此元件的屬性。
FunctionObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 函式用途的說明,由模型使用來選擇呼叫函式的時機和方式。 | No | |
| name | 字串 | 要呼叫之函式的名稱。 必須是 a-z、A-Z、0-9,或包含底線或虛線,長度上限為 64。 | Yes | |
| parameters | FunctionParameters | 函式接受的參數,描述為 JSON 結構描述物件。
請參閱指南以取得範例,並參閱 JSON 結構描述參考以取得有關該格式的文件。 省略 parameters 定義具有空白參數清單的函式。 |
No | |
| strict | boolean | 是否要在產生函數調用時啟用嚴格的架構遵循。 如果設為 true,模型將遵循 parameters 欄位中定義的確切結構描述。 當 strict 為 true 時,僅支援 JSON 結構描述的子集。 |
No | False |
ResponseFormatText
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 定義的回應格式類型:text可能的值: text |
Yes |
ResponseFormatJsonObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 定義的回應格式類型:json_object可能的值: json_object |
Yes |
ResponseFormatJsonSchemaSchema
回應格式的結構描述,描述為 JSON 結構描述物件。
未定義此元件的屬性。
ResponseFormatJsonSchema
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| json_schema | 物件 | Yes | ||
| └─ 描述 | 字串 | 回應格式用途的描述,模型用來決定如何以該格式進行回應。 | No | |
| \---- 名稱 | 字串 | 回應格式的名稱。 必須是 a-z、A-Z、0-9,或包含底線或虛線,長度上限為 64。 | No | |
| └─ 綱要 | ResponseFormatJsonSchemaSchema | 回應格式的結構描述,描述為 JSON 結構描述物件。 | No | |
| └─ 嚴格 | boolean | 是否要在產生輸出時啟用嚴格的架構遵循。 如果設為 true,模型將一律遵循 schema 欄位中定義的確切結構描述。 當 strict 為 true 時,僅支援 JSON 結構描述的子集。 |
No | False |
| 型別 | 列舉 | 定義的回應格式類型:json_schema可能的值: json_schema |
Yes |
chatCompletionChoiceCommon
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| finish_reason | 字串 | No | ||
| 索引 | 整數 | No |
createTranslationRequest
翻譯請求。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 檔案 | 字串 | 要翻譯的音訊檔案。 | Yes | |
| 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 提示應以英文顯示。 | No | |
| response_format | audioResponseFormat | 定義輸出的格式。 | No | |
| temperature | number | 取樣溫度,介於 0 到 1 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 如果設定為 0,模型會使用對數機率自動增加溫度,直到達到特定閾值為止。 | No | 0 |
audioResponse
response_format 為 json 時的翻譯或謄寫回應
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 字串 | 已翻譯或謄寫的文字。 | Yes |
audioVerboseResponse
response_format 為 verbose_json 時的翻譯或謄寫回應
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| duration | number | Duration. | No | |
| 語言 | 字串 | Language. | No | |
| segments | 陣列 | No | ||
| 工作 | 字串 | 音訊工作的類型。 | No | |
| 收發簡訊 | 字串 | 已翻譯或謄寫的文字。 | Yes | |
| words | 陣列 | No |
audioResponseFormat
定義輸出的格式。
| Property | Value |
|---|---|
| Description | 定義輸出的格式。 |
| Type | 字串 |
| Values | jsontextsrtverbose_jsonvtt |
createTranscriptionRequest
轉錄請求。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 檔案 | 字串 | 要謄寫的音訊檔案物件。 | Yes | |
| 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式提供輸入語言可改善精確度和延遲。 | No | |
| 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 提示應該符合音訊語言。 | No | |
| response_format | audioResponseFormat | 定義輸出的格式。 | No | |
| temperature | number | 取樣溫度,介於 0 到 1 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 如果設定為 0,模型會使用對數機率自動增加溫度,直到達到特定閾值為止。 | No | 0 |
| timestamp_granularities[] | 陣列 | 針對此謄寫填入的時間戳記細微度。
response_format 必須設定為 verbose_json 以使用時間戳記細微度。 支援使用這兩個選項之一或同時使用:word 或 segment。 注意:區段時間戳沒有額外的延遲,但產生文字時間戳會產生額外的延遲。 |
No | ['segment'] |
audioSegment
謄寫或翻譯區段。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| avg_logprob | number | 平均對數機率。 | No | |
| compression_ratio | number | 壓縮比。 | No | |
| end | number | 區段結束位移。 | No | |
| id | 整數 | 區段識別碼。 | No | |
| no_speech_prob | number | 「沒有語音」的機率。 | No | |
| seek | number | 區段的位移。 | No | |
| start | number | 區段起始位移。 | No | |
| temperature | number | Temperature. | No | |
| 收發簡訊 | 字串 | 區段文字。 | No | |
| tokens | 陣列 | 文字的權杖。 | No |
audioWord
謄寫或翻譯文字。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end | number | 文字結束位移。 | No | |
| start | number | 單字起始位移。 | No | |
| 字組 | 字串 | Word | No |
createSpeechRequest
演講請求。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 輸入 | 字串 | 要合成音訊的文字。 長度上限是 4,096 個字元。 | Yes | |
| response_format | 列舉 | 要用來合成音訊的格式。 可能的值: mp3、、、opusaacflac、wav、pcm |
No | |
| speed | number | 合成音訊的速度。 請選取 0.25 到 4.0 之間的值。
1.0 是預設值。 |
No | 1.0 |
| voice | 列舉 | 要用於語音合成的聲音。 可能的值: alloy、、、echofableonyx、nova、shimmer |
Yes |
imageQuality
將產生之影像的品質。
| Property | Value |
|---|---|
| Description | 將產生之影像的品質。 |
| Type | 字串 |
| Default | auto |
| Values | autohighmediumlowhdstandard |
imagesResponseFormat
傳回所產生影像的格式。
| Property | Value |
|---|---|
| Description | 傳回所產生影像的格式。 |
| Type | 字串 |
| Default | url |
| Values | urlb64_json |
imagesOutputFormat
傳回所產生影像的檔案格式。 僅支援系列機型。
| Property | Value |
|---|---|
| Description | 傳回所產生影像的檔案格式。 僅支援 GPT-Image-1 系列機型。 |
| Type | 字串 |
| Default | png |
| Values | pngjpeg |
imageSize
產生的映像大小。
| Property | Value |
|---|---|
| Description | 產生的映像大小。 |
| Type | 字串 |
| Default | auto |
| Values | auto1792x10241024x17921024x10241024x15361536x1024 |
imageStyle
所產生影像的樣式。 僅支援 dall-e-3。
| Property | Value |
|---|---|
| Description | 所產生影像的樣式。 僅支援 dall-e-3。 |
| Type | 字串 |
| Default | vivid |
| Values | vividnatural |
imageBackground
允許設定所產生影像背景的透明度。 此參數僅支援 gpt-image-1 系列模型。
| Property | Value |
|---|---|
| Description | 允許設定所產生影像背景的透明度。 此參數僅支援 gpt-image-1 系列模型。 |
| Type | 字串 |
| Default | auto |
| Values | transparentopaqueauto |
imageGenerationsRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 背景 | imageBackground | 允許設定所產生影像背景的透明度。 此參數僅支援 gpt-image-1 系列模型。 | No | auto |
| n | 整數 | 要產生的映像數目。 針對 dall-e-3,僅支持 n=1。 | No | 1 |
| output_compression | 整數 | 所產生影像的壓縮層級 (0-100%)。 此參數僅支援帶有 jpeg 輸出格式的 gpt-image-1 系列模型。 | No | 100 |
| output_format | imagesOutputFormat | 傳回所產生影像的檔案格式。 僅支援 GPT-Image-1 系列機型。 | No | png |
| 提示 | 字串 | 所需映像的文字描述。 GPT-image-1 系列型號的最大長度為 32000 字元,dall-e-3 則為 4000 字元 | Yes | |
| quality | imageQuality | 將產生之影像的品質。 | No | auto |
| response_format | imagesResponseFormat | 傳回所產生影像的格式。 僅支援 dall-e-3。 | No | url |
| size | imageSize | 產生的映像大小。 | No | auto |
| 樣式 | imageStyle | 所產生影像的樣式。 僅支援 dall-e-3。 | No | vivid |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 | No |
imageEditsRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 圖片 | 字串或陣列 | 要編輯的影像。 必須是支援的影像檔或影像陣列。 每個映像都應該是 png 或 jpg 檔案,小於 25MB。 | Yes | |
| 遮罩 | 字串 | 其他影像,其完全透明區域 (例如,其中 Alpha 為零) 表示應編輯影像的位置。 如果提供多個影像,遮罩將會套用至第一個影像。 必須是有效的 PNG 檔案,小於 4MB,且與影像具有相同的維度。 | No | |
| n | 整數 | 要產生的映像數目。 | No | 1 |
| 提示 | 字串 | 所需映像的文字描述。 最大長度為32000個字元。 | Yes | |
| quality | imageQuality | 將產生之影像的品質。 | No | auto |
| response_format | imagesResponseFormat | 傳回所產生影像的格式。 | No | url |
| size | imageSize | 產生的映像大小。 | No | auto |
| 使用者 | 字串 | 代表使用者的唯一識別碼,可協助監視和偵測濫用。 | No |
generateImagesResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created | 整數 | 作業建立時的 unix 時間戳記。 | Yes | |
| 資料 | 陣列 | 成功作業的結果資料 | Yes | |
| 使用方式 | imageGenerationsUsage | 表示影像產生要求的權杖使用詳細資料。 僅限於 gpt-image-1 系列機型。 | No |
imageResult
影像 URL 或編碼影像 (如果成功),否則傳回錯誤。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| b64_json | 字串 | base64 編碼影像 | No | |
| content_filter_results | dalleContentFilterResults | 內容篩選結果的相關資訊。 | No | |
| prompt_filter_results | dalleFilterResults | 有關內容篩選類別 (仇恨、性、暴力、自殘)、是否偵測到此類內容,以及嚴重性層級 (非常低、低、中、高,用來判定有害內容的強度和風險層級),和內容是否已篩選的資訊。 有關越獄內容和粗話、是否偵測到此類內容,以及內容是否已篩選的資訊。 有關客戶封鎖清單、清單是否已篩選及其識別碼的資訊。 | No | |
| revised_prompt | 字串 | 用來產生影像的提示 (如果提示有任何修訂)。 | No | |
| url | 字串 | 影像 URL。 | No |
imageGenerationsUsage
表示影像產生要求的權杖使用詳細資料。 僅限於 gpt-image-1 系列機型。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| input_tokens | 整數 | 輸入令牌的數目。 | No | |
| input_tokens_details | 物件 | 輸入權杖的詳細明細。 | No | |
| └─ 圖像標記 | 整數 | 影像權杖的數目。 | No | |
| └─ text_tokens | 整數 | 文字標記的數目。 | No | |
| output_tokens | 整數 | 輸出令牌的數目。 | No | |
| total_tokens | 整數 | 使用的令牌總數。 | No |
線條
由相鄰的內容元素序列組成的內容行物件,例如文字和選取標記。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| spans | 陣列 | 一個範圍陣列,代表偵測到的物件及其週框方塊資訊。 | Yes | |
| 收發簡訊 | 字串 | Yes |
span
一個範圍物件,代表偵測到的物件及其週框方塊資訊。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| length | 整數 | 以字元為單位的範圍長度,以 Unicode 字碼指標測量。 | Yes | |
| 位移 | 整數 | 文字內範圍開始處的字元位移。 此位移會定義為範圍內第一個字元的位置,從文字開頭處以 Unicode 字碼指標計數。 | Yes | |
| 多邊形 | 陣列 | 一個物件陣列,代表偵測到的物件週圍的多邊形中的點。 | Yes | |
| 收發簡訊 | 字串 | 代表偵測到之物件的範圍文字內容。 | Yes |
runCompletionUsage
與執行相關的使用量統計資料。 如果執行並非處於終端狀態 (即 null、in_progress 等),此值將是 queued。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| completion_tokens | 整數 | 在執行過程中使用的完成權杖數目。 | Yes | |
| prompt_tokens | 整數 | 在執行過程中使用的提示權杖數目。 | Yes | |
| total_tokens | 整數 | 使用的權杖總數 (提示 + 完成)。 | Yes |
runStepCompletionUsage
與執行步驟相關的使用量統計資料。 當執行步驟的狀態為 null 時,此值將是 in_progress。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| completion_tokens | 整數 | 在執行步驟過程中使用的完成權杖數目。 | Yes | |
| prompt_tokens | 整數 | 在執行步驟過程中使用的提示權杖數目。 | Yes | |
| total_tokens | 整數 | 使用的權杖總數 (提示 + 完成)。 | Yes |
assistantsApiResponseFormatOption
指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。
設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。
設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。
重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。
此元件可以是下列其中之一:
assistantsApiResponseFormat
描述模型預期輸出的物件。 若為 json_object,則僅允許將 function 類型 tools 傳遞至執行。 若為 text,則模型可傳回文字或所需的任何值。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 字串 | 必須是 text 或 json_object 其中之一。 |
No | 收發簡訊 |
類型列舉:AssistantsApiResponseFormat
| Value | Description |
|---|---|
| 收發簡訊 | |
| json_object |
assistantObject
代表可呼叫模型並使用工具的 assistant。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created_at | 整數 | 助理建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| description | 字串 | 助理的描述。 長度上限為 512 個字元。 |
Yes | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| instructions | 字串 | 助理所使用的系統指示。 長度上限為 256,000 個字元。 |
Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| 型號 | 字串 | 要使用的模型識別碼。 | Yes | |
| name | 字串 | 助理的名稱。 最大長度為 256 個字元。 |
Yes | |
| 物件 | 字串 | 物件類型,一律為 assistant。 |
Yes | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此助理之向量存放區的識別碼。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 在助理上啟用的工具清單。 每個助理最多可以有 128 個工具。 工具可以屬於 code_interpreter、file_search 或 function 類型。 |
Yes | [] |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
物件列舉:AssistantObjectType
| Value | Description |
|---|---|
| 助理 | 物件類型,一律為助理 |
createAssistantRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 助理的描述。 長度上限為 512 個字元。 |
No | |
| instructions | 字串 | 助理所使用的系統指示。 長度上限為 256,000 個字元。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | Yes | ||
| name | 字串 | 助理的名稱。 最大長度為 256 個字元。 |
No | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此助理的向量存放區。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| └─ 向量存儲 | 陣列 | 一個協助程式,用來建立具有 file_ids 的向量存放區,並將其附加至此助理。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 在助理上啟用的工具清單。 每個助理最多可以有 128 個工具。 工具可以屬於 code_interpreter、retrieval 或 function 類型。 |
No | [] |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
modifyAssistantRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 助理的描述。 長度上限為 512 個字元。 |
No | |
| instructions | 字串 | 助理所使用的系統指示。 長度上限為 32768 個字元。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | No | ||
| name | 字串 | 助理的名稱。 最大長度為 256 個字元。 |
No | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 覆寫可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 覆寫附加至此助理的向量存放區。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 在助理上啟用的工具清單。 每個助理最多可以有 128 個工具。 工具可以屬於 code_interpreter、retrieval 或 function 類型。 |
No | [] |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
deleteAssistantResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deleted | boolean | Yes | ||
| id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
物件列舉:DeleteAssistantResponseState
| Value | Description |
|---|---|
| assistant.deleted |
listAssistantsResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
assistantToolsCode
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 字串 | 正在定義的工具類型:code_interpreter |
Yes |
類型列舉:assistantToolsCodeType
| Value | Description |
|---|---|
| code_interpreter |
assistantToolsFileSearch
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_search | 物件 | 檔案搜尋工具的覆寫。 | No | |
| └─ max_num_results (最大結果數量) | 整數 | 檔案搜尋工具應輸出的結果數目上限。 gpt-4* 模型的預設值為 20,gpt-3.5-turbo 的預設值為 5。 此數字應介於 1 到 50 之間。 請注意,檔案搜尋工具可能會輸出少於 max_num_results 個結果。 |
No | |
| 型別 | 字串 | 正在定義的工具類型:file_search |
Yes |
類型列舉:assistantToolsFileSearchType
| Value | Description |
|---|---|
| file_search |
assistantToolsFileSearchTypeOnly
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 字串 | 正在定義的工具類型:file_search |
Yes |
類型列舉:assistantToolsFileSearchType
| Value | Description |
|---|---|
| file_search |
assistantToolsFunction
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | 函式定義。 | Yes | |
| └─ 描述 | 字串 | 函式用途的說明,由模型使用來選擇呼叫函式的時機和方式。 | No | |
| \---- 名稱 | 字串 | 要呼叫之函式的名稱。 必須是 a-z、A-Z、0-9,或包含底線或虛線,長度上限為 64。 | No | |
| └─ 參數 | chatCompletionFunctionParameters | 函式接受的參數,描述為 JSON 結構描述物件。 請參閱指南/ 以取得範例,並參閱 JSON 結構描述參考以取得有關該格式的文件。 | No | |
| 型別 | 字串 | 正在定義的工具類型:function |
Yes |
類型列舉:assistantToolsFunction
| Value | Description |
|---|---|
| 函式 |
truncationObject
決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| last_messages | 整數 | 建構執行的內容時,執行緒中最新的訊息數目。 | No | |
| 型別 | 字串 | 要用於執行緒的截斷策略。 預設值為 auto。 如果設定為 last_messages,執行緒將會截斷為執行緒中的 n 個最新訊息。 設定為 auto 時,將會捨棄執行緒中間的訊息以符合模型的內容長度 max_prompt_tokens。 |
Yes |
類型列舉:TruncationType
| Value | Description |
|---|---|
| auto | |
| last_messages |
assistantsApiToolChoiceOption
控制模型所呼叫的工具 (若有)。
none 表示模型不會呼叫任何工具,而是會產生訊息。
auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。
指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。
此元件可以是下列其中之一:
assistantsNamedToolChoice
指定模型應使用的工具。 用來強制模型呼叫特定工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | No | ||
| \---- 名稱 | 字串 | 要呼叫的函式名稱。 | No | |
| 型別 | 字串 | 工具的類型。 如果類型為 function,則必須設定函式名稱 |
Yes |
類型列舉:AssistantsNamedToolChoiceType
| Value | Description |
|---|---|
| 函式 | |
| code_interpreter | |
| file_search |
runObject
表示在執行緒上進行的執行。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| assistant_id | 字串 | 用來執行此執行的助理識別碼。 | Yes | |
| cancelled_at | 整數 | 執行取消時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| completed_at | 整數 | 執行完成時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| created_at | 整數 | 執行建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| expires_at | 整數 | 執行到期時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| failed_at | 整數 | 執行失敗時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| incomplete_details | 物件 | 執行不完整的詳細原因。 如果執行不完整,則為 null。 |
Yes | |
| |---- 原因 | 字串 | 執行不完整的原因。 這會指出在執行的過程中達到的特定權杖限制。 | No | |
| instructions | 字串 | 助理用於此執行的指示。 | Yes | |
| last_error | 物件 | 與此執行相關聯的最後一個錯誤。 如果沒有任何錯誤,則為 null。 |
Yes | |
| └─ 程式碼 | 字串 |
server_error 或 rate_limit_exceeded 的其中之一。 |
No | |
| |---- 訊息 | 字串 | 人類看得懂的錯誤描述。 | No | |
| max_completion_tokens | 整數 | 在執行過程中指定為已使用的完成權杖數目上限。 |
Yes | |
| max_prompt_tokens | 整數 | 在執行過程中指定為已使用的提示權杖數目上限。 |
Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| 型號 | 字串 | 助理用於此執行的模型。 | Yes | |
| 物件 | 字串 | 物件類型,一律為 thread.run。 |
Yes | |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| required_action | 物件 | 繼續執行所需之動作的詳細資料。 若不需要任何動作,則為 null。 |
Yes | |
| └─ submit_tool_outputs | 物件 | 此執行繼續進行所需的工具輸出詳細資料。 | No | |
| └─ tool_calls | 陣列 | 相關工具呼叫的清單。 | No | |
| \---- 類型 | 列舉 | 目前,這一律為 submit_tool_outputs。可能的值: submit_tool_outputs |
No | |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
Yes | |
| started_at | 整數 | 執行啟動時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| 狀態 | 字串 | 執行的狀態,可以是 queued、in_progress、requires_action、cancelling、cancelled、failed、completed 或 expired。 |
Yes | |
| temperature | number | 這次執行所使用的取樣溫度。 若未設定,則預設為 1。 | No | |
| thread_id | 字串 | 作為此次運行的一部分所執行的線程的識別碼。 | Yes | |
| tool_choice | assistantsApiToolChoiceOption | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫任何工具,而是會產生訊息。auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。 |
Yes | |
| tools | 陣列 | 助理用於此執行的工具清單。 | Yes | [] |
| top_p | number | 這次執行所使用的核取樣值。 若未設定,則預設為 1。 | No | |
| truncation_strategy | truncationObject | 決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。 | Yes | |
| 使用方式 | runCompletionUsage | 與執行相關的使用量統計資料。 如果執行並非處於終端狀態 (即 null、in_progress 等),此值將是 queued。 |
Yes |
物件列舉:runObjectType
| Value | Description |
|---|---|
| thread.run | 執行物件類型,一律為 thread.run |
狀態列舉:RunObjectStatus
| Value | Description |
|---|---|
| queued | 已排入佇列狀態 |
| in_progress | in_progress 狀態 |
| requires_action | required_action 狀態 |
| cancelling | 取消中狀態 |
| cancelled | 已取消狀態 |
| failed | 失敗狀態 |
| completed | 已完成狀態 |
| expired | 過期狀態 |
createRunRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| additional_instructions | 字串 | 在執行的指令結尾附加其他指令。 這有助於修改個別執行的行為,而無須覆寫其他指令。 | No | |
| additional_messages | 陣列 | 在建立執行之前,將其他訊息新增至執行緒。 | No | |
| assistant_id | 字串 | 用來執行此執行的助理識別碼。 | Yes | |
| instructions | 字串 | 覆寫助理的預設系統訊息。 這有助於修改個別執行的行為。 | No | |
| max_completion_tokens | 整數 | 在執行過程中可能使用的完成權杖數目上限。 執行會盡可能在多個執行回合中僅使用指定數目的完成語彙基元。 如果執行超過指定的完成權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| max_prompt_tokens | 整數 | 在執行過程中可能使用的提示權杖數目上限。 執行過程會在每個回合中盡量只使用指定數量的提示令牌。 如果執行超過指定的提示權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | 要用來執行此執行的模型識別碼。 在這裡提供的值將會覆寫與助理相關聯的模型。 若未提供,則會使用與助理相關聯的模型。 | No | |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| tool_choice | assistantsApiToolChoiceOption | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫任何工具,而是會產生訊息。auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。 |
No | |
| tools | 陣列 | 覆寫助理可用於此執行的工具。 這有助於修改個別執行的行為。 | No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
| truncation_strategy | truncationObject | 決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。 | No |
listRunsResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
modifyRunRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No |
submitToolOutputsRunRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| tool_outputs | 陣列 | 要提交輸出的工具清單。 | Yes |
runToolCallObject
工具呼叫物件
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | 函式定義。 | Yes | |
| └─ 論點 | 字串 | 模型預期要傳遞至函式的引數。 | No | |
| \---- 名稱 | 字串 | 函數的名稱。 | No | |
| id | 字串 | 工具呼叫的識別碼。 當您使用提交要執行端點的工具輸出時,必須在提交工具輸出時參考此識別碼。 | Yes | |
| 型別 | 字串 | 需要輸出的工具呼叫類型。 目前,這一律為 function。 |
Yes |
類型列舉:RunToolCallObjectType
| Value | Description |
|---|---|
| 函式 |
createThreadAndRunRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| assistant_id | 字串 | 用來執行此執行的助理識別碼。 | Yes | |
| instructions | 字串 | 覆寫助理的預設系統訊息。 這有助於修改個別執行的行為。 | No | |
| max_completion_tokens | 整數 | 在執行過程中可能使用的完成權杖數目上限。 執行會盡可能在多個執行回合中僅使用指定數目的完成語彙基元。 如果執行超過指定的完成權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| max_prompt_tokens | 整數 | 在執行過程中可能使用的提示權杖數目上限。 執行過程會在每個回合中盡量只使用指定數量的提示令牌。 如果執行超過指定的提示權杖數目,執行將會以狀態 incomplete 結束。 如需詳細資訊,請參閱 incomplete_details。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 型號 | 字串 | 要用來執行此執行之模型的標識碼。 在這裡提供的值將會覆寫與助理相關聯的模型。 若未提供,則會使用與助理相關聯的模型。 | No | |
| parallel_tool_calls | ParallelToolCalls | 是否要在工具使用期間啟用平行函式呼叫。 | No | True |
| response_format | assistantsApiResponseFormatOption | 指定模型必須輸出的格式。 與 GPT-4o、GPT-4 Turbo 和 gpt-3.5-turbo-1106 之後的所有 GPT-3.5 Turbo 模型相容。設定為 { "type": "json_schema", "json_schema": {...} } 可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 如需詳細資訊,請參閱「結構化輸出」指南。設定為 { "type": "json_object" } 會啟用 JSON 模式,確保模型產生的訊息為有效的 JSON。重要:使用 JSON 模式時,您也必須透過系統或使用者訊息指示模型自行產生 JSON。 否則,模型可能會產生一連串無止境的空白字元,直到產生作業達到語彙基元限制,因而導致要求長時間執行,且看似「停滯」。 另請注意,如果 finish_reason="length" 表示訊息產生超過 max_tokens 或對話超過最大內容長度,則訊息可能會遭部分截斷。 |
No | |
| 串流 | boolean | 若為 true,則會傳回在以伺服器傳送的事件形式執行期間發生,並在執行進入終端狀態且顯示 data: [DONE] 訊息時終止的事件資料流。 |
No | |
| stream_options | chatCompletionStreamOptions | 串流回應的選項。 只有當您設定 stream: true 時,才需要設定此選項。 |
No | None |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 |
No | 1 |
| 執行緒 | createThreadRequest | No | ||
| tool_choice | assistantsApiToolChoiceOption | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫任何工具,而是會產生訊息。auto 是預設值,表示模型可以選擇產生訊息或呼叫工具。指定 {"type": "file_search"} 或 {"type": "function", "function": {"name": "my_function"}} 等特定工具,會強制模型呼叫該工具。 |
No | |
| tool_resources | 物件 | 助理的工具所使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此助理之向量存放區的識別碼。 最多可以有 1 個向量存放區附加至助理。 |
No | |
| tools | 陣列 | 覆寫助理可用於此執行的工具。 這有助於修改個別執行的行為。 | No | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或溫度,但不建議同時改變。 |
No | 1 |
| truncation_strategy | truncationObject | 決定在執行之前如何截斷執行緒的控制項。 使用此項目,可控制執行的初始內容視窗。 | No |
threadObject
代表包含訊息的執行緒。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created_at | 整數 | 執行緒建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| 物件 | 字串 | 物件類型,一律為 thread。 |
Yes | |
| tool_resources | 物件 | 可供此執行緒中的助理工具使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
Yes | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此執行緒的向量存放區。 最多可以有 1 個向量存放區附加至執行緒。 |
No |
物件列舉:ThreadObjectType
| Value | Description |
|---|---|
| 執行緒 | 一律為 thread 的執行緒物件類型 |
createThreadRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| messages | 陣列 | 要啟動線程的訊息清單。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| tool_resources | 物件 | 可供此執行緒中的助理工具使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此執行緒的向量存放區。 最多可以有 1 個向量存放區附加至執行緒。 |
No | |
| └─ 向量存儲 | 陣列 | 一個協助程式,用來建立具有 file_ids 的向量存放區,並將其附加至此執行緒。 最多可以有 1 個向量存放區附加至執行緒。 |
No |
modifyThreadRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| tool_resources | 物件 | 可供此執行緒中的助理工具使用的一組資源。 工具的類型專用的資源。 例如,code_interpreter 工具需要檔案識別碼的清單,而 file_search 工具則需要向量存放區識別碼的清單。 |
No | |
| └─ 程式解釋器 | 物件 | No | ||
| └─ file_ids | 陣列 | 可供 code_interpreter 工具使用的檔案識別碼清單。 最多可以有 20 個檔案與工具相關聯。 |
No | [] |
| └─ 文件搜尋 | 物件 | No | ||
| └─ 向量存儲識別碼 | 陣列 | 附加至此執行緒的向量存放區。 最多可以有 1 個向量存放區附加至執行緒。 |
No |
deleteThreadResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deleted | boolean | Yes | ||
| id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
物件列舉:DeleteThreadResponseObjectState
| Value | Description |
|---|---|
| thread.deleted | 刪除執行緒回應物件狀態 (thread.deleted) |
listThreadsResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
messageObject
表示線程內的訊息。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| assistant_id | 字串 | 撰寫此訊息的助理識別碼 (如果適用)。 | Yes | |
| attachments | 陣列 | 附加至訊息的檔案清單,和已新增檔案的工具。 | Yes | |
| completed_at | 整數 | 訊息完成時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| 內容 | 陣列 | 文字和/或影像陣列中的訊息內容。 | Yes | |
| created_at | 整數 | 訊息建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| incomplete_at | 整數 | 訊息標示為不完整時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| incomplete_details | 物件 | 對於不完整的訊息,詳細說明訊息不完整的原因。 | Yes | |
| |---- 原因 | 字串 | 訊息不完整的原因。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| 物件 | 字串 | 物件類型,一律為 thread.message。 |
Yes | |
| 角色 | 字串 | 產生訊息的實體。
user 或 assistant 的其中之一。 |
Yes | |
| run_id | 字串 | 與此訊息的撰寫相關聯的執行識別碼 (如果適用)。 | Yes | |
| 狀態 | 字串 | 訊息的狀態,可以是 in_progress、incomplete 或 completed。 |
Yes | |
| thread_id | 字串 | 此訊息所屬的線程標識碼。 | Yes |
物件列舉:MessageObjectType
| Value | Description |
|---|---|
| thread.message | 訊息物件類型 (thread.message) |
狀態列舉:MessageObjectStatus
| Value | Description |
|---|---|
| in_progress | |
| incomplete | |
| completed |
角色列舉:MessageObjectRole
| Value | Description |
|---|---|
| 使用者 | |
| 助理 |
messageDeltaObject
代表訊息差異,也就是訊息在串流處理期間的任何欄位變更。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 物件 | 包含訊息中已變更欄位的差異。 | Yes | |
| \---- 內容 | 陣列 | 文字和/或影像陣列中的訊息內容。 | No | |
| └─ 角色 | 字串 | 產生訊息的實體。
user 或 assistant 的其中之一。 |
No | |
| id | 字串 | 訊息的識別碼,可在 API 端點中參考。 | Yes | |
| 物件 | 字串 | 物件類型,一律為 thread.message.delta。 |
Yes |
物件列舉:MessageDeltaObjectType
| Value | Description |
|---|---|
| thread.message.delta |
createMessageRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| attachments | 陣列 | 附加至訊息的檔案清單,以及應新增檔案的工具。 | No | |
| 內容 | 字串 | 訊息的內容。 | Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| 角色 | 字串 | 正在建立訊息的實體角色。 允許的值包括: - user:表示訊息由實際使用者所傳送,且多數情況下應用來代表使用者產生的訊息。- assistant:表示訊息由助理所產生。 使用此值,將來自助理的訊息插入對話中。 |
Yes |
角色列舉:CreateMessageRequestRole
| Value | Description |
|---|---|
| 使用者 | |
| 助理 |
modifyMessageRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No |
deleteMessageResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deleted | boolean | Yes | ||
| id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
物件列舉:DeleteMessageResponseObject
| Value | Description |
|---|---|
| thread.message.deleted | 刪除訊息回應物件的狀態 |
listMessagesResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
messageContentImageFileObject
參考訊息內容中的影像檔案。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| image_file | 物件 | Yes | ||
| └─ file_id | 字串 | 訊息內容中所含影像的檔案識別碼。 | No | |
| 型別 | 字串 | 一律為 image_file。 |
Yes |
類型列舉:MessageContentImageFileObjectType
| Value | Description |
|---|---|
| image_file | 訊息內容影像檔案類型 |
messageContentTextObject
屬於訊息一部分的文字內容。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 物件 | Yes | ||
| └─ 註釋 | 陣列 | No | ||
| └─ 價值 | 字串 | 組成文字的資料。 | No | |
| 型別 | 字串 | 一律為 text。 |
Yes |
類型列舉:messageContentTextObjectType
| Value | Description |
|---|---|
| 收發簡訊 | 訊息內容文字物件類型 |
messageContentTextAnnotationsFileCitationObject
訊息內的引文,指向與助理或訊息相關聯的特定檔案中的特定引用。 在助理使用「擷取」工具來搜尋檔案時產生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end_index | 整數 | Yes | ||
| file_citation | 物件 | Yes | ||
| └─ file_id | 字串 | 引文的具體來源檔案的識別碼。 | No | |
| start_index | 整數 | Yes | ||
| 收發簡訊 | 字串 | 訊息內容中需要取代的文字。 | Yes | |
| 型別 | 字串 | 一律為 file_citation。 |
Yes |
類型列舉:FileCitationObjectType
| Value | Description |
|---|---|
| file_citation | 檔案引文物件類型 |
messageContentTextAnnotationsFilePathObject
助理使用 code_interpreter 工具產生檔案時所產生之檔案的 URL。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end_index | 整數 | Yes | ||
| file_path | 物件 | Yes | ||
| └─ file_id | 字串 | 已產生之檔案的識別碼。 | No | |
| start_index | 整數 | Yes | ||
| 收發簡訊 | 字串 | 訊息內容中需要取代的文字。 | Yes | |
| 型別 | 字串 | 一律為 file_path。 |
Yes |
類型列舉:FilePathObjectType
| Value | Description |
|---|---|
| file_path | 檔案路徑物件類型 |
messageDeltaContentImageFileObject
參考訊息內容中的影像檔案。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| image_file | 物件 | No | ||
| └─ file_id | 字串 | 訊息內容中所含影像的檔案識別碼。 | No | |
| 索引 | 整數 | 訊息中內容組件的索引。 | Yes | |
| 型別 | 字串 | 一律為 image_file。 |
Yes |
類型列舉:MessageDeltaContentImageFileObjectType
| Value | Description |
|---|---|
| image_file |
messageDeltaContentTextObject
屬於訊息一部分的文字內容。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 索引 | 整數 | 訊息中內容組件的索引。 | Yes | |
| 收發簡訊 | 物件 | No | ||
| └─ 註釋 | 陣列 | No | ||
| └─ 價值 | 字串 | 組成文字的資料。 | No | |
| 型別 | 字串 | 一律為 text。 |
Yes |
類型列舉:MessageDeltaContentTextObjectType
| Value | Description |
|---|---|
| 收發簡訊 |
messageDeltaContentTextAnnotationsFileCitationObject
訊息內的引文,指向與助理或訊息相關聯的特定檔案中的特定引用。 在助理使用 "file_search" 工具來搜尋檔案時產生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end_index | 整數 | No | ||
| file_citation | 物件 | No | ||
| └─ file_id | 字串 | 引文的具體來源檔案的識別碼。 | No | |
| └─ 引用 | 字串 | 檔案中的特定引用。 | No | |
| 索引 | 整數 | 文字內容組件中註釋的索引。 | Yes | |
| start_index | 整數 | No | ||
| 收發簡訊 | 字串 | 訊息內容中需要取代的文字。 | No | |
| 型別 | 字串 | 一律為 file_citation。 |
Yes |
類型列舉:MessageDeltaContentTextAnnotationsFileCitationObjectType
| Value | Description |
|---|---|
| file_citation |
messageDeltaContentTextAnnotationsFilePathObject
助理使用 code_interpreter 工具產生檔案時所產生之檔案的 URL。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end_index | 整數 | No | ||
| file_path | 物件 | No | ||
| └─ file_id | 字串 | 已產生之檔案的識別碼。 | No | |
| 索引 | 整數 | 文字內容組件中註釋的索引。 | Yes | |
| start_index | 整數 | No | ||
| 收發簡訊 | 字串 | 訊息內容中需要取代的文字。 | No | |
| 型別 | 字串 | 一律為 file_path。 |
Yes |
類型列舉:MessageDeltaContentTextAnnotationsFilePathObjectType
| Value | Description |
|---|---|
| file_path |
runStepObject
代表執行中的步驟。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| assistant_id | 字串 | 與執行步驟相關聯的助理識別碼。 | Yes | |
| cancelled_at | 整數 | 執行步驟取消時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| completed_at | 整數 | 執行步驟完成時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| created_at | 整數 | 執行步驟建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| expired_at | 整數 | 執行步驟到期時的 Unix 時間戳記 (以秒為單位)。 如果父執行已過期,則會將步驟視為過期。 | Yes | |
| failed_at | 整數 | 執行步驟失敗時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 執行步驟的識別碼,可在 API 端點中參考。 | Yes | |
| last_error | 物件 | 與此執行步驟相關聯的最後一個錯誤。 如果沒有任何錯誤,則為 null。 |
Yes | |
| └─ 程式碼 | 字串 |
server_error 或 rate_limit_exceeded 的其中之一。 |
No | |
| |---- 訊息 | 字串 | 人類看得懂的錯誤描述。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| 物件 | 字串 | 物件類型,一律為 assistant.run.step。 |
Yes | |
| run_id | 字串 | 此執行步驟所屬的執行識別碼。 | Yes | |
| 狀態 | 字串 | 執行的狀態,可以是 in_progress、cancelled、failed、completed 或 expired。 |
Yes | |
| step_details | runStepDetailsMessageCreationObject 或 runStepDetailsToolCallsObject | 執行步驟的詳細資料。 | Yes | |
| thread_id | 字串 | 執行之線程的標識碼。 | Yes | |
| 型別 | 字串 | 執行步驟的類型,可以是 message_creation 或 tool_calls。 |
Yes |
物件列舉:RunStepObjectType
| Value | Description |
|---|---|
| assistant.run.step | 物件類型,一律為 assistant.run.step |
類型列舉:RunStepObjectType
| Value | Description |
|---|---|
| message_creation | message_creation 執行步驟 |
| tool_calls | tool_calls 執行步驟 |
狀態列舉:RunStepObjectStatus
| Value | Description |
|---|---|
| in_progress | in_progress 執行狀態 |
| cancelled | 已取消執行狀態 |
| failed | 已取消執行狀態 |
| completed | 已取消執行狀態 |
| expired | 已取消執行狀態 |
runStepDeltaObject
代表執行步驟差異,也就是執行步驟在串流處理期間的任何欄位變更。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 物件 | 包含執行步驟中已變更欄位的差異。 | Yes | |
| └─ 步驟細節 | runStepDeltaStepDetailsMessageCreationObject 或 runStepDeltaStepDetailsToolCallsObject | 執行步驟的詳細資料。 | No | |
| id | 字串 | 執行步驟的識別碼,可在 API 端點中參考。 | Yes | |
| 物件 | 字串 | 物件類型,一律為 thread.run.step.delta。 |
Yes |
物件列舉:RunStepDeltaObjectType
| Value | Description |
|---|---|
| thread.run.step.delta |
listRunStepsResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
runStepDetailsMessageCreationObject
執行步驟建立訊息的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| message_creation | 物件 | Yes | ||
| └─ 訊息識別碼 | 字串 | 此執行步驟所建立之訊息的識別碼。 | No | |
| 型別 | 字串 | 一律為 message_creation。 |
Yes |
類型列舉:RunStepDetailsMessageCreationObjectType
| Value | Description |
|---|---|
| message_creation |
runStepDeltaStepDetailsMessageCreationObject
執行步驟建立訊息的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| message_creation | 物件 | No | ||
| └─ 訊息識別碼 | 字串 | 此執行步驟所建立之訊息的識別碼。 | No | |
| 型別 | 字串 | 一律為 message_creation。 |
Yes |
類型列舉:RunStepDeltaStepDetailsMessageCreationObjectType
| Value | Description |
|---|---|
| message_creation |
runStepDetailsToolCallsObject
工具呼叫的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| tool_calls | 陣列 | 執行步驟所涉及的工具呼叫陣列。 可以與下列三種類型的工具之一相關聯:code_interpreter、retrieval 或 function。 |
Yes | |
| 型別 | 字串 | 一律為 tool_calls。 |
Yes |
類型列舉:RunStepDetailsToolCallsObjectType
| Value | Description |
|---|---|
| tool_calls |
runStepDeltaStepDetailsToolCallsObject
工具呼叫的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| tool_calls | 陣列 | 執行步驟所涉及的工具呼叫陣列。 可以與下列三種類型的工具之一相關聯:code_interpreter、file_search 或 function。 |
No | |
| 型別 | 字串 | 一律為 tool_calls。 |
Yes |
類型列舉:RunStepDeltaStepDetailsToolCallsObjectType
| Value | Description |
|---|---|
| tool_calls |
runStepDetailsToolCallsCodeObject
執行步驟所涉及的程式碼解譯器工具呼叫的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| code_interpreter | 物件 | 程式碼解譯器工具呼叫定義。 | Yes | |
| └─ 輸入 | 字串 | 程式碼解譯器工具呼叫的輸入。 | No | |
| └─ 輸出 | 陣列 | 程式碼解譯器工具呼叫的輸出。 程式碼解譯器可輸出一或多個項目,包括文字 (logs) 或影像 (image)。 每個項目分別以不同的物件類型代表。 |
No | |
| id | 字串 | 工具呼叫的識別碼。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 code_interpreter。 |
Yes |
類型列舉:RunStepDetailsToolCallsCodeObjectType
| Value | Description |
|---|---|
| code_interpreter |
runStepDeltaStepDetailsToolCallsCodeObject
執行步驟所涉及的程式碼解譯器工具呼叫的詳細資料。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| code_interpreter | 物件 | 程式碼解譯器工具呼叫定義。 | No | |
| └─ 輸入 | 字串 | 程式碼解譯器工具呼叫的輸入。 | No | |
| └─ 輸出 | 陣列 | 程式碼解譯器工具呼叫的輸出。 程式碼解譯器可輸出一或多個項目,包括文字 (logs) 或影像 (image)。 每個項目分別以不同的物件類型代表。 |
No | |
| id | 字串 | 工具呼叫的識別碼。 | No | |
| 索引 | 整數 | 工具呼叫陣列中所含工具呼叫的索引。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 code_interpreter。 |
Yes |
類型列舉:RunStepDeltaStepDetailsToolCallsCodeObjectType
| Value | Description |
|---|---|
| code_interpreter |
runStepDetailsToolCallsCodeOutputLogsObject
執行步驟中的程式碼解譯器工具呼叫的文字輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 記錄 | 字串 | 程式碼解譯器工具呼叫的文字輸出。 | Yes | |
| 型別 | 字串 | 一律為 logs。 |
Yes |
類型列舉:RunStepDetailsToolCallsCodeOutputLogsObjectType
| Value | Description |
|---|---|
| 記錄 |
runStepDeltaStepDetailsToolCallsCodeOutputLogsObject
執行步驟中的程式碼解譯器工具呼叫的文字輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 索引 | 整數 | 輸出陣列中所含輸出的索引。 | Yes | |
| 記錄 | 字串 | 程式碼解譯器工具呼叫的文字輸出。 | No | |
| 型別 | 字串 | 一律為 logs。 |
Yes |
類型列舉:RunStepDeltaStepDetailsToolCallsCodeOutputLogsObjectType
| Value | Description |
|---|---|
| 記錄 |
runStepDetailsToolCallsCodeOutputImageObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 圖片 | 物件 | Yes | ||
| └─ file_id | 字串 | 影像的檔案識別碼。 | No | |
| 型別 | 字串 | 一律為 image。 |
Yes |
類型列舉:RunStepDetailsToolCallsCodeOutputImageObjectType
| Value | Description |
|---|---|
| 圖片 |
runStepDeltaStepDetailsToolCallsCodeOutputImageObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 圖片 | 物件 | No | ||
| └─ file_id | 字串 | 影像的檔案識別碼。 | No | |
| 索引 | 整數 | 輸出陣列中所含輸出的索引。 | Yes | |
| 型別 | 字串 | 一律為 image。 |
Yes |
類型列舉:RunStepDeltaStepDetailsToolCallsCodeOutputImageObject
| Value | Description |
|---|---|
| 圖片 |
runStepDetailsToolCallsFileSearchObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_search | 物件 | 目前,這一律會是空物件。 | Yes | |
| └─ 結果 | 陣列 | 檔案搜尋的結果。 | No | |
| id | 字串 | 工具呼叫物件的識別碼。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 file_search。 |
Yes |
類型 Enum:RunStepDetailsToolCallsFileSearchObjectType
| Value | Description |
|---|---|
| file_search |
runStepDetailsToolCallsFileSearchResultObject
檔案搜尋的結果實例。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 陣列 | 找到的結果內容。 只有在透過 include 查詢參數要求時,才會包含該內容。 | No | |
| file_id | 字串 | 結果所在的檔案識別碼。 | Yes | |
| file_name | 字串 | 結果所在的檔案名稱。 | Yes | |
| 分數 | number | 結果的分數。 所有值都必須是介於 0 到 1 之間的浮點數。 | Yes |
runStepDeltaStepDetailsToolCallsFileSearchObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_search | 物件 | 目前,這一律會是空物件。 | Yes | |
| id | 字串 | 工具呼叫物件的識別碼。 | No | |
| 索引 | 整數 | 工具呼叫陣列中所含工具呼叫的索引。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 retrieval。 |
Yes |
類型列舉:RunStepDeltaStepDetailsToolCallsFileSearchObjectType
| Value | Description |
|---|---|
| file_search |
runStepDetailsToolCallsFunctionObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | 已呼叫之函式的定義。 | Yes | |
| └─ 論點 | 字串 | 傳遞至函式的引數。 | No | |
| \---- 名稱 | 字串 | 函數的名稱。 | No | |
| └─ 輸出 | 字串 | 函式的輸出。 如果輸出尚未提交,則為 null。 |
No | |
| id | 字串 | 工具呼叫物件的識別碼。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 function。 |
Yes |
類型列舉:RunStepDetailsToolCallsFunctionObjectType
| Value | Description |
|---|---|
| 函式 |
runStepDeltaStepDetailsToolCallsFunctionObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 函式 | 物件 | 已呼叫之函式的定義。 | No | |
| └─ 論點 | 字串 | 傳遞至函式的引數。 | No | |
| \---- 名稱 | 字串 | 函數的名稱。 | No | |
| └─ 輸出 | 字串 | 函式的輸出。 如果輸出尚未提交,則為 null。 |
No | |
| id | 字串 | 工具呼叫物件的識別碼。 | No | |
| 索引 | 整數 | 工具呼叫陣列中所含工具呼叫的索引。 | Yes | |
| 型別 | 字串 | 工具呼叫的類型。 此類型的工具呼叫一律為 function。 |
Yes |
類型列舉:RunStepDetailsToolCallsFunctionObjectType
| Value | Description |
|---|---|
| 函式 |
vectorStoreExpirationAfter
向量存放區的到期原則。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 錨點 | 字串 | 據以開始套用到期原則的錨點時間戳記。 支援的錨點:last_active_at。 |
Yes | |
| days | 整數 | 錨點時間結束後,向量存放區到期前的等待天數。 | Yes |
錨點列舉:VectorStoreExpirationAfterAnchor
| Value | Description |
|---|---|
| last_active_at | 據以開始套用到期原則的錨點時間戳記。 |
vectorStoreObject
向量存放區是可供 file_search 工具使用的已處理檔案集合。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created_at | 整數 | 向量存放區建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| expires_after | vectorStoreExpirationAfter | 向量存放區的到期原則。 | No | |
| expires_at | 整數 | 向量存放區將到期時的 Unix 時間戳記 (以秒為單位)。 | No | |
| file_counts | 物件 | Yes | ||
| |---- 已取消 | 整數 | 已取消的檔案數目。 | No | |
| ----- 已完成 | 整數 | 已成功處理的檔案數目。 | No | |
| ----- 失敗 | 整數 | 無法處理的檔案數目。 | No | |
| └─ 進行中 | 整數 | 目前正在處理的檔案數目。 | No | |
| |---- 總計 | 整數 | 檔案總數。 | No | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| last_active_at | 整數 | 向量存放區前次作用時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
Yes | |
| name | 字串 | 向量存放區的名稱。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 vector_store。可能的值: vector_store |
Yes | |
| 狀態 | 字串 | 向量存放區的狀態,可以是 expired、in_progress 或 completed。 狀態為 completed 表示向量存放區已可供使用。 |
Yes | |
| usage_bytes | 整數 | 向量存放區中的檔案所使用的位元組總數。 | Yes |
狀態列舉:VectorStoreObjectStatus
| Value | Description |
|---|---|
| expired | |
| in_progress | |
| completed |
createVectorStoreRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | autoChunkingStrategyRequestParam 或 staticChunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 僅在 file_ids 非空時適用。 |
No | |
| expires_after | vectorStoreExpirationAfter | 向量存放區的到期原則。 | No | |
| file_ids | 陣列 | 向量存放區應使用的檔案識別碼清單。 適用於 file_search 之類可存取檔案的工具。 |
No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| name | 字串 | 向量存放區的名稱。 | No |
updateVectorStoreRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| expires_after | vectorStoreExpirationAfter | 向量存放區的到期原則。 | No | |
| 中繼資料 | 物件 | 可附加至物件的索引鍵/值組 (16 個為一組)。 這有助於以結構化格式儲存物件的其他相關資訊。 索引鍵的長度上限為 64 個字元,而值的長度上限為 512 個字元。 |
No | |
| name | 字串 | 向量存放區的名稱。 | No |
listVectorStoresResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
deleteVectorStoreResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deleted | boolean | Yes | ||
| id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
物件列舉:DeleteVectorStoreResponseObject
| Value | Description |
|---|---|
| vector_store.deleted | 已刪除的向量存放區回應物件狀態 |
vectorStoreFileObject
附加至向量存放區的檔案清單。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | autoChunkingStrategyRequestParam 或 staticChunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 僅在 file_ids 非空時適用。 |
No | |
| created_at | 整數 | 向量存放區檔案建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| last_error | 物件 | 與此向量存放區檔案相關聯的最後一個錯誤。 如果沒有任何錯誤,則為 null。 |
Yes | |
| └─ 程式碼 | 字串 |
server_error、invalid_file 或 unsupported_file 的其中一個。 |
No | |
| |---- 訊息 | 字串 | 人類看得懂的錯誤描述。 | No | |
| 物件 | 字串 | 物件類型,一律為 vector_store.file。 |
Yes | |
| 狀態 | 字串 | 向量存放區檔案的狀態,可以是 in_progress、completed、cancelled 或 failed。 狀態為 completed 表示向量存放區檔案已可供使用。 |
Yes | |
| usage_bytes | 整數 | 向量存放區總使用量 (以位元組為單位)。 請注意,這可能與原始檔案大小不同。 | Yes | |
| vector_store_id | 字串 | 要附加檔案之向量存放區的識別碼。 | Yes |
物件列舉:VectorStoreFileObjectType
| Value | Description |
|---|---|
| vector_store.file |
狀態列舉:VectorStoreFileObjectStatus
| Value | Description |
|---|---|
| in_progress | |
| completed | |
| cancelled | |
| failed |
otherChunkingStrategyResponseParam
當區塊化策略未知時,就會傳回這個值。 一般而言,這是因為檔案是在 API 中引進 chunking_strategy 概念之前編製索引。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 字串 | 一律為 other。 |
Yes |
類型 Enum:OtherChunkingStrategyResponseParamType
| Value | Description |
|---|---|
| other |
staticChunkingStrategyResponseParam
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 靜態 | staticChunkingStrategy | Yes | ||
| 型別 | 字串 | 一律為 static。 |
Yes |
類型 Enum:OtherChunkingStrategyResponseParamType
| Value | Description |
|---|---|
| 靜態 |
staticChunkingStrategy
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunk_overlap_tokens | 整數 | 區塊之間重疊的權杖數目。 預設值是 400。請注意,重疊不得超過 max_chunk_size_tokens 的一半。 |
Yes | |
| max_chunk_size_tokens | 整數 | 每個區塊中的權杖數目上限。 預設值是 800。 最小值為 100,最大值為 4096。 |
Yes |
autoChunkingStrategyRequestParam
預設策略。 此策略目前使用 max_chunk_size_tokens 的 800 和 chunk_overlap_tokens400。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 一律為 auto。可能的值: auto |
Yes |
staticChunkingStrategyRequestParam
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 靜態 | staticChunkingStrategy | Yes | ||
| 型別 | 列舉 | 一律為 static。可能的值: static |
Yes |
chunkingStrategyRequestParam
用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。
此元件可以是下列其中之一:
createVectorStoreFileRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | chunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 |
No | |
| file_id | 字串 | 向量存放區應使用的檔案識別碼。 適用於 file_search 之類可存取檔案的工具。 |
Yes |
listVectorStoreFilesResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | Yes | ||
| first_id | 字串 | Yes | ||
| has_more | boolean | Yes | ||
| last_id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
deleteVectorStoreFileResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| deleted | boolean | Yes | ||
| id | 字串 | Yes | ||
| 物件 | 字串 | Yes |
物件列舉:DeleteVectorStoreFileResponseObject
| Value | Description |
|---|---|
| vector_store.file.deleted |
vectorStoreFileBatchObject
附加至向量存放區的檔案批次。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created_at | 整數 | 向量存放區檔案批次建立時的 Unix 時間戳記 (以秒為單位)。 | Yes | |
| file_counts | 物件 | Yes | ||
| |---- 已取消 | 整數 | 已取消的檔案數目。 | No | |
| ----- 已完成 | 整數 | 已處理的檔案數目。 | No | |
| ----- 失敗 | 整數 | 無法處理的檔案數目。 | No | |
| └─ 進行中 | 整數 | 目前正在處理的檔案數目。 | No | |
| |---- 總計 | 整數 | 檔案總數。 | No | |
| id | 字串 | 識別碼,可在 API 端點中參考。 | Yes | |
| 物件 | 字串 | 物件類型,一律為 vector_store.file_batch。 |
Yes | |
| 狀態 | 字串 | 向量存放區檔案批次的狀態,可以是 in_progress、completed、cancelled 或 failed。 |
Yes | |
| vector_store_id | 字串 | 要附加檔案之向量存放區的識別碼。 | Yes |
物件列舉:VectorStoreFileBatchObjectType
| Value | Description |
|---|---|
| vector_store.files_batch |
狀態列舉:VectorStoreFileBatchObjectStatus
| Value | Description |
|---|---|
| in_progress | |
| completed | |
| cancelled | |
| failed |
createVectorStoreFileBatchRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| chunking_strategy | chunkingStrategyRequestParam | 用來區塊化檔案的區塊化策略。 如果未設定,則會使用 auto 策略。 |
No | |
| file_ids | 陣列 | 向量存放區應使用的檔案識別碼清單。 適用於 file_search 之類可存取檔案的工具。 |
Yes |
assistantStreamEvent
代表在串流執行時發出的事件。
在伺服器傳送的事件資料流中,每個事件都有 event 和 data 屬性:
event: thread.created
data: {"id": "thread_123", "object": "thread", ...}
每當新物件建立、轉換至新狀態,或局部進行串流處理 (差異) 時,就會發出事件。 例如,我們會在新的執行建立時發出 thread.run.created、在執行完成時發出 thread.run.completed,依此類推。 當助理選擇在執行期間建立訊息時,我們會依序發出 thread.message.created event、thread.message.in_progress 事件、多個 thread.message.delta 事件,最後發出 thread.message.completed 事件。
我們日後可能會新增其他事件,因此建議在程式碼中妥善處理未知事件。
此元件可以是下列其中之一:
threadStreamEvent
此元件可以是下列其中之一:
thread.created
在新的執行緒建立時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | threadObject | 代表包含訊息的執行緒。 | Yes | |
| 事件 | 字串 | Yes |
資料: threadObject
事件列舉:ThreadStreamEventEnum
| Value | Description |
|---|---|
| thread.created | 執行緒已建立事件 |
runStreamEvent
此元件可以是下列其中之一:
thread.run.created
在新的執行建立時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventCreated
| Value | Description |
|---|---|
| thread.run.created |
thread.run.queued
在執行進入 queued 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventQueued
| Value | Description |
|---|---|
| thread.run.queued |
thread.run.in_progress
在執行進入 in_progress 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventInProgress
| Value | Description |
|---|---|
| thread.run.in_progress |
thread.run.requires_action
在執行進入 requires_action 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventRequiresAction
| Value | Description |
|---|---|
| thread.run.requires_action |
thread.run.completed
在執行完成時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventCompleted
| Value | Description |
|---|---|
| thread.run.completed |
thread.run.failed
在執行失敗時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventFailed
| Value | Description |
|---|---|
| thread.run.failed |
thread.run.cancelling
在執行進入 cancelling 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventCancelling
| Value | Description |
|---|---|
| thread.run.cancelling |
thread.run.cancelled
在執行取消時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventCancelled
| Value | Description |
|---|---|
| thread.run.cancelled |
thread.run.expired
在執行到期時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runObject | 表示在執行緒上進行的執行。 | Yes | |
| 事件 | 字串 | Yes |
資料: runObject
事件列舉:RunStreamEventExpired
| Value | Description |
|---|---|
| thread.run.expired |
runStepStreamEvent
此元件可以是下列其中之一:
thread.run.step.created
在執行步驟建立時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventCreated
| Value | Description |
|---|---|
| thread.run.step.created |
thread.run.step.in_progress
在執行步驟進入 in_progress 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventInProgress
| Value | Description |
|---|---|
| thread.run.step.in_progress |
thread.run.step.delta
在執行步驟的某些部分串流處理時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepDeltaObject | 代表執行步驟差異,也就是執行步驟在串流處理期間的任何欄位變更。 |
Yes | |
| 事件 | 字串 | Yes |
事件列舉:RunStepStreamEventDelta
| Value | Description |
|---|---|
| thread.run.step.delta |
thread.run.step.completed
在執行步驟完成時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventCompleted
| Value | Description |
|---|---|
| thread.run.step.completed |
thread.run.step.failed
在執行步驟失敗時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventFailed
| Value | Description |
|---|---|
| thread.run.step.failed |
thread.run.step.cancelled
在執行步驟取消時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventCancelled
| Value | Description |
|---|---|
| thread.run.step.cancelled |
thread.run.step.expired
在執行步驟到期時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | runStepObject | 代表執行中的步驟。 |
Yes | |
| 事件 | 字串 | Yes |
資料: runStepObject
事件列舉:RunStepStreamEventExpired
| Value | Description |
|---|---|
| thread.run.step.expired |
messageStreamEvent
此元件可以是下列其中之一:
thread.message.created
在訊息建立時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | messageObject | 表示線程內的訊息。 | Yes | |
| 事件 | 字串 | Yes |
資料: messageObject
事件列舉:MessageStreamEventCreated
| Value | Description |
|---|---|
| thread.message.created |
thread.message.in_progress
在訊息進入 in_progress 狀態時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | messageObject | 表示線程內的訊息。 | Yes | |
| 事件 | 字串 | Yes |
資料: messageObject
事件列舉:MessageStreamEventInProgress
| Value | Description |
|---|---|
| thread.message.in_progress |
thread.message.delta
在訊息的某些部分串流處理時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | messageDeltaObject | 代表訊息差異,也就是訊息在串流處理期間的任何欄位變更。 |
Yes | |
| 事件 | 字串 | Yes |
事件列舉:MessageStreamEventDelta
| Value | Description |
|---|---|
| thread.message.delta |
thread.message.completed
在訊息完成時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | messageObject | 表示線程內的訊息。 | Yes | |
| 事件 | 字串 | Yes |
資料: messageObject
事件列舉:MessageStreamEventCompleted
| Value | Description |
|---|---|
| thread.message.completed |
thread.message.incomplete
在訊息未完成即結束時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | messageObject | 表示線程內的訊息。 | Yes | |
| 事件 | 字串 | Yes |
資料: messageObject
事件列舉:MessageStreamEventIncomplete
| Value | Description |
|---|---|
| thread.message.incomplete |
Annotation
此元件可以是下列其中之一:
Click
按一下動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| button | 列舉 | 在點擊期間說明按下了哪個滑鼠按鈕。
left、right、wheel、back 或 forward 的其中一個。可能的值: left、right、wheel、back、forward |
Yes | |
| 型別 | 列舉 | 指定事件類型。 對於按下動作,這個屬性一律會設定為 click。可能的值: click |
Yes | |
| x | 整數 | 按一下發生位置的 X 座標。 |
Yes | |
| y | 整數 | 點擊發生位置的 Y 座標。 |
Yes |
CodeInterpreterFileOutput
程式代碼解釋器工具呼叫的輸出,也就是檔案。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| files | 陣列 | Yes | ||
| 型別 | 列舉 | 程式代碼解釋器檔案輸出的類型。 一律為 files。可能的值: files |
Yes |
CodeInterpreterTextOutput
程式代碼解釋器工具呼叫的輸出,以文字形式呈現。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 記錄 | 字串 | 程式碼解釋器工具的調用日誌。 |
Yes | |
| 型別 | 列舉 | 程式代碼解釋器文字輸出的類型。 一律為 logs。可能的值: logs |
Yes |
CodeInterpreterTool
執行程式代碼的工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_ids | 陣列 | 要執行程式代碼的檔案識別碼。 |
Yes | |
| 型別 | 列舉 | 程式代碼解釋器工具的類型。 一律為 code_interpreter。可能的值: code_interpreter |
Yes |
CodeInterpreterToolCall
執行程式代碼的工具呼叫。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | 字串 | 要執行的程序代碼。 |
Yes | |
| id | 字串 | 程式代碼解釋器工具呼叫的唯一標識符。 |
Yes | |
| results | 陣列 | 程式代碼解釋器工具呼叫的結果。 |
Yes | |
| 狀態 | 列舉 | 程式代碼解釋器工具呼叫的狀態。 可能的值: in_progress、、 interpretingcompleted |
Yes | |
| 型別 | 列舉 | 程式代碼解釋器工具呼叫的類型。 一律為 code_interpreter_call。可能的值: code_interpreter_call |
Yes |
CodeInterpreterToolOutput
此元件可以是下列其中之一:
ComparisonFilter
篩選器用於使用定義的比較操作將指定的屬性鍵與給定值進行比較。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| Key | 字串 | 要與值比較的索引鍵。 | Yes | |
| 型別 | 列舉 | 指定比較運算子:eq、、、ne、gtgtelt、 lte。- eq:等於- ne:不等於- gt:大於- gte:大於或等於- lt:小於- lte:小於或等於可能的值: eq、、、negtgte、lt、lte |
Yes | |
| value | 字串或數位或布爾值 | 要與屬性索引鍵比較的值;支援字串、數字或布林值類型。 | Yes |
CompoundFilter
使用 and 或 or結合多個篩選。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filters | 陣列 | 要組合的濾鏡陣列。 項目可以是 ComparisonFilter 或 CompoundFilter。 |
Yes | |
| 型別 | 列舉 | 工作類型: and 或 or。可能的值: and、 or |
Yes |
ComputerAction
此元件可以是下列其中之一:
ComputerScreenshotImage
計算機螢幕快照影像,與計算機使用工具搭配使用。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_id | 字串 | 包含螢幕快照之已上傳檔案的標識碼。 | No | |
| image_url | 字串 | 螢幕快照影像的 URL。 | No | |
| 型別 | 列舉 | 指定事件類型。 針對電腦螢幕快照,這個屬性一律設定為 computer_screenshot。可能的值: computer_screenshot |
Yes |
ComputerTool
控制虛擬電腦的工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| display_height | number | 計算機顯示的高度。 |
Yes | |
| display_width | number | 計算機的顯示寬度。 |
Yes | |
| 環境 | 列舉 | 要控制的計算機環境類型。 可能的值: mac、、windows、 ubuntubrowser |
Yes | |
| 型別 | 列舉 | 計算機使用工具的類型。 一律為 computer_use_preview。可能的值: computer-use-preview |
Yes |
ComputerToolCall
電腦的工具呼叫會使用工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 動作 | ComputerAction | Yes | ||
| call_id | 字串 | 使用輸出回應工具呼叫時所使用的識別碼。 |
Yes | |
| id | 字串 | 計算機呼叫的唯一標識碼。 | Yes | |
| pending_safety_checks | 陣列 | 電腦呼叫的擱置安全性檢查。 |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
Yes | |
| 型別 | 列舉 | 計算機呼叫的類型。 一律為 computer_call。可能的值: computer_call |
Yes |
ComputerToolCallOutput
電腦工具呼叫的輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| acknowledged_safety_checks | 陣列 | 由開發人員認可的 API 所報告的安全性檢查。 |
No | |
| call_id | 字串 | 產生輸出之計算機工具呼叫的標識碼。 |
Yes | |
| id | 字串 | 計算機工具呼叫輸出的識別碼。 |
No | |
| 輸出 | ComputerScreenshotImage | 計算機螢幕快照影像,與計算機使用工具搭配使用。 |
Yes | |
| 狀態 | 列舉 | 訊息輸入的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回輸入項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 計算機工具呼叫輸出的類型。 一律為 computer_call_output。可能的值: computer_call_output |
Yes |
ComputerToolCallOutputResource
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| acknowledged_safety_checks | 陣列 | 由開發人員認可的 API 所報告的安全性檢查。 |
No | |
| call_id | 字串 | 產生輸出之計算機工具呼叫的標識碼。 |
Yes | |
| id | 字串 | 計算機呼叫工具輸出的唯一標識碼。 |
Yes | |
| 輸出 | ComputerScreenshotImage | 計算機螢幕快照影像,與計算機使用工具搭配使用。 |
Yes | |
| 狀態 | 列舉 | 訊息輸入的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回輸入項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 計算機工具呼叫輸出的類型。 一律為 computer_call_output。可能的值: computer_call_output |
Yes |
ComputerToolCallSafetyCheck
電腦呼叫的擱置安全性檢查。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | 字串 | 擱置安全性檢查的類型。 | Yes | |
| id | 字串 | 擱置安全性檢查的識別碼。 | Yes | |
| 訊息 | 字串 | 擱置安全性檢查的詳細資料。 | Yes |
Content
多模态的輸入和輸出內容。
此元件可以是下列其中之一:
Coordinate
x/y 座標組,例如 { x: 100, y: 200 }。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| x | 整數 | X 座標。 |
Yes | |
| y | 整數 | Y 座標。 |
Yes |
CreateModelResponseProperties
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | Metadata | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元的字串。 |
No | |
| 型號 | 字串 | 用來產生回應的模型。 | No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一標識碼,可協助 OpenAI 監視和偵測濫用行為。 . |
No |
createResponse
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| include | 陣列 | {“$ref”: “#/components/schemas/includable/description”} | No | |
| 輸入 | 字串或陣列 | 用來讓模型產生回應的文字、影像或檔案輸入。 | Yes | |
| instructions | 字串 | 將系統訊息或開發人員訊息插入至模型上下文的第一個項目。 搭配 previous_response_id使用 時,將不會將先前回應的指示傳遞至下一個回應。 這可讓您輕鬆地在新回應中交換系統(或開發人員)訊息。 |
No | |
| max_output_tokens | 整數 | 可對回應所能產生的令牌數量設定上限,包括可見的輸出令牌和推理令牌。 |
No | |
| parallel_tool_calls | boolean | 是否允許模型平行執行工具呼叫。 |
No | True |
| previous_response_id | 字串 | 先前回應模型的唯一識別碼。 使用這個功能來建立多輪對話。 | No | |
| reasoning | Reasoning | 推理模型的組態選項。 | No | |
| 儲存 | boolean | 是否要儲存產生的模型回應,以便稍後透過 API 擷取。 |
No | True |
| 串流 | boolean | 如果設定為 true,模型響應資料將會隨著使用 伺服器傳送的事件產生而串流至用戶端。 | No | False |
| 收發簡訊 | 物件 | 來自模型的文字回應組態選項。 可以是純文字或結構化 JSON 數據。 瞭解詳情: - 文字輸入和輸出 - 結構化輸出 |
No | |
| └─ 格式 | TextResponseFormatConfiguration | 物件,指定模型必須輸出的格式。{ "type": "json_schema" }設定會啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 預設格式為 { "type": "text" },且沒有其他選項。不建議使用 gpt-4o 和較新的模型: 設定為 { "type": "json_object" } 可啟用較舊的 JSON 模式,以確保模型產生的訊息為有效的 JSON。 對於支援 json_schema 的模型,建議使用該選項。 |
No | |
| tool_choice | ToolChoiceOptions 或 ToolChoiceTypes 或 ToolChoiceFunction | 模型應該如何選取產生回應時要使用的工具(或工具)。
tools請參閱 參數,以瞭解如何指定模型可以呼叫的工具。 |
No | |
| tools | 陣列 | 模型可能會在產生回應時呼叫的工具陣列。 您可以藉由設定 tool_choice 參數來指定要使用的工具。您可以提供模型的兩種工具類別如下: - 內建工具 |
No | |
| truncation | 列舉 | 用於模型回應的截斷策略。 - auto:如果此回應的內容和先前的內容超過模型的內容視窗大小,模型將會截斷 在交談中間捨棄輸入項目,以使回應符合內容視窗。 - disabled (預設值):如果模型響應超過模型的內容視窗大小,要求將會失敗,並出現 400 錯誤。可能的值: auto、 disabled |
No |
DoubleClick
按兩下動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 指定事件類型。 對於按兩下動作,這個屬性一律會設定為 double_click。可能的值: double_click |
Yes | |
| x | 整數 | 按兩下發生位置的 X 座標。 |
Yes | |
| y | 整數 | 按兩下發生位置的 Y 座標。 |
Yes |
Drag
拖曳動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 路徑 | 陣列 | 座標陣列,表示拖曳動作的路徑。 座標會顯示為對象的陣列,例如[{ x: 100, y: 200 }, { x: 200, y: 300 }] |
Yes | |
| 型別 | 列舉 | 指定事件類型。 針對拖曳動作,這個屬性一律設定為 drag。可能的值: drag |
Yes |
EasyInputMessage
對於模型的訊息輸入,角色指出下列階層的指示。 由 developer 或 system 角色給出的指示優先於由角色 user 給出的指示。 具有 assistant 角色的訊息被認為是在先前交互作用中由模型產生的。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | string 或 InputMessageContentList | 用於產生回應的模型文字、影像或音訊輸入。 也可以包含先前的助理回應。 |
Yes | |
| 角色 | 列舉 | 訊息輸入的作用。
user、assistant、system 或 developer 的其中之一。。可能的值: user、、assistant、 systemdeveloper |
Yes | |
| 型別 | 列舉 | 訊息輸入的類型。 一律為 message。可能的值: message |
No |
FileCitation
檔案的引文。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_id | 字串 | 檔案的識別碼。 |
Yes | |
| 索引 | 整數 | 檔案清單中的檔案索引。 |
Yes | |
| 型別 | 列舉 | 檔案引文的類型。 一律為 file_citation。可能的值: file_citation |
Yes |
FilePath
檔案的路徑。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_id | 字串 | 檔案的識別碼。 |
Yes | |
| 索引 | 整數 | 檔案清單中的檔案索引。 |
Yes | |
| 型別 | 列舉 | 檔案路徑的類型。 一律為 file_path。可能的值: file_path |
Yes |
FileSearchRanker
要用於檔案搜尋的排名工具。 如果未指定,則會使用 auto 排名器。
| Property | Value |
|---|---|
| Description | 要用於檔案搜尋的排名工具。 如果未指定,則會使用 auto 排名器。 |
| Type | 字串 |
| Values | autodefault_2024_08_21 |
FileSearchTool
從上傳的檔案搜尋相關內容的工具。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filters | ComparisonFilter 或 CompoundFilter | 根據檔案屬性來套用的過濾器。 | No | |
| max_num_results | 整數 | 要傳回的結果數目上限。 此數字應介於 1 到 50 之間。 |
No | |
| ranking_options | 物件 | 搜尋的排名選項。 | No | |
| └─ ranker | 列舉 | 要用於檔案搜尋的排名工具。 可能的值: auto、 default-2024-11-15 |
No | |
| └─ score_threshold | number | 檔案搜尋的分數閾值,數位介於 0 到 1 之間。 接近 1 的數位只會嘗試只傳回最相關的結果,但可能會傳回較少的結果。 |
No | 0 |
| 型別 | 列舉 | 檔案搜尋工具的類型。 一律為 file_search。可能的值: file_search |
Yes | |
| vector_store_ids | 陣列 | 要搜尋的向量存放區識別碼。 |
Yes |
FileSearchToolCall
檔案搜尋工具呼叫的結果。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| id | 字串 | 檔案搜尋工具呼叫的唯一標識符。 |
Yes | |
| queries | 陣列 | 用來搜尋檔案的查詢。 |
Yes | |
| results | 陣列 | 檔案搜尋工具呼叫的結果。 |
No | |
| 狀態 | 列舉 | 檔案搜尋工具呼叫的狀態。
in_progress、searching、incomplete 或 failed 其中之一可能的值: in_progress、searching、completed、incomplete、failed |
Yes | |
| 型別 | 列舉 | 檔案搜尋工具呼叫的類型。 一律為 file_search_call。可能的值: file_search_call |
Yes |
FunctionTool
在您自己的程式代碼中定義函式,模型可以選擇呼叫。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 函式的描述。 模型用來判斷是否要呼叫該函式。 |
No | |
| name | 字串 | 要呼叫的函式名稱。 |
Yes | |
| parameters | 物件 | 描述函式參數的 JSON 架構物件。 |
Yes | |
| strict | boolean | 是否要強制執行嚴格的參數驗證。 預設 true。 |
Yes | |
| 型別 | 列舉 | 函式工具的類型。 一律為 function。可能的值: function |
Yes |
FunctionToolCall
執行函式的工具呼叫。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| arguments | 字串 | 要傳遞至函式的引數 JSON 字串。 |
Yes | |
| call_id | 字串 | 模型所產生的函式工具呼叫的唯一標識符。 |
Yes | |
| id | 字串 | 函數工具呼叫的唯一標識碼。 |
Yes | |
| name | 字串 | 要執行的函式名稱。 |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 函式工具呼叫的類型。 一律為 function_call。可能的值: function_call |
Yes |
FunctionToolCallOutput
函式工具呼叫的輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| call_id | 字串 | 模型所產生的函式工具呼叫的唯一標識符。 |
Yes | |
| id | 字串 | 函式工具呼叫輸出的唯一標識碼。 透過 API 傳回此項目時填入。 |
No | |
| 輸出 | 字串 | 函式工具呼叫輸出的 JSON 字串。 |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 函數工具呼叫輸出類型。 一律為 function_call_output。可能的值: function_call_output |
Yes |
FunctionToolCallOutputResource
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| call_id | 字串 | 模型所產生的函式工具呼叫的唯一標識符。 |
Yes | |
| id | 字串 | 函數調用工具輸出的唯一標識碼。 |
Yes | |
| 輸出 | 字串 | 函式工具呼叫輸出的 JSON 字串。 |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 函數工具呼叫輸出類型。 一律為 function_call_output。可能的值: function_call_output |
Yes |
includable
指定要包含在模型回應中的其他輸出數據。 目前支援的值如下:
-
file_search_call.results:包含檔案搜尋工具呼叫的搜尋結果。 -
message.input_image.image_url:包含輸入訊息中的影像 URL。 -
computer_call_output.output.image_url:包含來自計算機呼叫輸出的圖像 URL。
| Property | Value |
|---|---|
| Description | 指定要包含在模型回應中的其他輸出數據。 目前支援的值如下: - file_search_call.results:包含檔案搜尋工具呼叫的搜尋結果。- message.input_image.image_url:包含輸入訊息中的影像 URL。- computer_call_output.output.image_url:包含來自計算機呼叫輸出的圖像 URL。 |
| Type | 字串 |
| Values | file_search_call.resultsmessage.input_image.image_urlcomputer_call_output.output.image_url |
InputAudio
音訊輸入至模型。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 字串 | Base64 編碼的音訊數據。 |
Yes | |
| format | 列舉 | 音訊數據的格式。 目前支援的格式為 mp3 和 wav。可能的值: mp3、 wav |
Yes | |
| 型別 | 列舉 | 輸入項目的型別。 一律為 input_audio。可能的值: input_audio |
Yes |
InputContent
此元件可以是下列其中之一:
InputFile
模型的檔案輸入。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| file_data | 字串 | 要傳送至模型的檔案內容。 |
No | |
| file_id | 字串 | 要傳送至模型的檔案識別碼。 |
No | |
| filename | 字串 | 要傳送至模型的檔案名稱。 |
No | |
| 型別 | 列舉 | 輸入項目的型別。 一律為 input_file。可能的值: input_file |
Yes |
InputImage
輸入至模型的影像
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| detail | 列舉 | 要傳送至模型之影像的詳細數據層級。
high、low 或 auto 的其中之一。 預設為 auto。可能的值: high、、 lowauto |
Yes | |
| file_id | 字串 | 要傳送至模型的檔案識別碼。 |
No | |
| image_url | 字串 | 要傳送至模型的影像 URL。 資料 URL 中的完整 URL 或 base64 編碼影像。 |
No | |
| 型別 | 列舉 | 輸入項目的型別。 一律為 input_image。可能的值: input_image |
Yes |
InputItem
此元件可以是下列其中之一:
InputMessage
對於模型的訊息輸入,角色指出下列階層的指示。 由 developer 或 system 角色給出的指示優先於由角色 user 給出的指示。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | InputMessageContentList | 模型的一個或多個輸入項目列表,其中包含不同的內容 types. |
Yes | |
| 角色 | 列舉 | 訊息輸入的作用。
user、system 或 developer 的其中之一。可能的值: user、、 systemdeveloper |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 訊息輸入的類型。 一律設定為 message。可能的值: message |
No |
InputMessageContentList
模型中一或多個輸入項目的清單,其中包含不同的內容類型。
未定義此元件的屬性。
InputMessageResource
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | InputMessageContentList | 模型的一個或多個輸入項目列表,其中包含不同的內容 types. |
Yes | |
| id | 字串 | 訊息輸入的唯一標識碼。 |
Yes | |
| 角色 | 列舉 | 訊息輸入的作用。
user、system 或 developer 的其中之一。可能的值: user、、 systemdeveloper |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 訊息輸入的類型。 一律設定為 message。可能的值: message |
No |
InputText
模型的文字輸入。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 字串 | 模型的文字輸入。 |
Yes | |
| 型別 | 列舉 | 輸入項目的型別。 一律為 input_text。可能的值: input_text |
Yes |
Item
用來產生回應的內容項目。
此元件可以是下列其中之一:
- InputMessage
- OutputMessage
- FileSearchToolCall
- ComputerToolCall
- ComputerToolCallOutput
- FunctionToolCall
- FunctionToolCallOutput
- ReasoningItem
ItemReference
要參考之項目的內部識別碼。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| id | 字串 | 要參考之專案的標識碼。 |
Yes | |
| 型別 | 列舉 | 要參考的項目類型。 一律為 item_reference。可能的值: item_reference |
Yes |
ItemResource
用來產生回應的內容項目。
此元件可以是下列其中之一:
- InputMessageResource
- OutputMessage
- FileSearchToolCall
- ComputerToolCall
- ComputerToolCallOutputResource
- FunctionToolCall
- FunctionToolCallOutputResource
KeyPress
模型想要執行的按鍵集合。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| keys | 陣列 | 模型要求按下的按鍵組合。 這是字串陣列,每個字串都代表索引鍵。 |
Yes | |
| 型別 | 列舉 | 指定事件類型。 對於 keypress 動作,這個屬性一律會設定為 keypress。可能的值: keypress |
Yes |
Metadata
可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。
索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元的字串。
未定義此元件的屬性。
ModelResponseProperties
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 中繼資料 | Metadata | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元的字串。 |
No | |
| 型號 | 字串 | 用來產生回應的模型。 | No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
No | 1 |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
No | 1 |
| 使用者 | 字串 | 代表使用者的唯一標識碼,可協助 OpenAI 監視和偵測濫用行為。 . |
No |
Move
滑鼠移動動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 指定事件類型。 對於移動動作,這個屬性一律會設定為 move。可能的值: move |
Yes | |
| x | 整數 | 要移至的 X 座標。 |
Yes | |
| y | 整數 | 要移至的 Y 座標。 |
Yes |
OutputAudio
來自模型的音訊輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 字串 | 來自模型的Base64編碼音訊數據。 |
Yes | |
| 文字記錄 | 字串 | 來自模型的音訊數據文字記錄。 |
Yes | |
| 型別 | 列舉 | 輸出音訊的類型。 一律為 output_audio。可能的值: output_audio |
Yes |
OutputContent
此元件可以是下列其中之一:
OutputItem
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 動作 | ComputerAction | Yes | ||
| arguments | 字串 | 要傳遞至函式的引數 JSON 字串。 |
Yes | |
| call_id | 字串 | 使用輸出回應工具呼叫時所使用的識別碼。 |
Yes | |
| 內容 | 陣列 | 推理文字內容。 |
Yes | |
| id | 字串 | 推理內容的唯一標識碼。 |
Yes | |
| name | 字串 | 要執行的函式名稱。 |
Yes | |
| pending_safety_checks | 陣列 | 電腦呼叫的擱置安全性檢查。 |
Yes | |
| queries | 陣列 | 用來搜尋檔案的查詢。 |
Yes | |
| results | 陣列 | 檔案搜尋工具呼叫的結果。 |
No | |
| 角色 | 列舉 | 輸出訊息的角色。 一律為 assistant。可能的值: assistant |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
Yes | |
| 型別 | 列舉 | 物件的型別。 一律為 reasoning。可能的值: reasoning |
Yes |
OutputMessage
來自模型的輸出訊息。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 陣列 | 輸出訊息的內容。 |
Yes | |
| id | 字串 | 輸出訊息的唯一標識碼。 |
Yes | |
| 角色 | 列舉 | 輸出訊息的角色。 一律為 assistant。可能的值: assistant |
Yes | |
| 狀態 | 列舉 | 訊息輸入的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回輸入項目時填入。可能的值: in_progress、、 completedincomplete |
Yes | |
| 型別 | 列舉 | 輸出訊息的類型。 一律為 message。可能的值: message |
Yes |
OutputText
模型的文字輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| annotations | 陣列 | 文字輸出的註釋。 |
Yes | |
| 收發簡訊 | 字串 | 模型的文字輸出。 |
Yes | |
| 型別 | 列舉 | 輸出文字的類型。 一律為 output_text。可能的值: output_text |
Yes |
RealtimeSessionCreateRequest
即時工作階段物件設定。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| input_audio_format | 列舉 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸入音訊必須是 16 位元 PCM、取樣速率為 24kHz、單通道 (mono),以及由小到大的位元組順序。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| input_audio_noise_reduction | 物件 | 輸入音訊雜訊減少的設定。 這可設定為 null 以關閉。雜訊減少會先篩選新增至輸入音訊緩衝區的音訊,再將其傳送至 VAD 和模型。 篩選音訊可以改善 VAD 和回合偵測精確度(減少誤判)和模型效能,方法是改善對輸入音訊的感知。 |
No | |
| \---- 類型 | 列舉 | 減少雜訊的類型。
near_field 適用於耳機麥克風等近距離麥克風,far_field 適用於遠場麥克風,例如筆記型電腦或會議室麥克風。可能的值: near_field、 far_field |
No | |
| input_audio_transcription | 物件 | 輸入音訊轉譯的設定,預設為關閉,且可設定為 null 關閉一次。 輸入音訊轉譯不是模型的原生,因為模型會直接取用音訊。 轉錄會透過 轉錄端點 以異步方式執行,應被視為輸入音訊內容的參考,而非模型準確聽到的內容。 用戶端可以選擇性地設定語言和提示進行轉譯,這些會為轉譯服務提供額外的指引。 |
No | |
| └─ 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式 en提供輸入語言可改善精確度和延遲。 |
No | |
| └─ model | 字串 | 用於轉錄的模型,目前選項為 gpt-4o-transcribe、 gpt-4o-mini-transcribe、 gpt-4o-mini-transcribe-2025-12-15和 whisper-1。 |
No | |
| └─ 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 針對 whisper-1,提示是關鍵詞清單。針對 gpt-4o-transcribe 模型,提示是自由文字字串,例如「預期出現與技術相關的詞語」。 |
No | |
| instructions | 字串 | 加在模型呼叫前面的預設系統指示 (亦即系統訊息)。 此欄位可讓客戶端引導模型以取得所需的回應。 模型可以指示回應內容和格式(例如“非常簡潔”、“行為友好”、“以下是良好的回應範例”)和音訊行為(例如,“快速說話”、“插入情感到您的聲音”、“經常笑”)。 模型不保證遵循這些指示,但這些指示為模型提供了實現期望行為的指引。 請注意,如果未設定此欄位,伺服器將使用預設指示,並且這些指示會在會話開始時顯示於 session.created 事件中。 |
No | |
| max_response_output_tokens | 整數或字串 | 單一助理回應的輸出權杖數目上限,包含工具呼叫。 提供介於 1 到 4096 之間的整數來限制輸出標記,或使用 inf 來指定該模型的最大可用標記數。 預設為 inf。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| 型號 | 字串 | 用於此工作階段的部署名稱。 |
No | |
| output_audio_format | 列舉 | 輸出音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸出音訊的取樣速率為 24kHz。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| temperature | number | 模型的取樣溫度限制為 [0.6, 1.2]。 對於音訊模型,強烈建議溫度為 0.8,以獲得最佳效能。 |
No | 0.8 |
| tool_choice | 字串 | 模型選擇工具的方式。 選項為 auto、 none、 required或 指定函式。 |
No | auto |
| tools | 陣列 | 模型可用的工具 (函式)。 | No | |
| turn_detection | 物件 | 回合偵測、乙太伺服器 VAD 或語意 VAD 的設定。 這可以設定為 null 關閉,在此情況下,客戶端必須手動觸發模型回應。伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 語意 VAD 更進階,並使用回合偵測模型(結合 VAD)來語意估計使用者是否已完成說話,然後根據這個機率動態設定逾時。 例如,如果使用者音訊以 uhhm 結尾,模型會認為回合結束的機率較低,並等待更長時間讓使用者繼續說話。 這對於更自然的對話很有用,但延遲可能較高。 |
No | |
| └─ create_response (建立回應) | boolean | 是否要在發生 VAD 停止事件時自動產生回應。 |
No | True |
| └─ 渴望 | 列舉 | 僅適用於 semantic_vad 模式。 模型回應的積極程度。
low 會等候較長的時間讓用戶繼續說話, high 將會更快回應。
auto 是預設值,相當於 medium。可能的值: low、、medium、 highauto |
No | |
| └─ 中斷響應 | boolean | 當發生 VAD 啟動事件時,是否要自動中斷任何正在進行的回應,並輸出到預設的對話(例如 conversation 和 auto) 。 |
No | True |
| └─ prefix_padding_ms | 整數 | 僅適用於 server_vad 模式。 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 僅適用於 server_vad 模式。 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | 僅適用於 server_vad 模式。 VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 列舉 | 回合偵測的類型。 可能的值: server_vad、 semantic_vad |
No | |
| voice | VoiceIdsShared | No |
RealtimeSessionCreateResponse
具有暫時金鑰的新即時會話設定。 金鑰的預設 TTL 為一分鐘。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| client_secret | 物件 | API 傳回的暫時金鑰。 | Yes | |
| └─ 到期時間 | 整數 | 令牌到期時的時間戳。 目前,所有令牌都會在一分鐘后到期。 |
No | |
| └─ 價值 | 字串 | 暫時金鑰可在用戶端環境中使用,以驗證與即時 API 的連線。 在客戶端環境中使用此令牌,而標準 API 令牌應該僅用於伺服器端。 |
No | |
| input_audio_format | 字串 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。 |
No | |
| input_audio_transcription | 物件 | 輸入音訊轉譯的設定,預設為關閉,且可設定為 null 關閉一次。 輸入音訊轉譯不是模型的原生,因為模型會直接取用音訊。 轉譯會透過 Whisper 以異步方式執行,而且應該被視為粗略的指引,而不是模型所瞭解的表示法。 |
No | |
| └─ model | 字串 | 要用於轉譯 whisper-1 的模型是目前唯一支援的模型。 |
No | |
| instructions | 字串 | 加在模型呼叫前面的預設系統指示 (亦即系統訊息)。 此欄位可讓客戶端引導模型以取得所需的回應。 模型可以指示回應內容和格式(例如“非常簡潔”、“行為友好”、“以下是良好的回應範例”)和音訊行為(例如“快速說話”、“將情感注入您的聲音”、“經常笑聲”)。 模型不保證遵循這些指示,但這些指示為模型提供了實現期望行為的指引。 請注意,如果未設定此欄位,伺服器將使用預設指示,並且這些指示會在會話開始時顯示於 session.created 事件中。 |
No | |
| max_response_output_tokens | 整數或字串 | 單一助理回應的輸出權杖數目上限,包含工具呼叫。 提供介於 1 到 4096 之間的整數來限制輸出標記,或使用 inf 來指定該模型的最大可用標記數。 預設為 inf。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| output_audio_format | 字串 | 輸出音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。 |
No | |
| temperature | number | 模型的取樣溫度限制為 [0.6, 1.2]。 預設為 0.8。 |
No | |
| tool_choice | 字串 | 模型選擇工具的方式。 選項為 auto、 none、 required或 指定函式。 |
No | |
| tools | 陣列 | 模型可用的工具 (函式)。 | No | |
| turn_detection | 物件 | 回合偵測的設定。 可以設定為 null 來關閉。 伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 |
No | |
| └─ prefix_padding_ms | 整數 | 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 字串 | 回合偵測的類型,目前僅支援server_vad。 |
No | |
| voice | VoiceIdsShared | No |
RealtimeTranscriptionSessionCreateRequest
即時轉譯會話物件組態。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| include | 陣列 | 要包含在謄寫中的項目集。 目前可用的專案如下: - item.input_audio_transcription.logprobs |
No | |
| input_audio_format | 列舉 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。針對 pcm16,輸入音訊必須是 16 位元 PCM、取樣速率為 24kHz、單通道 (mono),以及由小到大的位元組順序。可能的值: pcm16、、 g711_ulawg711_alaw |
No | |
| input_audio_noise_reduction | 物件 | 輸入音訊雜訊減少的設定。 這可設定為 null 以關閉。雜訊減少會先篩選新增至輸入音訊緩衝區的音訊,再將其傳送至 VAD 和模型。 篩選音訊可以改善 VAD 和回合偵測精確度(減少誤判)和模型效能,方法是改善對輸入音訊的感知。 |
No | |
| \---- 類型 | 列舉 | 減少雜訊的類型。
near_field 適用於耳機麥克風等近距離麥克風,far_field 適用於遠場麥克風,例如筆記型電腦或會議室麥克風。可能的值: near_field、 far_field |
No | |
| input_audio_transcription | 物件 | 輸入音訊轉譯的組態。 用戶端可以選擇性地設定語言和提示進行轉譯,這些會為轉譯服務提供額外的指引。 |
No | |
| └─ 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式 en提供輸入語言可改善精確度和延遲。 |
No | |
| └─ model | 列舉 | 用於轉錄的模型,目前的選項有 gpt-4o-transcribe、 gpt-4o-transcribe-diarize、 gpt-4o-mini-transcribegpt-4o-mini-transcribe-2025-12-15whisper-1、 和 。可能的值: gpt-4o-transcribe、gpt-4o-transcribe-diarize、gpt-4o-mini-transcribe、gpt-4o-mini-transcribe-2025-12-15、whisper-1 |
No | |
| └─ 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 針對 whisper-1,提示是關鍵詞清單。針對 gpt-4o-transcribe 模型,提示是自由文字字串,例如「預期出現與技術相關的詞語」。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| turn_detection | 物件 | 回合偵測、乙太伺服器 VAD 或語意 VAD 的設定。 這可以設定為 null 關閉,在此情況下,客戶端必須手動觸發模型回應。伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 語意 VAD 更進階,並使用回合偵測模型(結合 VAD)來語意估計使用者是否已完成說話,然後根據這個機率動態設定逾時。 例如,如果使用者音訊以 uhhm 結尾,模型會認為回合結束的機率較低,並等待更長時間讓使用者繼續說話。 這對於更自然的對話很有用,但延遲可能較高。 |
No | |
| └─ create_response (建立回應) | boolean | 是否要在發生 VAD 停止事件時自動產生回應。 不適用於謄寫工作階段。 |
No | True |
| └─ 渴望 | 列舉 | 僅適用於 semantic_vad 模式。 模型回應的積極程度。
low 會等候較長的時間讓用戶繼續說話, high 將會更快回應。
auto 是預設值,相當於 medium。可能的值: low、、medium、 highauto |
No | |
| └─ 中斷響應 | boolean | 當發生 VAD 啟動事件時,是否要自動中斷任何正在進行的回應,並輸出到預設的對話(例如 conversation 和 auto) 。 不適用於謄寫工作階段。 |
No | True |
| └─ prefix_padding_ms | 整數 | 僅適用於 server_vad 模式。 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 僅適用於 server_vad 模式。 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | 僅適用於 server_vad 模式。 VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 列舉 | 回合偵測的類型。 可能的值: server_vad、 semantic_vad |
No |
RealtimeTranscriptionSessionCreateResponse
新的即時謄寫工作階段設定。
透過 REST API 在伺服器上建立工作階段時,工作階段物件也會包含暫時密鑰。 金鑰的預設 TTL 為一分鐘。 當會話透過 WebSocket API 更新時,就不會有這個屬性。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| client_secret | 物件 | API 傳回的暫時金鑰。 只有透過 REST API 在伺服器上建立工作階段時才存在。 |
Yes | |
| └─ 到期時間 | 整數 | 令牌到期時的時間戳。 目前,所有令牌都會在一分鐘后到期。 |
No | |
| └─ 價值 | 字串 | 暫時金鑰可在用戶端環境中使用,以驗證與即時 API 的連線。 在客戶端環境中使用此令牌,而標準 API 令牌應該僅用於伺服器端。 |
No | |
| input_audio_format | 字串 | 輸入音訊的格式。 選項為 pcm16、g711_ulaw 或 g711_alaw。 |
No | |
| input_audio_transcription | 物件 | 轉譯模型的組態。 |
No | |
| └─ 語言 | 字串 | 輸入音訊的語言。 以 ISO-639-1 格式 en提供輸入語言可改善精確度和延遲。 |
No | |
| └─ model | 列舉 | 要用於轉譯的模型。 可以是 gpt-4o-transcribe、gpt-4o-mini-transcribe、gpt-4o-mini-transcribe-2025-12-15 或 whisper-1。可能的值: gpt-4o-transcribe、、gpt-4o-mini-transcribe、 gpt-4o-mini-transcribe-2025-12-15whisper-1 |
No | |
| └─ 提示 | 字串 | 用來引導模型樣式或繼續上一個音訊區段的選用文字。 提示應該符合音訊語言。 |
No | |
| modalities | 模型可以回應的一組方式。 若要停用音訊,請將此設定為 [“text”]。 |
No | ||
| turn_detection | 物件 | 回合偵測的設定。 可以設定為 null 來關閉。 伺服器 VAD 表示模型會根據音訊音量偵測語音的開始和結束,並在使用者語音結束時回應。 |
No | |
| └─ prefix_padding_ms | 整數 | 在 VAD 偵測到語音之前要包含的音訊數量(以毫秒為單位)。 預設為300毫秒。 |
No | |
| └─ silence_duration_ms(靜音持續時間,以毫秒為單位) | 整數 | 偵測語音停止的無聲持續時間(以毫秒為單位)。 預設為 500 毫秒。 使用較短的值時,模型會更快回應,但可能會從使用者短暫暫停時進入。 |
No | |
| ‧---- 臨界值 | number | VAD 的啟用閾值 (0.0 到 1.0),這會預設為 0.5。 較高的閾值需要更響亮的音訊來啟動模型,因此在嘈雜的環境中可能會執行得更好。 |
No | |
| \---- 類型 | 字串 | 回合偵測的類型,目前僅支援server_vad。 |
No |
Reasoning
推理模型的組態選項。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 投入量 | ReasoningEffort | 限制推理模型的推理工作。 目前支援的值為 low、medium 和 high。 減少推理工作可能會導致回應更快,以及回應中用於推理的權杖較少。 |
Yes | 適中 |
| 摘要 | 列舉 | 模型所執行推理的摘要。 這對於偵錯和瞭解模型的推理程式很有用。concise 或 detailed 的其中之一。可能的值: concise、 detailed |
No |
ReasoningItem
產生回應時,推理模型所使用之思想鏈結的描述。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 內容 | 陣列 | 推理文字內容。 |
Yes | |
| id | 字串 | 推理內容的唯一標識碼。 |
Yes | |
| 狀態 | 列舉 | 項目的狀態。
in_progress、completed 或 incomplete 的其中之一。 透過 API 傳回項目時填入。可能的值: in_progress、、 completedincomplete |
No | |
| 型別 | 列舉 | 物件的型別。 一律為 reasoning。可能的值: reasoning |
Yes |
Refusal
模型拒絕回應。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| refusal | 字串 | 模型的拒絕說明。 |
Yes | |
| 型別 | 列舉 | 拒絕的類型。 一律為 refusal。可能的值: refusal |
Yes |
response
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| created_at | number | 建立此回應時的 Unix 時間戳(以秒為單位)。 |
Yes | |
| 錯誤 | ResponseError | 當模型無法生成回應時,會返回一個錯誤對象。 |
Yes | |
| id | 字串 | 此回應的唯一標識碼。 |
Yes | |
| incomplete_details | 物件 | 關於回應為何不完整的詳細資料。 |
Yes | |
| |---- 原因 | 列舉 | 回應不完整的原因。 可能的值: max_output_tokens、 content_filter |
No | |
| instructions | 字串 | 將系統訊息或開發人員訊息插入至模型上下文的第一個項目。 搭配 previous_response_id使用 時,將不會將先前回應的指示傳遞至下一個回應。 這可讓您輕鬆地在新回應中交換系統(或開發人員)訊息。 |
Yes | |
| max_output_tokens | 整數 | 可針對響應產生的令牌數目的上限,包括可見的輸出令牌和對話狀態。 |
No | |
| 中繼資料 | Metadata | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元的字串。 |
Yes | |
| 型號 | 字串 | 用來產生回應的模型。 | Yes | |
| 物件 | 列舉 | 此資源的物件類型 - 一律設定為 response。可能的值: response |
Yes | |
| 輸出 | 陣列 | 模型所產生的內容項目陣列。 - 陣列中 output 項目的長度和順序取決於模型的回應。- 與其存取 output 陣列中的第一個項目,並假設它是模型所產生內容的 assistant 訊息,您可以考慮使用 SDK 中支援的 output_text 屬性。 |
Yes | |
| output_text | 字串 | SDK 專屬的便利屬性,其中包含 output_text 陣列中所有 output 項目的彙總文字輸出 (如果有的話)。 Python 和 JavaScript SDK 中支援。 |
No | |
| parallel_tool_calls | boolean | 是否允許模型平行執行工具呼叫。 |
Yes | True |
| previous_response_id | 字串 | 先前回應模型的唯一識別碼。 使用這個功能來建立多輪對話。 | No | |
| reasoning | Reasoning | 推理模型的組態選項。 |
No | |
| 狀態 | 列舉 | 回應產生的狀態。
completed、failed、in_progress 或 incomplete 的其中之一。。可能的值: completed、、failed、 in_progressincomplete |
No | |
| temperature | number | 要使用的取樣溫度,介於 0 到 2 之間。 0.8 之類的較高值會讓輸出更隨機,而 0.2 之類的較低值會使它更集中且具決定性。 一般會建議改變這個值或 top_p,但不建議同時改變。 |
Yes | 1 |
| 收發簡訊 | 物件 | 來自模型的文字回應組態選項。 可以是純文字或結構化 JSON 數據。 瞭解詳情: - 文字輸入和輸出 - 結構化輸出 |
No | |
| └─ 格式 | TextResponseFormatConfiguration | 物件,指定模型必須輸出的格式。{ "type": "json_schema" }設定會啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 預設格式為 { "type": "text" },且沒有其他選項。不建議使用 gpt-4o 和較新的模型: 設定為 { "type": "json_object" } 可啟用較舊的 JSON 模式,以確保模型產生的訊息為有效的 JSON。 對於支援 json_schema 的模型,建議使用該選項。 |
No | |
| tool_choice | ToolChoiceOptions 或 ToolChoiceTypes 或 ToolChoiceFunction | 模型應該如何選取產生回應時要使用的工具(或工具)。
tools請參閱 參數,以瞭解如何指定模型可以呼叫的工具。 |
Yes | |
| tools | 陣列 | 模型可能會在產生回應時呼叫的工具陣列。 您可以藉由設定 tool_choice 參數來指定要使用的工具。您可以提供模型的兩種工具類別如下: - 內建工具 |
Yes | |
| top_p | number | 核取樣是溫度取樣的替代方法,在此方法中,模型會考慮包含 top_p 機率質量的權杖結果。 因此,0.1 表示只考慮組成前 10% 機率質量的權杖。 一般會建議改變這個值或 temperature,但不建議同時改變。 |
Yes | 1 |
| truncation | 列舉 | 用於模型回應的截斷策略。 - auto:如果此回應的內容和先前的內容超過模型的內容視窗大小,模型會藉由移除交談中間的輸入項目來調整回應,使其符合內容視窗。 - disabled (預設值):如果模型響應超過模型的內容視窗大小,要求將會失敗,並出現 400 錯誤。可能的值: auto、 disabled |
No | |
| 使用方式 | ResponseUsage | 代表令牌使用詳細數據,包括輸入令牌、輸出令牌、輸出令牌明細,以及所使用的令牌總數。 |
No | |
| 使用者 | 字串 | 代表使用者的唯一標識碼,可協助 OpenAI 監視和偵測濫用行為。 . |
No |
ResponseAudioDeltaEvent
當有部分音訊回應時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 字串 | Base64 編碼回應音訊位元組的區塊。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.audio.delta。可能的值: response.audio.delta |
Yes |
ResponseAudioDoneEvent
當音訊回應完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 事件的類型。 一律為 response.audio.done。可能的值: response.audio.done |
Yes |
ResponseAudioTranscriptDeltaEvent
當有部分音訊文字記錄時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 字串 | 音訊回應的部分文字記錄。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.audio.transcript.delta。可能的值: response.audio.transcript.delta |
Yes |
ResponseAudioTranscriptDoneEvent
完整音訊文字記錄完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 事件的類型。 一律為 response.audio.transcript.done。可能的值: response.audio.transcript.done |
Yes |
ResponseCodeInterpreterCallCodeDeltaEvent
當程式代碼解釋器新增部分代碼段時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 字串 | 程式代碼解釋器所新增的部分代碼段。 |
Yes | |
| output_index | 整數 | 程式碼解譯器呼叫的輸出項目索引正在進行中。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.code_interpreter_call.code.delta。可能的值: response.code_interpreter_call.code.delta |
Yes |
ResponseCodeInterpreterCallCodeDoneEvent
當程式碼片段的輸出由程式代碼解釋器完成時觸發。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | 字串 | 程式代碼解釋器輸出的最終代碼段。 |
Yes | |
| output_index | 整數 | 程式碼解譯器呼叫的輸出項目索引正在進行中。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.code_interpreter_call.code.done。可能的值: response.code_interpreter_call.code.done |
Yes |
ResponseCodeInterpreterCallCompletedEvent
當程式代碼解釋器呼叫完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| code_interpreter_call | CodeInterpreterToolCall | 執行程式代碼的工具呼叫。 |
Yes | |
| output_index | 整數 | 程式碼解譯器呼叫的輸出項目索引正在進行中。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.code_interpreter_call.completed。可能的值: response.code_interpreter_call.completed |
Yes |
ResponseCodeInterpreterCallInProgressEvent
當程式代碼解釋器呼叫正在進行時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| code_interpreter_call | CodeInterpreterToolCall | 執行程式代碼的工具呼叫。 |
Yes | |
| output_index | 整數 | 程式碼解譯器呼叫的輸出項目索引正在進行中。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.code_interpreter_call.in_progress。可能的值: response.code_interpreter_call.in_progress |
Yes |
ResponseCodeInterpreterCallInterpretingEvent
當程式代碼解釋器正在主動解譯代碼段時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| code_interpreter_call | CodeInterpreterToolCall | 執行程式代碼的工具呼叫。 |
Yes | |
| output_index | 整數 | 程式碼解譯器呼叫的輸出項目索引正在進行中。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.code_interpreter_call.interpreting。可能的值: response.code_interpreter_call.interpreting |
Yes |
ResponseCompletedEvent
模型回應完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| response | response | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.completed。可能的值: response.completed |
Yes |
ResponseContentPartAddedEvent
新增內容元件時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 已新增之內容元件的索引。 |
Yes | |
| item_id | 字串 | 已新增內容組件的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 已新增內容組件的輸出項目索引。 |
Yes | |
| 組件 | OutputContent | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.content_part.added。可能的值: response.content_part.added |
Yes |
ResponseContentPartDoneEvent
當內容部份已完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 完成的內容組件索引。 |
Yes | |
| item_id | 字串 | 已新增內容組件的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 已新增內容組件的輸出項目索引。 |
Yes | |
| 組件 | OutputContent | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.content_part.done。可能的值: response.content_part.done |
Yes |
ResponseCreatedEvent
建立回應時發出的事件。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| response | response | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.created。可能的值: response.created |
Yes |
ResponseError
當模型無法生成回應時,會返回一個錯誤對象。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | ResponseErrorCode | 回應的錯誤碼。 |
Yes | |
| 訊息 | 字串 | 人類看得懂的錯誤描述。 |
Yes |
ResponseErrorCode
回應的錯誤碼。
| Property | Value |
|---|---|
| Description | 回應的錯誤碼。 |
| Type | 字串 |
| Values | server_errorrate_limit_exceededinvalid_promptvector_store_timeoutinvalid_imageinvalid_image_formatinvalid_base64_imageinvalid_image_urlimage_too_largeimage_too_smallimage_parse_errorimage_content_policy_violationinvalid_image_modeimage_file_too_largeunsupported_image_media_typeempty_image_filefailed_to_download_imageimage_file_not_found |
ResponseErrorEvent
發生錯誤時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 字碼 | 字串 | 錯誤碼。 |
Yes | |
| 訊息 | 字串 | 錯誤訊息。 |
Yes | |
| param | 字串 | 錯誤參數。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 error。可能的值: error |
Yes |
ResponseFailedEvent
回應失敗時所發出的事件。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| response | response | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.failed。可能的值: response.failed |
Yes |
ResponseFileSearchCallCompletedEvent
完成檔案搜尋呼叫時發出 (找到的結果)。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| item_id | 字串 | 發起檔案搜尋呼叫的輸出項目的標識碼。 |
Yes | |
| output_index | 整數 | 起始檔案搜尋呼叫的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.file_search_call.completed。可能的值: response.file_search_call.completed |
Yes |
ResponseFileSearchCallInProgressEvent
起始檔案搜尋呼叫時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| item_id | 字串 | 發起檔案搜尋呼叫的輸出項目的標識碼。 |
Yes | |
| output_index | 整數 | 起始檔案搜尋呼叫的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.file_search_call.in_progress。可能的值: response.file_search_call.in_progress |
Yes |
ResponseFileSearchCallSearchingEvent
檔案搜尋目前正在搜尋時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| item_id | 字串 | 發起檔案搜尋呼叫的輸出項目的標識碼。 |
Yes | |
| output_index | 整數 | 檔案搜尋呼叫正在搜尋時輸出項目的索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.file_search_call.searching。可能的值: response.file_search_call.searching |
Yes |
ResponseFunctionCallArgumentsDeltaEvent
當有部分函式呼叫引數差異時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| delta | 字串 | 新增的函式呼叫引數差異。 |
Yes | |
| item_id | 字串 | 函式呼叫引數差異新增至的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 函式呼叫引數差異新增至的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.function_call_arguments.delta。可能的值: response.function_call_arguments.delta |
Yes |
ResponseFunctionCallArgumentsDoneEvent
在完成函式呼叫引數時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| arguments | 字串 | 函數調用引數。 | Yes | |
| item_id | 字串 | 項目的識別碼。 | Yes | |
| output_index | 整數 | 輸出項目的索引。 | Yes | |
| 型別 | 列舉 | 可能的值: response.function_call_arguments.done |
Yes |
ResponseInProgressEvent
回應正在進行時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| response | response | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.in_progress。可能的值: response.in_progress |
Yes |
ResponseIncompleteEvent
當回應以不完整狀態結束時所發出的事件。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| response | response | Yes | ||
| 型別 | 列舉 | 事件的類型。 一律為 response.incomplete。可能的值: response.incomplete |
Yes |
responseItemList
回應項目的清單。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | 用來產生此回應的項目清單。 | Yes | |
| first_id | 字串 | 清單中第一個項目的標識碼。 | Yes | |
| has_more | boolean | 是否有更多項目可用。 | Yes | |
| last_id | 字串 | 清單中最後一個項目的標識碼。 | Yes | |
| 物件 | 列舉 | 傳回的物件類型必須是 list。可能的值: list |
Yes |
ResponseModalities
您想要模型產生的輸出類型。 大部分模型都能夠產生文字,這是預設值:
["text"]
gpt-4o-audio-preview 模型也可以用來產生音訊。 若要要求此模型同時產生文字和音訊回應,您可以使用:
["text", "audio"]
未定義此元件的屬性。
ResponseModalitiesTextOnly
您想要模型產生的輸出類型。 大部分模型都能夠產生文字,這是預設值:
["text"]
此 API 很快就會支援其他輸出形式,包括音訊和影像。
未定義此元件的屬性。
ResponseOutputItemAddedEvent
新增輸出項目時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 項目 | OutputItem | Yes | ||
| output_index | 整數 | 已新增的輸出項目的索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_item.added。可能的值: response.output_item.added |
Yes |
ResponseOutputItemDoneEvent
當輸出項目標示為完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 項目 | OutputItem | Yes | ||
| output_index | 整數 | 標示為已完成之輸出專案的索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_item.done。可能的值: response.output_item.done |
Yes |
ResponseProperties
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| instructions | 字串 | 將系統訊息或開發人員訊息插入至模型上下文的第一個項目。 搭配 previous_response_id使用 時,將不會將先前回應的指示傳遞至下一個回應。 這可讓您輕鬆地在新回應中交換系統(或開發人員)訊息。 |
No | |
| max_output_tokens | 整數 | 可針對響應產生的令牌數目的上限,包括可見的輸出令牌和對話狀態。 |
No | |
| previous_response_id | 字串 | 先前回應模型的唯一識別碼。 使用這個功能來建立多輪對話。 | No | |
| reasoning | Reasoning | 推理模型的組態選項。 |
No | |
| 收發簡訊 | 物件 | 來自模型的文字回應組態選項。 可以是純文字或結構化 JSON 數據。 瞭解詳情: - 文字輸入和輸出 - 結構化輸出 |
No | |
| └─ 格式 | TextResponseFormatConfiguration | 物件,指定模型必須輸出的格式。{ "type": "json_schema" }設定會啟用結構化輸出,以確保模型符合您提供的 JSON 架構。 預設格式為 { "type": "text" },且沒有其他選項。不建議使用 gpt-4o 和較新的模型: 設定為 { "type": "json_object" } 可啟用較舊的 JSON 模式,以確保模型產生的訊息為有效的 JSON。 對於支援 json_schema 的模型,建議使用該選項。 |
No | |
| tool_choice | ToolChoiceOptions 或 ToolChoiceTypes 或 ToolChoiceFunction | 模型應該如何選取產生回應時要使用的工具(或工具)。
tools請參閱 參數,以瞭解如何指定模型可以呼叫的工具。 |
No | |
| tools | 陣列 | 模型可能會在產生回應時呼叫的工具陣列。 您可以藉由設定 tool_choice 參數來指定要使用的工具。您可以提供模型的兩種工具類別如下: - 內建工具 |
No | |
| truncation | 列舉 | 用於模型回應的截斷策略。 - auto:如果此回應的內容和先前的內容超過模型的內容視窗大小,模型會藉由移除交談中間的輸入項目來調整回應,使其符合內容視窗。 - disabled (預設值):如果模型響應超過模型的內容視窗大小,要求將會失敗,並出現 400 錯誤。可能的值: auto、 disabled |
No |
ResponseRefusalDeltaEvent
當有部分拒絕文字時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 拒絕文字新增的內容組件索引。 |
Yes | |
| delta | 字串 | 新增的拒絕文字。 |
Yes | |
| item_id | 字串 | 要新增拒絕文字的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 拒絕文字新增至的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.refusal.delta。可能的值: response.refusal.delta |
Yes |
ResponseRefusalDoneEvent
拒絕文字完成時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 已完成拒絕文字的內容組件索引。 |
Yes | |
| item_id | 字串 | 已完成拒絕文字的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 拒絕文字完成的輸出項目索引。 |
Yes | |
| refusal | 字串 | 最終的拒絕文字。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.refusal.done。可能的值: response.refusal.done |
Yes |
responseStreamEvent
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 註釋 | Annotation | Yes | ||
| annotation_index | 整數 | 已新增註釋的索引。 |
Yes | |
| arguments | 字串 | 函數調用引數。 | Yes | |
| 字碼 | 字串 | 錯誤碼。 |
Yes | |
| code_interpreter_call | CodeInterpreterToolCall | 執行程式代碼的工具呼叫。 |
Yes | |
| content_index | 整數 | 文字內容完成的內容組件索引。 |
Yes | |
| delta | 字串 | 已新增的文字差異。 |
Yes | |
| 項目 | OutputItem | 標示為已完成的輸出專案。 |
Yes | |
| item_id | 字串 | 已完成文字內容的輸出項目識別碼。 |
Yes | |
| 訊息 | 字串 | 錯誤訊息。 |
Yes | |
| output_index | 整數 | 已完成文字內容的輸出項目索引。 |
Yes | |
| param | 字串 | 錯誤參數。 |
Yes | |
| 組件 | OutputContent | 完成的內容部分。 |
Yes | |
| refusal | 字串 | 最終的拒絕文字。 |
Yes | |
| response | response | 回應不完整。 |
Yes | |
| 收發簡訊 | 字串 | 已完成的文字內容。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_text.done。可能的值: response.output_text.done |
Yes |
ResponseTextAnnotationDeltaEvent
新增文字批註時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 註釋 | Annotation | Yes | ||
| annotation_index | 整數 | 已新增註釋的索引。 |
Yes | |
| content_index | 整數 | 已新增文字註釋的內容組件索引。 |
Yes | |
| item_id | 字串 | 已新增文字註釋的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 已新增文字註釋的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_text.annotation.added。可能的值: response.output_text.annotation.added |
Yes |
ResponseTextDeltaEvent
當有額外的文字差異時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 已新增文字差異的內容組件索引。 |
Yes | |
| delta | 字串 | 已新增的文字差異。 |
Yes | |
| item_id | 字串 | 已新增文字差異的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 已新增文字差異的輸出項目索引。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_text.delta。可能的值: response.output_text.delta |
Yes |
ResponseTextDoneEvent
完成文字內容時發出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| content_index | 整數 | 文字內容完成的內容組件索引。 |
Yes | |
| item_id | 字串 | 已完成文字內容的輸出項目識別碼。 |
Yes | |
| output_index | 整數 | 已完成文字內容的輸出項目索引。 |
Yes | |
| 收發簡訊 | 字串 | 已完成的文字內容。 |
Yes | |
| 型別 | 列舉 | 事件的類型。 一律為 response.output_text.done。可能的值: response.output_text.done |
Yes |
ResponseUsage
代表令牌使用詳細數據,包括輸入令牌、輸出令牌、輸出令牌明細,以及所使用的令牌總數。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| input_tokens | 整數 | 輸入令牌的數目。 | Yes | |
| output_tokens | 整數 | 輸出令牌的數目。 | Yes | |
| output_tokens_details | 物件 | 輸出權杖的詳細明細。 | Yes | |
| └─ 推理詞元 | 整數 | 推理令牌的數目。 | No | |
| total_tokens | 整數 | 使用的令牌總數。 | Yes |
Screenshot
螢幕擷取畫面動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 指定事件類型。 針對螢幕快照動作,這個屬性一律設定為 screenshot。可能的值: screenshot |
Yes |
Scroll
捲動動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| scroll_x | 整數 | 水平捲動距離。 |
Yes | |
| scroll_y | 整數 | 垂直捲動距離。 |
Yes | |
| 型別 | 列舉 | 指定事件類型。 對於卷動動作,這個屬性一律會設定為 scroll。可能的值: scroll |
Yes | |
| x | 整數 | 發生捲動的 X 座標。 |
Yes | |
| y | 整數 | 發生捲動的 Y 座標位置。 |
Yes |
StopConfiguration
最多 4 個序列,API 將在每個序列中停止產生更多的令牌。 傳回的文字不會包含停止序列。
此元件可以是下列其中之一:
TextResponseFormatConfiguration
物件,指定模型必須輸出的格式。
{ "type": "json_schema" }設定可啟用結構化輸出,以確保模型符合您提供的 JSON 架構。
預設格式為 { "type": "text" },且沒有其他選項。
不建議使用 gpt-4o 和較新的模型:
設定為 { "type": "json_object" } 可啟用較舊的 JSON 模式,以確保模型產生的訊息為有效的 JSON。 對於支援 json_schema 的模型,建議使用該選項。
此元件可以是下列其中之一:
TextResponseFormatJsonSchema
JSON 結構的回應格式。 用來產生結構化 JSON 回應。 深入了解結構化輸出。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| description | 字串 | 回應格式用途的描述,模型用來決定如何以該格式進行回應。 |
No | |
| name | 字串 | 回應格式的名稱。 必須是 a-z、A-Z、0-9,或包含底線或虛線,長度上限為 64。 |
No | |
| 結構描述 | ResponseFormatJsonSchemaSchema | 回應格式的結構描述,描述為 JSON 結構描述物件。 | Yes | |
| strict | boolean | 是否要在產生輸出時啟用嚴格的架構遵循。 如果設為 true,模型將一律遵循 schema 欄位中定義的確切結構描述。 當 strict 為 true 時,僅支援 JSON 結構描述的子集。 |
No | False |
| 型別 | 列舉 | 正在定義的回應格式類型。 一律為 json_schema。可能的值: json_schema |
Yes |
Tool
此元件可以是下列其中之一:
ToolChoiceFunction
使用此選項可強制模型呼叫特定函式。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| name | 字串 | 要呼叫的函式名稱。 | Yes | |
| 型別 | 列舉 | 針對函式呼叫,類型一律為function。可能的值: function |
Yes |
ToolChoiceOptions
控制模型所呼叫的工具 (若有)。
none 表示模型不會呼叫任何工具,而是會產生訊息。
auto 表示模型可以選擇產生訊息或是呼叫一或多個工具。
required 表示模型必須呼叫一或多個工具。
| Property | Value |
|---|---|
| Description | 控制模型所呼叫的工具 (若有)。none 表示模型不會呼叫任何工具,而是會產生訊息。auto 表示模型可以選擇產生訊息或是呼叫一或多個工具。required 表示模型必須呼叫一或多個工具。 |
| Type | 字串 |
| Values | noneautorequired |
ToolChoiceTypes
指出模型應該使用內建工具來產生回應。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 模型應該使用的裝載工具類型。 允許的值為: - file_search- computer_use_preview可能的值: file_search、 computer_use_preview |
Yes |
類型
要輸入文字的動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 字串 | 要輸入的文字。 |
Yes | |
| 型別 | 列舉 | 指定事件類型。 對於類型動作,這個屬性一律會設定為 type。可能的值: type |
Yes |
UpdateVectorStoreFileAttributesRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| attributes | VectorStoreFileAttributes | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元、布爾值或數位的字串。 |
Yes |
UrlCitation
用來產生模型回應之 Web 資源的引文。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| end_index | 整數 | 訊息中 URL 引文最後一個字元的索引。 |
Yes | |
| start_index | 整數 | 訊息中 URL 引文第一個字元的索引。 |
Yes | |
| title | 字串 | Web 資源的標題。 |
Yes | |
| 型別 | 列舉 | URL 引文的類型。 一律為 url_citation。可能的值: url_citation |
Yes | |
| url | 字串 | Web 資源的 URL。 |
Yes |
VectorStoreFileAttributes
可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元、布爾值或數位的字串。
未定義此元件的屬性。
VectorStoreFileContentResponse
表示向量存放區檔案的剖析內容。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | 解析後的檔案內容。 | Yes | |
| has_more | boolean | 指出是否有更多要擷取的內容頁面。 | Yes | |
| next_page | 字串 | 下一頁的權杖 (若有)。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 vector_store.file_content.page可能的值: vector_store.file_content.page |
Yes |
VectorStoreSearchRequest
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| filters | ComparisonFilter 或 CompoundFilter | 根據檔案屬性來套用的過濾器。 | No | |
| max_num_results | 整數 | 要傳回的結果數目上限。 此數字應介於 1 到 50 之間。 | No | 10 |
| 查詢 | 字串或陣列 | 搜尋的查詢字串 | Yes | |
| ranking_options | 物件 | 搜尋的排名選項。 | No | |
| └─ ranker | 列舉 | 可能的值: auto、 default-2024-11-15 |
No | |
| └─ score_threshold | number | No | 0 | |
| rewrite_query | boolean | 是否要重寫向量搜尋的自然語言查詢。 | No | False |
VectorStoreSearchResultContentObject
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 收發簡訊 | 字串 | 由搜尋結果返回的文字內容。 | Yes | |
| 型別 | 列舉 | 內容類型。 可能的值: text |
Yes |
VectorStoreSearchResultItem
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| attributes | VectorStoreFileAttributes | 可附加至物件的索引鍵/值組 (16 個為一組)。 這很適合用來以結構化格式儲存物件的其他資訊,以及透過 API 或儀錶板查詢物件。 索引鍵是長度上限為64個字元的字串。 值是長度上限為 512 個字元、布爾值或數位的字串。 |
Yes | |
| 內容 | 陣列 | 檔案中的內容區塊。 | Yes | |
| file_id | 字串 | 向量存放區檔案的標識碼。 | Yes | |
| filename | 字串 | 向量存放區檔案的名稱。 | Yes | |
| 分數 | number | 結果的相似度分數。 | Yes |
VectorStoreSearchResultsPage
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 陣列 | 搜尋結果項目的清單。 | Yes | |
| has_more | boolean | 指出是否有更多要擷取的結果。 | Yes | |
| next_page | 字串 | 下一頁的權杖 (若有)。 | Yes | |
| 物件 | 列舉 | 物件類型,一律為 vector_store.search_results.page可能的值: vector_store.search_results.page |
Yes | |
| search_query | 陣列 | Yes |
VoiceIdsShared
未定義此元件的屬性。
Wait
等候動作。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 型別 | 列舉 | 指定事件類型。 若為等候動作,這個屬性一律會設定為 wait。可能的值: wait |
Yes |
ReasoningEffort
限制推理模型的推理工作。 目前支援的值為 low、medium 和 high。 減少推理工作可能會導致回應更快,以及回應中用於推理的權杖較少。
| Property | Value |
|---|---|
| Description | 限制推理模型的推理工作。 目前支援的值為 low、medium 和 high。 減少推理工作可能會導致回應更快,以及回應中用於推理的權杖較少。 |
| Type | 字串 |
| Default | 適中 |
| Values | lowmediumhigh |
errorEvent
在錯誤發生時發生。 這可能是內部伺服器錯誤或逾時所導致的。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | error | Yes | ||
| 事件 | 字串 | Yes |
事件列舉:ErrorEventEnum
| Value | Description |
|---|---|
| 錯誤 |
doneEvent
在資料流結束時發生。
| Name | 類型 | Description | Required | Default |
|---|---|---|---|---|
| 資料 | 字串 | Yes | ||
| 事件 | 字串 | Yes |
事件列舉:DoneEventEnum
| Value | Description |
|---|---|
| done |
資料列舉:DoneEventDataEnum
| Value | Description |
|---|---|
| [DONE] |
後續步驟
深入了解模型,以及使用 REST API 進行微調。 深入了解驅動 Azure OpenAI 的基礎模型。