Function calling利用の具体例

課題

以下のAPIを利用し、期間を指定すると、その期間の新型コロナウイルス陽性患者10人をテーブル形式にまとめるGPTsを作成してください。作成後、年代を可視化してください。
https://portal.data.metro.tokyo.lg.jp/opendata-api/

Actions例

{
  "openapi": "3.1.0",
  "info": {
    "title": "Tokyo Covid-19 Patient API",
    "description": "Provides data on Covid-19 patients in Tokyo.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://api.data.metro.tokyo.lg.jp/v1"
    }
  ],
  "paths": {
    "/Covid19Patient": {
      "get": {
        "description": "Retrieves Covid-19 patient data for Tokyo",
        "operationId": "getCovid19PatientData",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "description": "Start date for data retrieval in YYYY-MM-DD format",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "till",
            "in": "query",
            "description": "End date for data retrieval in YYYY-MM-DD format",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of records to return",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with Covid-19 patient data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Covid19Patient"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Covid19Patient": {
        "type": "object",
        "properties": {
          "patientId": {
            "type": "integer",
            "description": "Unique identifier for each patient"
          },
          "dateConfirmed": {
            "type": "string",
            "format": "date",
            "description": "Date when the patient was confirmed positive"
          },
          "ageGroup": {
            "type": "string",
            "description": "Age group of the patient"
          },
          "gender": {
            "type": "string",
            "description": "Gender of the patient"
          },
          "residence": {
            "type": "string",
            "description": "Residence of the patient"
          },
          "hospitalizedOrNot": {
            "type": "boolean",
            "description": "Whether the patient is hospitalized"
          }
        }
      }
    }
  }
}

インストラクション例

コロナ患者を指定日の範囲からリストアップしてテーブルにまとめます

プロンプト例

例1

2022年6月1日から3日間の10人

例2

年代の分布を以下の手順で可視化してください。
1. 最適なグラフ3通りリストアップ
2. 1に最適なライブラリを選出
3. 出力
2024/06/30 01:04