mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
266 lines
9.0 KiB
Plaintext
266 lines
9.0 KiB
Plaintext
![]() |
{
|
|||
|
"cells": [
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"# GPT Action Library: Getting Started (Weather.gov)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Introduction"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"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",
|
|||
|
"- [Introduction to GPT Actions](https://platform.openai.com/docs/actions)\n",
|
|||
|
"- [Introduction to GPT Actions Library](https://platform.openai.com/docs/actions-library)\n",
|
|||
|
"- [Example of Buliding a GPT Action from Scratch](https://platform.openai.com/docs/getting-started)"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"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",
|
|||
|
"\n",
|
|||
|
"Note: When setting up the GPT Action, for authentication, leave it with \"None\". This is a public API and does not require any Authentication"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## Application Information"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Application Key Links"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"Check out these links from the application before you get started:\n",
|
|||
|
"- Application Website: https://www.weather.gov/ \n",
|
|||
|
"- Application API Documentation: https://www.weather.gov/documentation/services-web-api "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"## ChatGPT Steps"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### Custom GPT Instructions "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"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."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"vscode": {
|
|||
|
"languageId": "plaintext"
|
|||
|
}
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"**Context**: A user needs information related to a weather forecast of a specific location.\n",
|
|||
|
"\n",
|
|||
|
"**Instructions**:\n",
|
|||
|
"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",
|
|||
|
"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",
|
|||
|
"3. Run the \"getPointData\" API action and retrieve back the gridId, gridX, and gridY parameters.\n",
|
|||
|
"4. Apply those variables as the office, gridX, and gridY variables in the \"getGridpointForecast\" API action to retrieve back a forecast\n",
|
|||
|
"5. Use that forecast to answer the user's question \n",
|
|||
|
"\n",
|
|||
|
"**Additional Notes**: \n",
|
|||
|
"- Assume the user uses US weather units (e.g. Farenheit) unless otherwise specified\n",
|
|||
|
"- If the user says \"Let's get started\" or \"What do I do?\", explain the purpose of this Custom GPT"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### OpenAPI Schema "
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"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."
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "code",
|
|||
|
"execution_count": null,
|
|||
|
"metadata": {
|
|||
|
"vscode": {
|
|||
|
"languageId": "yaml"
|
|||
|
}
|
|||
|
},
|
|||
|
"outputs": [],
|
|||
|
"source": [
|
|||
|
"openapi: 3.1.0\n",
|
|||
|
"info:\n",
|
|||
|
" title: NWS Weather API\n",
|
|||
|
" description: Access to weather data including forecasts, alerts, and observations.\n",
|
|||
|
" version: 1.0.0\n",
|
|||
|
"servers:\n",
|
|||
|
" - url: https://api.weather.gov\n",
|
|||
|
" description: Main API Server\n",
|
|||
|
"paths:\n",
|
|||
|
" /points/{latitude},{longitude}:\n",
|
|||
|
" get:\n",
|
|||
|
" operationId: getPointData\n",
|
|||
|
" summary: Get forecast grid endpoints for a specific location\n",
|
|||
|
" parameters:\n",
|
|||
|
" - name: latitude\n",
|
|||
|
" in: path\n",
|
|||
|
" required: true\n",
|
|||
|
" schema:\n",
|
|||
|
" type: number\n",
|
|||
|
" format: float\n",
|
|||
|
" description: Latitude of the point\n",
|
|||
|
" - name: longitude\n",
|
|||
|
" in: path\n",
|
|||
|
" required: true\n",
|
|||
|
" schema:\n",
|
|||
|
" type: number\n",
|
|||
|
" format: float\n",
|
|||
|
" description: Longitude of the point\n",
|
|||
|
" responses:\n",
|
|||
|
" '200':\n",
|
|||
|
" description: Successfully retrieved grid endpoints\n",
|
|||
|
" content:\n",
|
|||
|
" application/json:\n",
|
|||
|
" schema:\n",
|
|||
|
" type: object\n",
|
|||
|
" properties:\n",
|
|||
|
" properties:\n",
|
|||
|
" type: object\n",
|
|||
|
" properties:\n",
|
|||
|
" forecast:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: uri\n",
|
|||
|
" forecastHourly:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: uri\n",
|
|||
|
" forecastGridData:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: uri\n",
|
|||
|
"\n",
|
|||
|
" /gridpoints/{office}/{gridX},{gridY}/forecast:\n",
|
|||
|
" get:\n",
|
|||
|
" operationId: getGridpointForecast\n",
|
|||
|
" summary: Get forecast for a given grid point\n",
|
|||
|
" parameters:\n",
|
|||
|
" - name: office\n",
|
|||
|
" in: path\n",
|
|||
|
" required: true\n",
|
|||
|
" schema:\n",
|
|||
|
" type: string\n",
|
|||
|
" description: Weather Forecast Office ID\n",
|
|||
|
" - name: gridX\n",
|
|||
|
" in: path\n",
|
|||
|
" required: true\n",
|
|||
|
" schema:\n",
|
|||
|
" type: integer\n",
|
|||
|
" description: X coordinate of the grid\n",
|
|||
|
" - name: gridY\n",
|
|||
|
" in: path\n",
|
|||
|
" required: true\n",
|
|||
|
" schema:\n",
|
|||
|
" type: integer\n",
|
|||
|
" description: Y coordinate of the grid\n",
|
|||
|
" responses:\n",
|
|||
|
" '200':\n",
|
|||
|
" description: Successfully retrieved gridpoint forecast\n",
|
|||
|
" content:\n",
|
|||
|
" application/json:\n",
|
|||
|
" schema:\n",
|
|||
|
" type: object\n",
|
|||
|
" properties:\n",
|
|||
|
" properties:\n",
|
|||
|
" type: object\n",
|
|||
|
" properties:\n",
|
|||
|
" periods:\n",
|
|||
|
" type: array\n",
|
|||
|
" items:\n",
|
|||
|
" type: object\n",
|
|||
|
" properties:\n",
|
|||
|
" number:\n",
|
|||
|
" type: integer\n",
|
|||
|
" name:\n",
|
|||
|
" type: string\n",
|
|||
|
" startTime:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: date-time\n",
|
|||
|
" endTime:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: date-time\n",
|
|||
|
" temperature:\n",
|
|||
|
" type: integer\n",
|
|||
|
" temperatureUnit:\n",
|
|||
|
" type: string\n",
|
|||
|
" windSpeed:\n",
|
|||
|
" type: string\n",
|
|||
|
" windDirection:\n",
|
|||
|
" type: string\n",
|
|||
|
" icon:\n",
|
|||
|
" type: string\n",
|
|||
|
" format: uri\n",
|
|||
|
" shortForecast:\n",
|
|||
|
" type: string\n",
|
|||
|
" detailedForecast:\n",
|
|||
|
" type: string"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"### FAQ & Troubleshooting"
|
|||
|
]
|
|||
|
},
|
|||
|
{
|
|||
|
"cell_type": "markdown",
|
|||
|
"metadata": {},
|
|||
|
"source": [
|
|||
|
"*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"
|
|||
|
]
|
|||
|
}
|
|||
|
],
|
|||
|
"metadata": {
|
|||
|
"language_info": {
|
|||
|
"name": "python"
|
|||
|
}
|
|||
|
},
|
|||
|
"nbformat": 4,
|
|||
|
"nbformat_minor": 2
|
|||
|
}
|