Introduction
OpenAPI Type 的Plugin,使用符合OpenAPI 格式的yaml檔,只要在 Plugin 中,指定你的yaml 的位置,DaVinci 會去這個 url 下載 yaml 檔案,並且依照裡面的 API format 進行 API 的資訊檢索,OpenAPI Type Plugin example:
{ "id": "Weather_API", "schema_version": "v1", "name_for_human": "Weather_API", "name_for_model": "Weather_API", "description_for_human": "Weather_API", "description_for_model": "當你需要查詢未來天氣的相關資料, 請使用這個API, 並且整理相關資訊以表格輸出", "api": { "type": "openapi", "url": "https://example.com/weather.yaml" } }
這是一個 查詢天氣的範例,假設我們要使用 氣象資料開放平台 提供的開源API來索取資料,需要兩個步驟:
根據氣象資料開放平台的API範例,將各 API 的 url 以及參數,轉換成 yaml 檔案,並且存放到您的伺服器中。
plugin json 檔裡面,修改這兩個地方:
"api": { "type": "openapi", "url": "https://example.com/weather.yaml" }
即可完成Plugin 的製作
註記:為了運作穩定,目前 OpenAPI Plugin 只能運作在 GPT4-Turbo 上,無法在其他 Model 上使用。