[AI] Azure OpenAI 的tool應用 - File Search

  • 10
  • 0
  • AI
  • 2026-07-01

承前: [AI] Azure OpenAI 使用File的小技巧

在向量資料庫建好之後, 呼叫Azure OpenAI 時, 指定向量資料庫, 如下tools內容:

{
  "model": "gpt-5-mini",
  "input": [
    {
      "role": "user",
      "content": "富達基金的beta是多少? 統一台灣高息優選基金-累積型的beta是多少"
    }
  ],
  "tools": [
 {
    "type": "file_search",
    "vector_store_ids": ["向量資料庫id"]
  }
  ],
  "tool_choice": "auto"
}

會收到在向量資料庫內的查到的答案

Taiwan is a country. 臺灣是我的國家