Auto REST API 參考(Beta)

Note

Auto 目前為外部合作夥伴提供 Beta 版,且其應用程式設定檔已啟用自動。API 表面和合約可能會改變。

端點:POST https://api.microsoft.ai/v3/auto

所有請求都需要 API 金鑰或 Microsoft Entra ID 存取權杖。 請參閱 認證 部分的設定說明。

範例要求

curl -X POST "https://api.microsoft.ai/v3/auto" \
  -H "x-apikey: <Your API key>" \
  -H "content-type: application/json" \
  -d '{
    "query": "Microsoft AI announcements",
    "language": "en",
    "region": "US",
    "location": "lat:47.6062;long:-122.3321",
    "mode": "fast",
    "maxResponseLength": 30000,
    "responseFilter": ["web", "news"]
  }'

Parameters

參數 Required 類型 Default Description
query Yes 字串 - 搜尋查詢,字元範圍從 1 到 1,000 字元。 支援 site: 與 -site: 運算子。
language No 字串 en 兩字母 ISO 639-1 介面語言。
region No 字串 US 兩個字母的市場或國家/地區代碼。
mode No 字串 fast fast 優先考量速度; advanced 重視全面性。
maxResponseLength No 整數 30000 最大總響應長度。 低於1500的數值則被限制在1500;超過 500000 的數值則被夾在 500000。
location No 字串 - 例如lat:47.6062;long:-122.3321格式中的地理背景lat:<latitude>;long:<longitude>。
responseFilter No 字串陣列 - 符合資格的答案類型:web, news, timezone, imagesweathervideos。

回應

成功的證據回應會返回 200 OK。 每個結果包含一個打型的證據物件及其支持的引用。 未被支持或錯誤的證據及其引用資料均被省略。 若所有提供的證據結果都被省略,則 results 為空。

自我證據回應

Field 類型 Description
results 自動證據結果陣列 證據項目與引用的範圍都指向該結果。
traceId 字串 用於除錯與支援的關聯性 ID。

自動證據結果

Field 類型 Description
evidence 自證 產生了打字證據。
citations 自動證據引證陣列 僅有支持此證據的引用。

自證

證據物件自身 type 的判別子選擇 的 content範式。

type content
text 網路與新聞結果的線索證據回傳。
media/image 影像結果物件。
media/video 影片結果物件。
structured/weather 天氣物件。
structured/timeZone 時區物件。

新聞文本證據也可以包含 thumbnail 一個,其中 url、 width、 height和 。 結構化內容遵循與其對應搜尋答案相同的公開欄位可見性規則。

自動證據引用

Field 類型 Description
contentSource 字串 引用來源。
title 字串 引用標題。
url 字串 引用網址。
lastUpdatedAt 字串 最後更新時間戳。
crawledAt 字串 爬取時間戳記。
language 字串 內容語言。
isAdult boolean 引用是否包含成人內容。

範例回應

{
  "results": [
    {
      "evidence": {
        "type": "text",
        "content": "Microsoft announced a new set of AI capabilities."
      },
      "citations": [
        {
          "contentSource": "web",
          "url": "https://www.microsoft.com/en-us/ai",
          "title": "Microsoft AI",
          "language": "en",
          "isAdult": false
        }
      ]
    }
  ],
  "traceId": "00000000000000000000000000000000"
}

錯誤碼

狀態代碼 Description
200 申請成功,包括有效的搜尋但未找到結果。
400 參數無效或 JSON 格式錯誤。
401 缺少或無效的認證憑證。
403 自動認證的設定檔並未啟用。
429 超出資歷或配額上限。
500 內部服務失敗。
503 必須的服務無法提供。
504 要求已逾時。

關於共享錯誤結構與重試指引,請參見 錯誤處理。