|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "id": "98d5cd09-dfe4-4bbe-b1ba-344a535fa763", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [], |
| 9 | + "source": [ |
| 10 | + "pip install gptscript" |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "code", |
| 15 | + "execution_count": null, |
| 16 | + "id": "144cb0f4-7936-4701-9246-e948c09f94c5", |
| 17 | + "metadata": {}, |
| 18 | + "outputs": [], |
| 19 | + "source": [ |
| 20 | + "from gptscript.command import stream_exec\n", |
| 21 | + "from gptscript.tool import Tool\n", |
| 22 | + "\n", |
| 23 | + "t = Tool(tools=[\"github.com/gptscript-ai/json-query\",\"sys.download\",\"sys.read\"],\n", |
| 24 | + " instructions=\"\"\"\n", |
| 25 | + "download the contents from this url https://data.transportation.gov/api/views/anj8-k6f5/rows.json?accessType=DOWNLOAD and save to file ai-usecases.json\n", |
| 26 | + "Wait until the file is downloaded before proceeding.\n", |
| 27 | + "Using the downloaded file, determine which agencies have AI initiatives and list a summary of each.\n", |
| 28 | + "\"\"\",\n", |
| 29 | + " )\n", |
| 30 | + "\n", |
| 31 | + "results, err, wait = stream_exec(t)\n", |
| 32 | + "for line in err:\n", |
| 33 | + " print(line)\n", |
| 34 | + "print(results.read())" |
| 35 | + ] |
| 36 | + } |
| 37 | + ], |
| 38 | + "metadata": { |
| 39 | + "kernelspec": { |
| 40 | + "display_name": "venv", |
| 41 | + "language": "python", |
| 42 | + "name": "venv" |
| 43 | + }, |
| 44 | + "language_info": { |
| 45 | + "codemirror_mode": { |
| 46 | + "name": "ipython", |
| 47 | + "version": 3 |
| 48 | + }, |
| 49 | + "file_extension": ".py", |
| 50 | + "mimetype": "text/x-python", |
| 51 | + "name": "python", |
| 52 | + "nbconvert_exporter": "python", |
| 53 | + "pygments_lexer": "ipython3", |
| 54 | + "version": "3.12.2" |
| 55 | + } |
| 56 | + }, |
| 57 | + "nbformat": 4, |
| 58 | + "nbformat_minor": 5 |
| 59 | +} |
0 commit comments