|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# GPT Action Library: Getting Started (Weather.gov)" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "source": [ |
| 14 | + "## Introduction" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "This page provides an instruction & guide for developers building a GPT Action for a specific application. Before you proceed, make sure to first familiarize yourself with the following information: \n", |
| 22 | + "- [Introduction to GPT Actions](https://platform.openai.com/docs/actions)\n", |
| 23 | + "- [Introduction to GPT Actions Library](https://platform.openai.com/docs/actions-library)\n", |
| 24 | + "- [Example of Buliding a GPT Action from Scratch](https://platform.openai.com/docs/getting-started)" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "metadata": {}, |
| 30 | + "source": [ |
| 31 | + "This particular GPT Action provides an overview of how to connect to a **Weather.gov** weather forecast. This Action takes a user’s question about a location, converts the lat-long into a weather forecast office (WFO), x, and y coordinates, then converts those 3 values into a weather forecast.\n", |
| 32 | + "\n", |
| 33 | + "Note: When setting up the GPT Action, for authentication, leave it with \"None\". This is a public API and does not require any Authentication" |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "cell_type": "markdown", |
| 38 | + "metadata": {}, |
| 39 | + "source": [ |
| 40 | + "## Application Information" |
| 41 | + ] |
| 42 | + }, |
| 43 | + { |
| 44 | + "cell_type": "markdown", |
| 45 | + "metadata": {}, |
| 46 | + "source": [ |
| 47 | + "### Application Key Links" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "cell_type": "markdown", |
| 52 | + "metadata": {}, |
| 53 | + "source": [ |
| 54 | + "Check out these links from the application before you get started:\n", |
| 55 | + "- Application Website: https://www.weather.gov/ \n", |
| 56 | + "- Application API Documentation: https://www.weather.gov/documentation/services-web-api " |
| 57 | + ] |
| 58 | + }, |
| 59 | + { |
| 60 | + "cell_type": "markdown", |
| 61 | + "metadata": {}, |
| 62 | + "source": [ |
| 63 | + "## ChatGPT Steps" |
| 64 | + ] |
| 65 | + }, |
| 66 | + { |
| 67 | + "cell_type": "markdown", |
| 68 | + "metadata": {}, |
| 69 | + "source": [ |
| 70 | + "### Custom GPT Instructions " |
| 71 | + ] |
| 72 | + }, |
| 73 | + { |
| 74 | + "cell_type": "markdown", |
| 75 | + "metadata": {}, |
| 76 | + "source": [ |
| 77 | + "Once you've created a Custom GPT, copy the text below in the Instructions panel. Have questions? Check out [Getting Started Example](https://platform.openai.com/docs/getting-started) to see how this step works in more detail." |
| 78 | + ] |
| 79 | + }, |
| 80 | + { |
| 81 | + "cell_type": "code", |
| 82 | + "execution_count": null, |
| 83 | + "metadata": { |
| 84 | + "vscode": { |
| 85 | + "languageId": "plaintext" |
| 86 | + } |
| 87 | + }, |
| 88 | + "outputs": [], |
| 89 | + "source": [ |
| 90 | + "**Context**: A user needs information related to a weather forecast of a specific location.\n", |
| 91 | + "\n", |
| 92 | + "**Instructions**:\n", |
| 93 | + "1. The user will provide a lat-long point or a general location or landmark (e.g. New York City, the White House). If the user does not provide one, ask for the relevant location\n", |
| 94 | + "2. If the user provides a general location or landmark, convert that into a lat-long coordinate. If required, browse the web to look up the lat-long point. \n", |
| 95 | + "3. Run the \"getPointData\" API action and retrieve back the gridId, gridX, and gridY parameters.\n", |
| 96 | + "4. Apply those variables as the office, gridX, and gridY variables in the \"getGridpointForecast\" API action to retrieve back a forecast\n", |
| 97 | + "5. Use that forecast to answer the user's question \n", |
| 98 | + "\n", |
| 99 | + "**Additional Notes**: \n", |
| 100 | + "- Assume the user uses US weather units (e.g. Farenheit) unless otherwise specified\n", |
| 101 | + "- If the user says \"Let's get started\" or \"What do I do?\", explain the purpose of this Custom GPT" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "markdown", |
| 106 | + "metadata": {}, |
| 107 | + "source": [ |
| 108 | + "### OpenAPI Schema " |
| 109 | + ] |
| 110 | + }, |
| 111 | + { |
| 112 | + "cell_type": "markdown", |
| 113 | + "metadata": {}, |
| 114 | + "source": [ |
| 115 | + "Once you've created a Custom GPT, copy the text below in the Actions panel. Have questions? Check out [Getting Started Example](https://platform.openai.com/docs/getting-started) to see how this step works in more detail." |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "cell_type": "code", |
| 120 | + "execution_count": null, |
| 121 | + "metadata": { |
| 122 | + "vscode": { |
| 123 | + "languageId": "yaml" |
| 124 | + } |
| 125 | + }, |
| 126 | + "outputs": [], |
| 127 | + "source": [ |
| 128 | + "openapi: 3.1.0\n", |
| 129 | + "info:\n", |
| 130 | + " title: NWS Weather API\n", |
| 131 | + " description: Access to weather data including forecasts, alerts, and observations.\n", |
| 132 | + " version: 1.0.0\n", |
| 133 | + "servers:\n", |
| 134 | + " - url: https://api.weather.gov\n", |
| 135 | + " description: Main API Server\n", |
| 136 | + "paths:\n", |
| 137 | + " /points/{latitude},{longitude}:\n", |
| 138 | + " get:\n", |
| 139 | + " operationId: getPointData\n", |
| 140 | + " summary: Get forecast grid endpoints for a specific location\n", |
| 141 | + " parameters:\n", |
| 142 | + " - name: latitude\n", |
| 143 | + " in: path\n", |
| 144 | + " required: true\n", |
| 145 | + " schema:\n", |
| 146 | + " type: number\n", |
| 147 | + " format: float\n", |
| 148 | + " description: Latitude of the point\n", |
| 149 | + " - name: longitude\n", |
| 150 | + " in: path\n", |
| 151 | + " required: true\n", |
| 152 | + " schema:\n", |
| 153 | + " type: number\n", |
| 154 | + " format: float\n", |
| 155 | + " description: Longitude of the point\n", |
| 156 | + " responses:\n", |
| 157 | + " '200':\n", |
| 158 | + " description: Successfully retrieved grid endpoints\n", |
| 159 | + " content:\n", |
| 160 | + " application/json:\n", |
| 161 | + " schema:\n", |
| 162 | + " type: object\n", |
| 163 | + " properties:\n", |
| 164 | + " properties:\n", |
| 165 | + " type: object\n", |
| 166 | + " properties:\n", |
| 167 | + " forecast:\n", |
| 168 | + " type: string\n", |
| 169 | + " format: uri\n", |
| 170 | + " forecastHourly:\n", |
| 171 | + " type: string\n", |
| 172 | + " format: uri\n", |
| 173 | + " forecastGridData:\n", |
| 174 | + " type: string\n", |
| 175 | + " format: uri\n", |
| 176 | + "\n", |
| 177 | + " /gridpoints/{office}/{gridX},{gridY}/forecast:\n", |
| 178 | + " get:\n", |
| 179 | + " operationId: getGridpointForecast\n", |
| 180 | + " summary: Get forecast for a given grid point\n", |
| 181 | + " parameters:\n", |
| 182 | + " - name: office\n", |
| 183 | + " in: path\n", |
| 184 | + " required: true\n", |
| 185 | + " schema:\n", |
| 186 | + " type: string\n", |
| 187 | + " description: Weather Forecast Office ID\n", |
| 188 | + " - name: gridX\n", |
| 189 | + " in: path\n", |
| 190 | + " required: true\n", |
| 191 | + " schema:\n", |
| 192 | + " type: integer\n", |
| 193 | + " description: X coordinate of the grid\n", |
| 194 | + " - name: gridY\n", |
| 195 | + " in: path\n", |
| 196 | + " required: true\n", |
| 197 | + " schema:\n", |
| 198 | + " type: integer\n", |
| 199 | + " description: Y coordinate of the grid\n", |
| 200 | + " responses:\n", |
| 201 | + " '200':\n", |
| 202 | + " description: Successfully retrieved gridpoint forecast\n", |
| 203 | + " content:\n", |
| 204 | + " application/json:\n", |
| 205 | + " schema:\n", |
| 206 | + " type: object\n", |
| 207 | + " properties:\n", |
| 208 | + " properties:\n", |
| 209 | + " type: object\n", |
| 210 | + " properties:\n", |
| 211 | + " periods:\n", |
| 212 | + " type: array\n", |
| 213 | + " items:\n", |
| 214 | + " type: object\n", |
| 215 | + " properties:\n", |
| 216 | + " number:\n", |
| 217 | + " type: integer\n", |
| 218 | + " name:\n", |
| 219 | + " type: string\n", |
| 220 | + " startTime:\n", |
| 221 | + " type: string\n", |
| 222 | + " format: date-time\n", |
| 223 | + " endTime:\n", |
| 224 | + " type: string\n", |
| 225 | + " format: date-time\n", |
| 226 | + " temperature:\n", |
| 227 | + " type: integer\n", |
| 228 | + " temperatureUnit:\n", |
| 229 | + " type: string\n", |
| 230 | + " windSpeed:\n", |
| 231 | + " type: string\n", |
| 232 | + " windDirection:\n", |
| 233 | + " type: string\n", |
| 234 | + " icon:\n", |
| 235 | + " type: string\n", |
| 236 | + " format: uri\n", |
| 237 | + " shortForecast:\n", |
| 238 | + " type: string\n", |
| 239 | + " detailedForecast:\n", |
| 240 | + " type: string" |
| 241 | + ] |
| 242 | + }, |
| 243 | + { |
| 244 | + "cell_type": "markdown", |
| 245 | + "metadata": {}, |
| 246 | + "source": [ |
| 247 | + "### FAQ & Troubleshooting" |
| 248 | + ] |
| 249 | + }, |
| 250 | + { |
| 251 | + "cell_type": "markdown", |
| 252 | + "metadata": {}, |
| 253 | + "source": [ |
| 254 | + "*Are there integrations that you’d like us to prioritize? Are there errors in our integrations? File a PR or issue in our github, and we’ll take a look.*\n" |
| 255 | + ] |
| 256 | + } |
| 257 | + ], |
| 258 | + "metadata": { |
| 259 | + "language_info": { |
| 260 | + "name": "python" |
| 261 | + } |
| 262 | + }, |
| 263 | + "nbformat": 4, |
| 264 | + "nbformat_minor": 2 |
| 265 | +} |
0 commit comments