├── images
├── l1_1.png
├── l1_2.png
├── l1_3.png
├── l4.png
├── l5_1.png
└── l5_2.png
├── README.md
├── .gitignore
├── Lesson_3_Student.ipynb
├── Lesson_4_Student.ipynb
├── Lesson_6_Student.ipynb
├── Lesson_5_Student.ipynb
└── Lesson_2_Student.ipynb
/images/l1_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l1_1.png
--------------------------------------------------------------------------------
/images/l1_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l1_2.png
--------------------------------------------------------------------------------
/images/l1_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l1_3.png
--------------------------------------------------------------------------------
/images/l4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l4.png
--------------------------------------------------------------------------------
/images/l5_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l5_1.png
--------------------------------------------------------------------------------
/images/l5_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksm26/Function-Calling-and-Data-Extraction-with-LLMs/HEAD/images/l5_2.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 📊 [Function-calling and Data Extraction with LLMs](https://www.deeplearning.ai/short-courses/function-calling-and-data-extraction-with-llms/)
2 |
3 | 💡 Welcome to the "Function-calling and Data Extraction with LLMs" course! The course will equip you with the critical skills for building advanced applications with LLMs.
4 |
5 | ## Course Summary
6 | In this course, you'll dive into the essentials of function-calling and structured data extraction with LLMs, focusing on practical applications and advanced workflows. Here's what you can expect to learn and experience:
7 |
8 | 1. 🛠️ **Function-calling**: Learn to extend LLMs with custom capabilities by enabling them to call external functions based on natural language instructions, using NexusRavenV2-13B, an open-source model fine-tuned for function-calling and data extraction.
9 |
10 |
11 |
12 |
13 | 2. 🔄 **Complex Workflows**: Work with multiple function calls, including parallel and nested calls, to create complex agent workflows where an LLM plans and executes a series of functions to achieve a goal.
14 | 3. 🌐 **Web Services Integration**: Use OpenAPI specifications to build function calls that can access web services, enhancing the functionality and reach of your applications.
15 | 4. 🗂️ **Structured Data Extraction**: Extract structured data from natural language inputs, enabling real-world data usability for analysis and application.
16 |
17 |
18 |
19 |
20 | 5. 💾 **End-to-End Application**: Build an application that processes customer service transcripts, generates SQL calls, and stores results in a database, demonstrating the practical implementation of the skills learned.
21 |
22 |
23 |
24 |
25 |
26 | ## Key Points
27 | - 🔌 **Extend LLM Functionality**: Learn to extend LLMs with custom functionality via function-calling, enabling them to perform external function calls.
28 | - 📊 **Data Usability**: Extract structured data from natural language inputs, making real-world data usable for analysis.
29 | - 🛠️ **Practical Implementation**: Build an end-to-end application that processes customer service transcripts using LLMs.
30 |
31 | ## About the Instructors
32 | 🌟 **Jiantao Jiao** is the Co-founder & CEO of Nexusflow and an Assistant Professor of EECS and Statistics at UC Berkeley, bringing extensive expertise in function-calling and data extraction.
33 |
34 | 🌟 **Venkat Srinivasan** is a Founding Engineer at Nexusflow, specializing in the development of advanced LLM applications.
35 |
36 | 🔗 To enroll in the course or for further information, visit [deeplearning.ai](https://www.deeplearning.ai/short-courses/).
37 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | htmlcov/
41 | .tox/
42 | .nox/
43 | .coverage
44 | .coverage.*
45 | .cache
46 | nosetests.xml
47 | coverage.xml
48 | *.cover
49 | *.py,cover
50 | .hypothesis/
51 | .pytest_cache/
52 | cover/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | .pybuilder/
76 | target/
77 |
78 | # Jupyter Notebook
79 | .ipynb_checkpoints
80 |
81 | # IPython
82 | profile_default/
83 | ipython_config.py
84 |
85 | # pyenv
86 | # For a library or package, you might want to ignore these files since the code is
87 | # intended to run in multiple environments; otherwise, check them in:
88 | # .python-version
89 |
90 | # pipenv
91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
94 | # install all needed dependencies.
95 | #Pipfile.lock
96 |
97 | # poetry
98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99 | # This is especially recommended for binary packages to ensure reproducibility, and is more
100 | # commonly ignored for libraries.
101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102 | #poetry.lock
103 |
104 | # pdm
105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106 | #pdm.lock
107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108 | # in version control.
109 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110 | .pdm.toml
111 | .pdm-python
112 | .pdm-build/
113 |
114 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115 | __pypackages__/
116 |
117 | # Celery stuff
118 | celerybeat-schedule
119 | celerybeat.pid
120 |
121 | # SageMath parsed files
122 | *.sage.py
123 |
124 | # Environments
125 | .env
126 | .venv
127 | env/
128 | venv/
129 | ENV/
130 | env.bak/
131 | venv.bak/
132 |
133 | # Spyder project settings
134 | .spyderproject
135 | .spyproject
136 |
137 | # Rope project settings
138 | .ropeproject
139 |
140 | # mkdocs documentation
141 | /site
142 |
143 | # mypy
144 | .mypy_cache/
145 | .dmypy.json
146 | dmypy.json
147 |
148 | # Pyre type checker
149 | .pyre/
150 |
151 | # pytype static type analyzer
152 | .pytype/
153 |
154 | # Cython debug symbols
155 | cython_debug/
156 |
157 | # PyCharm
158 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160 | # and can be added to the global gitignore or merged into this file. For a more nuclear
161 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162 | #.idea/
163 |
--------------------------------------------------------------------------------
/Lesson_3_Student.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "3625677b-2e3b-4069-ac6b-ce6efbc7e70c",
6 | "metadata": {},
7 | "source": [
8 | "### How Do We Interface With External Resources?"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 1,
14 | "id": "c88048a6-f52c-4571-bf11-583aa2c30634",
15 | "metadata": {
16 | "height": 149
17 | },
18 | "outputs": [
19 | {
20 | "name": "stdout",
21 | "output_type": "stream",
22 | "text": [
23 | "Why did the database administrator leave his wife?\n",
24 | "She had one-to-many relationships.\n"
25 | ]
26 | }
27 | ],
28 | "source": [
29 | "import requests\n",
30 | "\n",
31 | "url = \"https://v2.jokeapi.dev/joke/Any?safe-mode&type=twopart\"\n",
32 | "\n",
33 | "response = requests.get(url)\n",
34 | "\n",
35 | "print(response.json()[\"setup\"])\n",
36 | "print(response.json()[\"delivery\"])"
37 | ]
38 | },
39 | {
40 | "cell_type": "code",
41 | "execution_count": 2,
42 | "id": "4337dfaa-ed8b-4e8a-a1ae-2a117593a70e",
43 | "metadata": {
44 | "height": 30
45 | },
46 | "outputs": [
47 | {
48 | "data": {
49 | "text/plain": [
50 | "{'error': False,\n",
51 | " 'category': 'Programming',\n",
52 | " 'type': 'twopart',\n",
53 | " 'setup': 'Why did the database administrator leave his wife?',\n",
54 | " 'delivery': 'She had one-to-many relationships.',\n",
55 | " 'flags': {'nsfw': False,\n",
56 | " 'religious': False,\n",
57 | " 'political': False,\n",
58 | " 'racist': False,\n",
59 | " 'sexist': False,\n",
60 | " 'explicit': False},\n",
61 | " 'safe': True,\n",
62 | " 'id': 265,\n",
63 | " 'lang': 'en'}"
64 | ]
65 | },
66 | "execution_count": 2,
67 | "metadata": {},
68 | "output_type": "execute_result"
69 | }
70 | ],
71 | "source": [
72 | "response.json()"
73 | ]
74 | },
75 | {
76 | "cell_type": "code",
77 | "execution_count": 3,
78 | "id": "11576230-09a6-471f-ae03-7dfd53f81a24",
79 | "metadata": {
80 | "height": 183
81 | },
82 | "outputs": [],
83 | "source": [
84 | "import requests\n",
85 | "def give_joke(category : str):\n",
86 | " \"\"\"\n",
87 | " Joke categories. Supports: Any, Misc, Programming, Pun, Spooky, Christmas.\n",
88 | " \"\"\"\n",
89 | "\n",
90 | " url = f\"https://v2.jokeapi.dev/joke/{category}?safe-mode&type=twopart\"\n",
91 | " response = requests.get(url)\n",
92 | " print(response.json()[\"setup\"])\n",
93 | " print(response.json()[\"delivery\"])"
94 | ]
95 | },
96 | {
97 | "cell_type": "code",
98 | "execution_count": 4,
99 | "id": "dc480ae7-2f6e-4796-a4ca-f5d304081797",
100 | "metadata": {
101 | "height": 30
102 | },
103 | "outputs": [],
104 | "source": [
105 | "USER_QUERY = \"Hey! Can you get me a joke for this december?\""
106 | ]
107 | },
108 | {
109 | "cell_type": "code",
110 | "execution_count": 5,
111 | "id": "789b8c6d-7baa-419a-ae28-1538d7e9ccab",
112 | "metadata": {
113 | "height": 217
114 | },
115 | "outputs": [],
116 | "source": [
117 | "from utils import query_raven\n",
118 | "\n",
119 | "raven_functions = \\\n",
120 | "f'''\n",
121 | "def give_joke(category : str):\n",
122 | " \"\"\"\n",
123 | " Joke categories. Supports: Any, Misc, Programming, Dark, Pun, Spooky, Christmas.\n",
124 | " \"\"\"\n",
125 | "\n",
126 | "User Query: {USER_QUERY}\n",
127 | "'''\n",
128 | "call = query_raven(raven_functions)"
129 | ]
130 | },
131 | {
132 | "cell_type": "code",
133 | "execution_count": 6,
134 | "id": "650051c1-148f-4b5a-95e4-b3b6dbaad4c4",
135 | "metadata": {
136 | "height": 30
137 | },
138 | "outputs": [
139 | {
140 | "name": "stdout",
141 | "output_type": "stream",
142 | "text": [
143 | "What says Oh Oh Oh?\n",
144 | "Santa walking backwards!\n"
145 | ]
146 | }
147 | ],
148 | "source": [
149 | "exec(call)"
150 | ]
151 | },
152 | {
153 | "cell_type": "markdown",
154 | "id": "170eedef-330d-4466-93b5-aaf53e09f9d1",
155 | "metadata": {},
156 | "source": [
157 | "#### Writing A Tool That Uses OpenAPI APIs"
158 | ]
159 | },
160 | {
161 | "cell_type": "code",
162 | "execution_count": 7,
163 | "id": "de0ffc0b-84a9-4622-ac37-976d7c1cdacc",
164 | "metadata": {
165 | "height": 30
166 | },
167 | "outputs": [],
168 | "source": [
169 | "#!wget https://raw.githubusercontent.com/open-meteo/open-meteo/main/openapi.yml"
170 | ]
171 | },
172 | {
173 | "cell_type": "code",
174 | "execution_count": 8,
175 | "id": "c9105806-39ca-49c4-a930-993db2b3a820",
176 | "metadata": {
177 | "height": 251
178 | },
179 | "outputs": [],
180 | "source": [
181 | "import yaml\n",
182 | "import json\n",
183 | "\n",
184 | "# Read the content of the file\n",
185 | "with open('openapi.yml', 'r') as file:\n",
186 | " file_content = file.read()\n",
187 | "file_content = file_content.replace(\"int\\n\", \"number\\n\")\n",
188 | "file_content = file_content.replace(\"float\\n\", \"number\\n\")\n",
189 | "data = yaml.safe_load(file_content)\n",
190 | "\n",
191 | "data[\"servers\"] = [{\"url\":\"https://api.open-meteo.com\"}]\n",
192 | "\n",
193 | "with open('openapi.json', 'w') as file:\n",
194 | " json_content = json.dump(data, file)"
195 | ]
196 | },
197 | {
198 | "cell_type": "code",
199 | "execution_count": 9,
200 | "id": "1003872b-ed4c-4ce5-ba19-dbaad3d9d5df",
201 | "metadata": {
202 | "height": 30
203 | },
204 | "outputs": [
205 | {
206 | "name": "stdout",
207 | "output_type": "stream",
208 | "text": [
209 | "Generating data from openapi.json\r\n"
210 | ]
211 | }
212 | ],
213 | "source": [
214 | "!openapi-python-generator openapi.json ./api_specification_main/"
215 | ]
216 | },
217 | {
218 | "cell_type": "code",
219 | "execution_count": 10,
220 | "id": "df4400f9-803b-44ff-9e2b-738bf88e882f",
221 | "metadata": {
222 | "height": 47
223 | },
224 | "outputs": [],
225 | "source": [
226 | "from api_specification_main.services.WeatherForecastAPIs_service\\\n",
227 | " import get_v1forecast"
228 | ]
229 | },
230 | {
231 | "cell_type": "code",
232 | "execution_count": 11,
233 | "id": "b0dea523-1b71-4642-a526-e4e88f416920",
234 | "metadata": {
235 | "height": 30
236 | },
237 | "outputs": [],
238 | "source": [
239 | "user_query = \"Hey how is the current weather and windspeed in New York?\""
240 | ]
241 | },
242 | {
243 | "cell_type": "code",
244 | "execution_count": 12,
245 | "id": "10fa052c-9d92-4d23-b907-5971c704f7c1",
246 | "metadata": {
247 | "height": 319
248 | },
249 | "outputs": [
250 | {
251 | "name": "stdout",
252 | "output_type": "stream",
253 | "text": [
254 | "\n",
255 | "Function:\n",
256 | "get_v1forecast(latitude: float, longitude: float, hourly: Optional[List[str]] = None, daily: Optional[List[str]] = None, current_weather: Optional[bool] = None, temperature_unit: Optional[str] = None, wind_speed_unit: Optional[str] = None, timeformat: Optional[str] = None, timezone: Optional[str] = None, past_days: Optional[int] = None, api_config_override: Optional[api_specification_main.api_config.APIConfig] = None) -> Dict[str, Any]\n",
257 | "\"\"\"\n",
258 | "Requires the latitude and longitude.\n",
259 | "Set current_weather to True to get the weather.\n",
260 | "Set hourly or daily based on preference.\n",
261 | "\"\"\"\n",
262 | "\n",
263 | "User Query: Hey how is the current weather and windspeed in New York?\n"
264 | ]
265 | }
266 | ],
267 | "source": [
268 | "import inspect\n",
269 | "signature = inspect.signature(get_v1forecast)\n",
270 | "docstring = \\\n",
271 | "'''\n",
272 | "Requires the latitude and longitude.\n",
273 | "Set current_weather to True to get the weather.\n",
274 | "Set hourly or daily based on preference.\n",
275 | "'''\n",
276 | "\n",
277 | "raven_prompt = \\\n",
278 | "f'''\n",
279 | "Function:\n",
280 | "{get_v1forecast.__name__}{signature}\n",
281 | "\"\"\"{docstring}\"\"\"\n",
282 | "\n",
283 | "User Query: {user_query}'''\n",
284 | "\n",
285 | "print (raven_prompt)"
286 | ]
287 | },
288 | {
289 | "cell_type": "code",
290 | "execution_count": 13,
291 | "id": "d75de144-c242-4aac-ab1f-20ec4d635aa4",
292 | "metadata": {
293 | "height": 64
294 | },
295 | "outputs": [
296 | {
297 | "name": "stdout",
298 | "output_type": "stream",
299 | "text": [
300 | "get_v1forecast(latitude=40.7128, longitude=-74.0060, current_weather=True)\n"
301 | ]
302 | }
303 | ],
304 | "source": [
305 | "from utils import query_raven\n",
306 | "call = query_raven(raven_prompt)\n",
307 | "print (call)"
308 | ]
309 | },
310 | {
311 | "cell_type": "code",
312 | "execution_count": 14,
313 | "id": "bc42f650-182a-4e4c-8fc4-ac5ef291e9ea",
314 | "metadata": {
315 | "height": 30
316 | },
317 | "outputs": [
318 | {
319 | "data": {
320 | "text/plain": [
321 | "{'latitude': 40.710335,\n",
322 | " 'longitude': -73.99307,\n",
323 | " 'generationtime_ms': 0.08893013000488281,\n",
324 | " 'utc_offset_seconds': 0,\n",
325 | " 'timezone': 'GMT',\n",
326 | " 'timezone_abbreviation': 'GMT',\n",
327 | " 'elevation': 32.0,\n",
328 | " 'current_weather_units': {'time': 'iso8601',\n",
329 | " 'interval': 'seconds',\n",
330 | " 'temperature': '°C',\n",
331 | " 'windspeed': 'km/h',\n",
332 | " 'winddirection': '°',\n",
333 | " 'is_day': '',\n",
334 | " 'weathercode': 'wmo code'},\n",
335 | " 'current_weather': {'time': '2024-06-25T16:15',\n",
336 | " 'interval': 900,\n",
337 | " 'temperature': 31.7,\n",
338 | " 'windspeed': 15.7,\n",
339 | " 'winddirection': 281,\n",
340 | " 'is_day': 1,\n",
341 | " 'weathercode': 0}}"
342 | ]
343 | },
344 | "execution_count": 14,
345 | "metadata": {},
346 | "output_type": "execute_result"
347 | }
348 | ],
349 | "source": [
350 | "eval(call)"
351 | ]
352 | },
353 | {
354 | "cell_type": "code",
355 | "execution_count": null,
356 | "id": "93317b06-c6dc-4214-8c94-b04536b02b4d",
357 | "metadata": {
358 | "height": 30
359 | },
360 | "outputs": [],
361 | "source": []
362 | }
363 | ],
364 | "metadata": {
365 | "kernelspec": {
366 | "display_name": "Python 3 (ipykernel)",
367 | "language": "python",
368 | "name": "python3"
369 | },
370 | "language_info": {
371 | "codemirror_mode": {
372 | "name": "ipython",
373 | "version": 3
374 | },
375 | "file_extension": ".py",
376 | "mimetype": "text/x-python",
377 | "name": "python",
378 | "nbconvert_exporter": "python",
379 | "pygments_lexer": "ipython3",
380 | "version": "3.11.9"
381 | }
382 | },
383 | "nbformat": 4,
384 | "nbformat_minor": 5
385 | }
386 |
--------------------------------------------------------------------------------
/Lesson_4_Student.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "835af266-a7a4-4283-9557-5e06681b3b28",
6 | "metadata": {
7 | "id": "X2DqArfaJZvx"
8 | },
9 | "source": [
10 | "# Using Function Calling For Structure"
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "id": "cc2ecabf-cd7b-44bf-ae4f-26d75e8dd037",
16 | "metadata": {
17 | "id": "-wEri7mHQ7d8"
18 | },
19 | "source": [
20 | "## Simple Example Of Address Extraction"
21 | ]
22 | },
23 | {
24 | "cell_type": "code",
25 | "execution_count": 1,
26 | "id": "344e22ed-9b97-4571-a77f-00dcbbb4189c",
27 | "metadata": {
28 | "colab": {
29 | "base_uri": "https://localhost:8080/"
30 | },
31 | "height": 98,
32 | "id": "OEXEffrCGgft",
33 | "outputId": "42cf9fed-9d21-4467-d8fa-aa58dcdf055e"
34 | },
35 | "outputs": [
36 | {
37 | "name": "stdout",
38 | "output_type": "stream",
39 | "text": [
40 | "\n",
41 | "John Doe lives at 123 Elm Street, Springfield. Next to him is Jane Smith, residing at 456 Oak Avenue, Lakeview. Not far away, we find Dr. Emily Ryan at 789 Pine Road, Westwood. Meanwhile, in a different part of town, Mr. Alan Turing can be found at 101 Binary Blvd, Computerville. Nearby, Ms. Olivia Newton stays at 202 Music Lane, Harmony. Also, Prof. Charles Xavier is located at 505 Mutant Circle, X-Town.\n",
42 | "\n"
43 | ]
44 | }
45 | ],
46 | "source": [
47 | "text = \\\n",
48 | "\"\"\"\n",
49 | "John Doe lives at 123 Elm Street, Springfield. Next to him is Jane Smith, residing at 456 Oak Avenue, Lakeview. Not far away, we find Dr. Emily Ryan at 789 Pine Road, Westwood. Meanwhile, in a different part of town, Mr. Alan Turing can be found at 101 Binary Blvd, Computerville. Nearby, Ms. Olivia Newton stays at 202 Music Lane, Harmony. Also, Prof. Charles Xavier is located at 505 Mutant Circle, X-Town.\n",
50 | "\"\"\"\n",
51 | "print (text)"
52 | ]
53 | },
54 | {
55 | "cell_type": "code",
56 | "execution_count": 2,
57 | "id": "e58220bb-b863-4a09-8b4b-4f790ee87206",
58 | "metadata": {
59 | "height": 183,
60 | "id": "q7ARknmXL5uw"
61 | },
62 | "outputs": [],
63 | "source": [
64 | "raven_prompt = \\\n",
65 | "f'''\n",
66 | "Function:\n",
67 | "def address_name_pairs(names : list[str], addresses : list[str]):\n",
68 | "\"\"\"\n",
69 | "Give names and associated addresses.\n",
70 | "\"\"\"\n",
71 | "\n",
72 | "{text}\n",
73 | "'''"
74 | ]
75 | },
76 | {
77 | "cell_type": "code",
78 | "execution_count": 3,
79 | "id": "839d2743-0074-42e7-a792-62f6a396fdec",
80 | "metadata": {
81 | "colab": {
82 | "base_uri": "https://localhost:8080/"
83 | },
84 | "height": 200,
85 | "id": "7G55J8G2MLA5",
86 | "outputId": "a36f5487-1714-4974-a0ec-e71e83f39e0f"
87 | },
88 | "outputs": [
89 | {
90 | "name": "stdout",
91 | "output_type": "stream",
92 | "text": [
93 | "John Doe : 123 Elm Street, Springfield\n",
94 | "Jane Smith : 456 Oak Avenue, Lakeview\n",
95 | "Dr. Emily Ryan : 789 Pine Road, Westwood\n",
96 | "Mr. Alan Turing : 101 Binary Blvd, Computerville\n",
97 | "Ms. Olivia Newton : 202 Music Lane, Harmony\n",
98 | "Prof. Charles Xavier : 505 Mutant Circle, X-Town\n"
99 | ]
100 | }
101 | ],
102 | "source": [
103 | "from utils import query_raven\n",
104 | "\n",
105 | "def address_name_pairs(names : list[str], addresses : list[str]):\n",
106 | " \"\"\"\n",
107 | " Give names and associated addresses.\n",
108 | " \"\"\"\n",
109 | " for name, addr in zip(names, addresses):\n",
110 | " print (name, \": \", addr)\n",
111 | "\n",
112 | "result = query_raven(raven_prompt)\n",
113 | "eval(result)"
114 | ]
115 | },
116 | {
117 | "cell_type": "markdown",
118 | "id": "8d38143b-ba80-4b65-9b55-ed65f4fb8d48",
119 | "metadata": {},
120 | "source": [
121 | "## Alternative Way of Doing Extraction"
122 | ]
123 | },
124 | {
125 | "cell_type": "code",
126 | "execution_count": 4,
127 | "id": "f53d2535-7d34-4ef5-ad70-69a324a888ca",
128 | "metadata": {
129 | "height": 98
130 | },
131 | "outputs": [
132 | {
133 | "name": "stdout",
134 | "output_type": "stream",
135 | "text": [
136 | "\n",
137 | "Dr. Susan Hill has a practice at 120 Green Road, Evergreen City, and also consults at 450 Riverdale Drive, Brookside. Mark Twain, the renowned author, once lived at 300 Maple Street, Springfield, but now resides at 200 Writers Block, Literaryville. The famous artist, Emily Carter, showcases her work at 789 Artisan Alley, Paintown, and has a studio at 101 Palette Place, Creativeland. Meanwhile, the tech innovator, John Tech, has his main office at 555 Silicon Street, Techville, and a secondary office at 777 Data Drive, Computown, but he lives at 123 Digital Domain, Innovatown.\n",
138 | "\n"
139 | ]
140 | }
141 | ],
142 | "source": [
143 | "unbalanced_text = \\\n",
144 | "\"\"\"\n",
145 | "Dr. Susan Hill has a practice at 120 Green Road, Evergreen City, and also consults at 450 Riverdale Drive, Brookside. Mark Twain, the renowned author, once lived at 300 Maple Street, Springfield, but now resides at 200 Writers Block, Literaryville. The famous artist, Emily Carter, showcases her work at 789 Artisan Alley, Paintown, and has a studio at 101 Palette Place, Creativeland. Meanwhile, the tech innovator, John Tech, has his main office at 555 Silicon Street, Techville, and a secondary office at 777 Data Drive, Computown, but he lives at 123 Digital Domain, Innovatown.\n",
146 | "\"\"\"\n",
147 | "print (unbalanced_text)"
148 | ]
149 | },
150 | {
151 | "cell_type": "code",
152 | "execution_count": 5,
153 | "id": "4adef284-c7f2-400f-8bc0-0a4ab3fab238",
154 | "metadata": {
155 | "height": 370,
156 | "tags": []
157 | },
158 | "outputs": [
159 | {
160 | "name": "stdout",
161 | "output_type": "stream",
162 | "text": [
163 | "insert_into_database(names=[Record(name='Dr. Susan Hill', addresses=['120 Green Road', '450 Riverdale Drive']), Record(name='Mark Twain', addresses=['300 Maple Street', '200 Writers Block']), Record(name='Emily Carter', addresses=['789 Artisan Alley', '101 Palette Place']), Record(name='John Tech', addresses=['555 Silicon Street', '777 Data Drive', '123 Digital Domain'])])\n"
164 | ]
165 | }
166 | ],
167 | "source": [
168 | "raven_prompt = \\\n",
169 | "f'''\n",
170 | "\n",
171 | "@dataclass\n",
172 | "class Record:\n",
173 | " name : str\n",
174 | " addresses : List[str]\n",
175 | "\n",
176 | "Function:\n",
177 | "def insert_into_database(names : List[Record]):\n",
178 | "\"\"\"\n",
179 | "Inserts the records into the database. \n",
180 | "\"\"\"\n",
181 | "\n",
182 | "{unbalanced_text}\n",
183 | "\n",
184 | "'''\n",
185 | "\n",
186 | "result = query_raven(raven_prompt)\n",
187 | "print (result)\n"
188 | ]
189 | },
190 | {
191 | "cell_type": "markdown",
192 | "id": "3ca74ee7-d1e1-4ad1-80ff-2625be14246c",
193 | "metadata": {
194 | "id": "77-vmPaFakXb"
195 | },
196 | "source": [
197 | "## Generating Valid JSONs"
198 | ]
199 | },
200 | {
201 | "cell_type": "markdown",
202 | "id": "7234d7a6-356d-4468-a4a7-86ddfe89dfb0",
203 | "metadata": {},
204 | "source": [
205 | "```\n",
206 | "{\n",
207 | " \"city_name\" : \"London\"\n",
208 | " \"location\" : {\n",
209 | " \"country\" : \"United Kingdom\",\n",
210 | " \"continent\" : {\n",
211 | " \"simple_name\" : \"Europe\",\n",
212 | " \"other_name\" : \"Afro-Eur-Asia\"\n",
213 | " }\n",
214 | " }\n",
215 | "}\n",
216 | "```\n"
217 | ]
218 | },
219 | {
220 | "cell_type": "code",
221 | "execution_count": 6,
222 | "id": "edd8ceb8-7b12-4240-ac4b-c5449618639f",
223 | "metadata": {
224 | "height": 268
225 | },
226 | "outputs": [],
227 | "source": [
228 | "def city_info(city_name : str, location : dict):\n",
229 | " \"\"\"\n",
230 | " Gets the city info\n",
231 | " \"\"\"\n",
232 | " return locals()\n",
233 | "def construct_location_dict(country : str, continent : dict):\n",
234 | " \"\"\"\n",
235 | " Provides the location dictionary\n",
236 | " \"\"\"\n",
237 | " return locals()\n",
238 | "def construct_continent_dict(simple_name : str, other_name : str):\n",
239 | " \"\"\"\n",
240 | " Provides the continent dict\n",
241 | " \"\"\"\n",
242 | " return locals()"
243 | ]
244 | },
245 | {
246 | "cell_type": "code",
247 | "execution_count": 7,
248 | "id": "31f84b28-32ad-4db1-a9dd-b6de6c3b731c",
249 | "metadata": {
250 | "height": 30
251 | },
252 | "outputs": [
253 | {
254 | "name": "stdout",
255 | "output_type": "stream",
256 | "text": [
257 | "{'city_name': 'London', 'location': {}}\n"
258 | ]
259 | }
260 | ],
261 | "source": [
262 | "print (city_info(\"London\", {}))"
263 | ]
264 | },
265 | {
266 | "cell_type": "code",
267 | "execution_count": 8,
268 | "id": "6a9c33ac-045a-43ac-8e1a-68f4a2b4d514",
269 | "metadata": {
270 | "height": 370,
271 | "id": "z09ke72Mao82"
272 | },
273 | "outputs": [],
274 | "source": [
275 | "raven_prompt = \\\n",
276 | "'''\n",
277 | "Function:\n",
278 | "def city_info(city_name : str, location : dict):\n",
279 | "\"\"\"\n",
280 | "Gets the city info\n",
281 | "\"\"\"\n",
282 | "\n",
283 | "Function:\n",
284 | "def construct_location_dict(country : str, continent : dict):\n",
285 | "\"\"\"\n",
286 | "Provides the location dictionary\n",
287 | "\"\"\"\n",
288 | "\n",
289 | "def construct_continent_dict(simple_name : str, other_name : str):\n",
290 | "\"\"\"\n",
291 | "Provides the continent dict\n",
292 | "\"\"\"\n",
293 | "\n",
294 | "User Query: {question}\n",
295 | "'''"
296 | ]
297 | },
298 | {
299 | "cell_type": "code",
300 | "execution_count": 9,
301 | "id": "10c9c60b-19b0-4dbb-8a9c-2dc92c5aad05",
302 | "metadata": {
303 | "colab": {
304 | "base_uri": "https://localhost:8080/"
305 | },
306 | "height": 115,
307 | "id": "bM-xNHKDam9V",
308 | "outputId": "962eea9e-c029-46cf-a945-f84dc8b411d8"
309 | },
310 | "outputs": [
311 | {
312 | "name": "stdout",
313 | "output_type": "stream",
314 | "text": [
315 | "{'city_name': 'London', 'location': {'country': 'United Kingdom', 'continent': {'simple_name': 'Europe', 'other_name': 'Afro-Eur-Asia'}}}\n"
316 | ]
317 | }
318 | ],
319 | "source": [
320 | "question = \"I want the city info for London, \"\\\n",
321 | "\"which is in the United Kingdom, which is in Europe or Afro-Eur-Asia.\"\n",
322 | "\n",
323 | "output = query_raven(raven_prompt.format(question = question))\n",
324 | "json0 = eval(output)\n",
325 | "print (json0)"
326 | ]
327 | },
328 | {
329 | "cell_type": "code",
330 | "execution_count": 10,
331 | "id": "9238acd7-388b-4f8c-aed9-f86cbf7f73c4",
332 | "metadata": {
333 | "height": 47
334 | },
335 | "outputs": [
336 | {
337 | "data": {
338 | "text/plain": [
339 | "'{\"city_name\": \"London\", \"location\": {\"country\": \"United Kingdom\", \"continent\": {\"simple_name\": \"Europe\", \"other_name\": \"Afro-Eur-Asia\"}}}'"
340 | ]
341 | },
342 | "execution_count": 10,
343 | "metadata": {},
344 | "output_type": "execute_result"
345 | }
346 | ],
347 | "source": [
348 | "import json\n",
349 | "json.dumps(json0)"
350 | ]
351 | },
352 | {
353 | "cell_type": "markdown",
354 | "id": "5dd2bf6a-b6cc-44e6-a20e-6f569e8d7577",
355 | "metadata": {},
356 | "source": [
357 | "### Try These yourself!"
358 | ]
359 | },
360 | {
361 | "cell_type": "code",
362 | "execution_count": 11,
363 | "id": "09c43a37-6bf3-453b-b263-e53ab2d6856a",
364 | "metadata": {
365 | "colab": {
366 | "base_uri": "https://localhost:8080/"
367 | },
368 | "height": 132,
369 | "id": "Wh7kacTdd_Nb",
370 | "outputId": "b3475d87-7efa-4e69-e7dd-ddd821fc40a8"
371 | },
372 | "outputs": [
373 | {
374 | "name": "stdout",
375 | "output_type": "stream",
376 | "text": [
377 | "{'city_name': 'Tokyo', 'location': {'country': 'Japan', 'continent': {'simple_name': 'Asian', 'other_name': 'Eurasia'}}}\n"
378 | ]
379 | }
380 | ],
381 | "source": [
382 | "question = \"I need details for the city of Tokyo, \"\\\n",
383 | "\"situated in Japan, a part of the Asian continent, \"\\\n",
384 | "\"which is sometimes referred to as Eurasia.\"\n",
385 | "\n",
386 | "output = query_raven(raven_prompt.format(question = question))\n",
387 | "json1 = eval(output)\n",
388 | "print (json1)"
389 | ]
390 | },
391 | {
392 | "cell_type": "code",
393 | "execution_count": 12,
394 | "id": "2901c617-9688-45e1-b6ae-06c6a8ac01af",
395 | "metadata": {
396 | "height": 47
397 | },
398 | "outputs": [
399 | {
400 | "data": {
401 | "text/plain": [
402 | "'{\"city_name\": \"London\", \"location\": {\"country\": \"United Kingdom\", \"continent\": {\"simple_name\": \"Europe\", \"other_name\": \"Afro-Eur-Asia\"}}}'"
403 | ]
404 | },
405 | "execution_count": 12,
406 | "metadata": {},
407 | "output_type": "execute_result"
408 | }
409 | ],
410 | "source": [
411 | "import json\n",
412 | "json.dumps(json0)"
413 | ]
414 | },
415 | {
416 | "cell_type": "code",
417 | "execution_count": null,
418 | "id": "69903cb2-b003-4c51-84b9-a5bf70a911b2",
419 | "metadata": {
420 | "height": 30
421 | },
422 | "outputs": [],
423 | "source": []
424 | }
425 | ],
426 | "metadata": {
427 | "kernelspec": {
428 | "display_name": "Python 3 (ipykernel)",
429 | "language": "python",
430 | "name": "python3"
431 | },
432 | "language_info": {
433 | "codemirror_mode": {
434 | "name": "ipython",
435 | "version": 3
436 | },
437 | "file_extension": ".py",
438 | "mimetype": "text/x-python",
439 | "name": "python",
440 | "nbconvert_exporter": "python",
441 | "pygments_lexer": "ipython3",
442 | "version": "3.11.9"
443 | }
444 | },
445 | "nbformat": 4,
446 | "nbformat_minor": 5
447 | }
448 |
--------------------------------------------------------------------------------
/Lesson_6_Student.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "0e851ea7-0d08-40a5-9ab1-a2a58cb7fd2a",
6 | "metadata": {},
7 | "source": [
8 | "# Building A Dialogue Feature Extraction Pipeline Using Function Calling!"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 1,
14 | "id": "857b84af-3ca3-49fd-a525-7083a465fcd8",
15 | "metadata": {
16 | "height": 47
17 | },
18 | "outputs": [],
19 | "source": [
20 | "sample_data = \\\n",
21 | "\"\"\"Agent: Thank you for calling BrownBox Customer Support. My name is Tom. How may I assist you today?\\nCustomer: Hi Tom, I'm trying to log in to my account to purchase an Oven Toaster Grill (OTG), but I'm unable to proceed as it's asking for mobile number or email verification. Can you help me with that?\\nAgent: Sure, I can assist you with that. May I know your registered mobile number or email address, please?\\nCustomer: My registered mobile number is +1 123-456-7890.\\nAgent: Thank you. Let me check that for you. I'm sorry to inform you that we don't have this number on our records. Can you please confirm if this is the correct number?\\nCustomer: Oh, I'm sorry. I might have registered with a different number. Can you please check with my email address instead? It's johndoe@email.com.\\nAgent: Sure, let me check that for you. (After a few moments) I see that we have your email address on our records. We'll be sending you a verification code shortly. Please check your email and let me know once you receive it. Customer: Okay, I received the code. What do I do with it?\\nAgent: Please enter the verification code in the field provided and click on 'Verify'. Once your email address is verified, you'll be able to proceed with your purchase.\\nCustomer: Okay, I entered the code, and it's verified now. Thank you for your help.\\nAgent: You're welcome. Is there anything else I can assist you with?\\nCustomer: No, that's all. Thank you.\\nAgent: You're welcome. Have a great day!\"\"\""
22 | ]
23 | },
24 | {
25 | "cell_type": "code",
26 | "execution_count": 2,
27 | "id": "4476ac2b-25c1-447e-b121-c7b3c4c48006",
28 | "metadata": {
29 | "height": 30
30 | },
31 | "outputs": [
32 | {
33 | "name": "stdout",
34 | "output_type": "stream",
35 | "text": [
36 | "Agent: Thank you for calling BrownBox Customer Support. My name is Tom. How may I assist you today?\n",
37 | "Customer: Hi Tom, I'm trying to log in to my account to purchase an Oven Toaster Grill (OTG), but I'm unable to proceed as it's asking for mobile number or email verification. Can you help me with that?\n",
38 | "Agent: Sure, I can assist you with that. May I know your registered mobile number or email address, please?\n",
39 | "Customer: My registered mobile number is +1 123-456-7890.\n",
40 | "Agent: Thank you. Let me check that for you. I'm sorry to inform you that we don't have this number on our records. Can you please confirm if this is the correct number?\n",
41 | "Customer: Oh, I'm sorry. I might have registered with a different number. Can you please check with my email address instead? It's johndoe@email.com.\n",
42 | "Agent: Sure, let me check that for you. (After a few moments) I see that we have your email address on our records. We'll be sending you a verification code shortly. Please check your email and let me know once you receive it. Customer: Okay, I received the code. What do I do with it?\n",
43 | "Agent: Please enter the verification code in the field provided and click on 'Verify'. Once your email address is verified, you'll be able to proceed with your purchase.\n",
44 | "Customer: Okay, I entered the code, and it's verified now. Thank you for your help.\n",
45 | "Agent: You're welcome. Is there anything else I can assist you with?\n",
46 | "Customer: No, that's all. Thank you.\n",
47 | "Agent: You're welcome. Have a great day!\n"
48 | ]
49 | }
50 | ],
51 | "source": [
52 | "print (sample_data)"
53 | ]
54 | },
55 | {
56 | "cell_type": "markdown",
57 | "id": "532155d8-d874-4d92-a17d-760210f7ed81",
58 | "metadata": {},
59 | "source": [
60 | "### Defining What's Important"
61 | ]
62 | },
63 | {
64 | "cell_type": "code",
65 | "execution_count": 3,
66 | "id": "9dd444e1-816f-466c-a9c2-cb860b5b74bc",
67 | "metadata": {
68 | "height": 115
69 | },
70 | "outputs": [],
71 | "source": [
72 | "from utils import query_raven\n",
73 | "from typing import List\n",
74 | "from dataclasses import dataclass\n",
75 | "# Warning control\n",
76 | "import warnings\n",
77 | "warnings.filterwarnings('ignore')"
78 | ]
79 | },
80 | {
81 | "cell_type": "code",
82 | "execution_count": 4,
83 | "id": "deac8cdb-ebab-410a-be75-45bbb019fead",
84 | "metadata": {
85 | "height": 302,
86 | "tags": []
87 | },
88 | "outputs": [],
89 | "source": [
90 | "from dataclasses import dataclass\n",
91 | "schema_id = (\"agent_name\", \"customer_email\", \\\n",
92 | " \"customer_order\", \"customer_phone\", \"customer_sentiment\")\n",
93 | "\n",
94 | "dataclass_schema_representation = '''\n",
95 | "@dataclass\n",
96 | "class Record:\n",
97 | " agent_name : str # The agent name\n",
98 | " customer_email : str # customer email if provided, else ''\n",
99 | " customer_order : str # The customer order number if provided, else ''\n",
100 | " customer_phone : str # the customer phone number if provided, else ''\n",
101 | " customer_sentiment : str # Overall customer sentiment, either 'frustrated', or 'happy'. Always MUST have a value.\n",
102 | "'''\n",
103 | "\n",
104 | "# Let's call exec to insert the dataclass into our python interpreter so it understands this. \n",
105 | "exec(dataclass_schema_representation)\n"
106 | ]
107 | },
108 | {
109 | "cell_type": "markdown",
110 | "id": "211106d3-59d8-42c5-9a60-1bab9a6d148f",
111 | "metadata": {},
112 | "source": [
113 | "### Building The Database"
114 | ]
115 | },
116 | {
117 | "cell_type": "code",
118 | "execution_count": 5,
119 | "id": "86d6ccdb-dfa6-4b1d-96cc-8a6ccc30a754",
120 | "metadata": {
121 | "height": 608,
122 | "tags": []
123 | },
124 | "outputs": [],
125 | "source": [
126 | "def initialize_db():\n",
127 | " import sqlite3\n",
128 | "\n",
129 | " # Connect to SQLite database (or create it if it doesn't exist)\n",
130 | " conn = sqlite3.connect('extracted.db')\n",
131 | " cursor = conn.cursor()\n",
132 | "\n",
133 | " # Fixed table name\n",
134 | " table_name = \"customer_information\"\n",
135 | "\n",
136 | " # Fixed schema\n",
137 | " columns = \"\"\"\n",
138 | " id INTEGER PRIMARY KEY, \n",
139 | " agent_name TEXT, \n",
140 | " customer_email TEXT, \n",
141 | " customer_order TEXT, \n",
142 | " customer_phone TEXT, \n",
143 | " customer_sentiment TEXT\n",
144 | " \"\"\"\n",
145 | "\n",
146 | " # Ensure the table name is enclosed in quotes if it contains special characters\n",
147 | " quoted_table_name = f'\"{table_name}\"'\n",
148 | "\n",
149 | " # Check if a table with the exact name already exists\n",
150 | " cursor.execute(f\"SELECT name FROM sqlite_master WHERE type='table' AND name={quoted_table_name}\")\n",
151 | " if cursor.fetchone():\n",
152 | " print(f\"Table {table_name} already exists.\")\n",
153 | " else:\n",
154 | " # Create the new table with the fixed schema\n",
155 | " cursor.execute(f'''CREATE TABLE {quoted_table_name} ({columns})''')\n",
156 | " print(f\"Table {table_name} created successfully.\")\n",
157 | "\n",
158 | " # Commit the transaction and close the connection\n",
159 | " conn.commit()\n",
160 | " conn.close()"
161 | ]
162 | },
163 | {
164 | "cell_type": "code",
165 | "execution_count": 6,
166 | "id": "027fd826-b7ed-4f3b-afa3-08940b14412b",
167 | "metadata": {
168 | "height": 47,
169 | "tags": []
170 | },
171 | "outputs": [
172 | {
173 | "name": "stdout",
174 | "output_type": "stream",
175 | "text": [
176 | "Table customer_information created successfully.\n"
177 | ]
178 | }
179 | ],
180 | "source": [
181 | "!rm extracted.db\n",
182 | "initialize_db()"
183 | ]
184 | },
185 | {
186 | "cell_type": "markdown",
187 | "id": "08a0c009-2865-4f17-b2f7-4d290f58c68e",
188 | "metadata": {},
189 | "source": [
190 | "### Adding in Tools To Populate The Database"
191 | ]
192 | },
193 | {
194 | "cell_type": "code",
195 | "execution_count": 7,
196 | "id": "fae2d563-3643-418f-b662-c7cb7942164e",
197 | "metadata": {
198 | "height": 574,
199 | "tags": []
200 | },
201 | "outputs": [],
202 | "source": [
203 | "from dataclasses import dataclass, fields\n",
204 | "def update_knowledge(results_list : List[Record]):\n",
205 | " \"\"\"\n",
206 | " Registers the information necessary\n",
207 | " \"\"\"\n",
208 | " import sqlite3\n",
209 | " from sqlite3 import ProgrammingError\n",
210 | "\n",
211 | " # Reconnect to the existing SQLite database\n",
212 | " conn = sqlite3.connect('extracted.db')\n",
213 | " cursor = conn.cursor()\n",
214 | "\n",
215 | " # Fixed table name\n",
216 | " table_name = \"customer_information\"\n",
217 | "\n",
218 | " # Prepare SQL for inserting data with fixed column names\n",
219 | " column_names = \"agent_name, customer_email, customer_order, customer_phone, customer_sentiment\"\n",
220 | " placeholders = \", \".join([\"?\"] * 5) \n",
221 | " sql = f\"INSERT INTO {table_name} ({column_names}) VALUES ({placeholders})\"\n",
222 | "\n",
223 | " # Insert each record\n",
224 | " for record in results_list:\n",
225 | " try:\n",
226 | " record_values = tuple(getattr(record, f.name) for f in fields(record))\n",
227 | " cursor.execute(sql, record_values)\n",
228 | " except ProgrammingError as e:\n",
229 | " print(f\"Error with record. {e}\")\n",
230 | " continue\n",
231 | "\n",
232 | " # Commit the changes and close the connection\n",
233 | " conn.commit()\n",
234 | " conn.close()\n",
235 | " print(\"Records inserted successfully.\")"
236 | ]
237 | },
238 | {
239 | "cell_type": "code",
240 | "execution_count": 8,
241 | "id": "7085f71c-6ba7-409c-b092-a08934d35738",
242 | "metadata": {
243 | "height": 64,
244 | "tags": []
245 | },
246 | "outputs": [],
247 | "source": [
248 | "my_record = Record(agent_name = \"Agent Smith\", \\\n",
249 | " customer_email = \"\", customer_order = \"12346\", \\\n",
250 | " customer_phone = \"\", customer_sentiment = \"happy\")"
251 | ]
252 | },
253 | {
254 | "cell_type": "code",
255 | "execution_count": 9,
256 | "id": "f6770393-3a32-4977-9775-67c711542f7a",
257 | "metadata": {
258 | "height": 30,
259 | "tags": []
260 | },
261 | "outputs": [
262 | {
263 | "name": "stdout",
264 | "output_type": "stream",
265 | "text": [
266 | "Records inserted successfully.\n"
267 | ]
268 | }
269 | ],
270 | "source": [
271 | "update_knowledge([my_record])"
272 | ]
273 | },
274 | {
275 | "cell_type": "markdown",
276 | "id": "4e6ff129-1ad4-4ca1-92dc-6950bb256670",
277 | "metadata": {},
278 | "source": [
279 | "### Building Tools To Pull Information Out"
280 | ]
281 | },
282 | {
283 | "cell_type": "code",
284 | "execution_count": 10,
285 | "id": "148433d3-b10b-4815-b7f6-6cd2b82f85eb",
286 | "metadata": {
287 | "height": 438,
288 | "tags": []
289 | },
290 | "outputs": [],
291 | "source": [
292 | "import sqlite3\n",
293 | "def execute_sql(sql: str):\n",
294 | " \"\"\" Runs SQL code for the given schema. Make sure to properly leverage the schema to answer the user's question in the best way possible. \"\"\"\n",
295 | " # Fixed table name, assuming it's not dynamically generated anymore\n",
296 | " table_name = \"customer_information\"\n",
297 | "\n",
298 | " # Establish a connection to the database\n",
299 | " conn = sqlite3.connect('extracted.db')\n",
300 | " cursor = conn.cursor()\n",
301 | "\n",
302 | " # Execute the SQL statement\n",
303 | " cursor.execute(sql)\n",
304 | "\n",
305 | " # Initialize an empty list to hold query results\n",
306 | " results = []\n",
307 | "\n",
308 | " results = cursor.fetchall()\n",
309 | " print(\"Query operation executed successfully. Number of rows returned:\", len(results))\n",
310 | "\n",
311 | " # Close the connection to the database\n",
312 | " conn.close()\n",
313 | "\n",
314 | " # Return the results for SELECT operations; otherwise, return an empty list\n",
315 | " return results\n"
316 | ]
317 | },
318 | {
319 | "cell_type": "code",
320 | "execution_count": 11,
321 | "id": "0c50be4d-8792-4c2c-b4d2-1ee6faae5b56",
322 | "metadata": {
323 | "height": 166,
324 | "tags": []
325 | },
326 | "outputs": [
327 | {
328 | "name": "stdout",
329 | "output_type": "stream",
330 | "text": [
331 | "Executing SQL: \n",
332 | " SELECT agent_name \n",
333 | " FROM customer_information\n",
334 | " WHERE customer_sentiment = \"happy\"\n",
335 | " \n",
336 | "Query operation executed successfully. Number of rows returned: 1\n"
337 | ]
338 | },
339 | {
340 | "data": {
341 | "text/plain": [
342 | "[('Agent Smith',)]"
343 | ]
344 | },
345 | "execution_count": 11,
346 | "metadata": {},
347 | "output_type": "execute_result"
348 | }
349 | ],
350 | "source": [
351 | "sql = '''\n",
352 | " SELECT agent_name \n",
353 | " FROM customer_information\n",
354 | " WHERE customer_sentiment = \"happy\"\n",
355 | " '''\n",
356 | "# Print the final SQL command for debugging\n",
357 | "print(\"Executing SQL:\", sql)\n",
358 | "\n",
359 | "execute_sql(sql)"
360 | ]
361 | },
362 | {
363 | "cell_type": "markdown",
364 | "id": "a2e6703f-60cf-4ae2-bc61-afe8ad66d5be",
365 | "metadata": {},
366 | "source": [
367 | "-----"
368 | ]
369 | },
370 | {
371 | "cell_type": "markdown",
372 | "id": "51644729-ea6f-4fbf-ac99-08308c998cc1",
373 | "metadata": {
374 | "tags": []
375 | },
376 | "source": [
377 | "## Building The Pipeline"
378 | ]
379 | },
380 | {
381 | "cell_type": "code",
382 | "execution_count": 12,
383 | "id": "31af1526-330b-467c-b707-b13b70bfe663",
384 | "metadata": {
385 | "height": 47,
386 | "tags": []
387 | },
388 | "outputs": [
389 | {
390 | "name": "stdout",
391 | "output_type": "stream",
392 | "text": [
393 | "Table customer_information created successfully.\n"
394 | ]
395 | }
396 | ],
397 | "source": [
398 | "!rm extracted.db\n",
399 | "initialize_db()"
400 | ]
401 | },
402 | {
403 | "cell_type": "markdown",
404 | "id": "c7ae3b10-f302-4614-8b04-3d6d2065f8b0",
405 | "metadata": {},
406 | "source": [
407 | "##### Attribution:\n",
408 | "We will be using a handful of samples (~10-15 samples) in this lesson from a publically-available customer_service_chatbot on HuggingFace.\n",
409 | "The link to the public dataset is here: https://huggingface.co/datasets/SantiagoPG/customer_service_chatbot"
410 | ]
411 | },
412 | {
413 | "cell_type": "code",
414 | "execution_count": 13,
415 | "id": "c4b4ecd7-6822-4fb5-82ce-06ef221910ec",
416 | "metadata": {
417 | "height": 98,
418 | "tags": []
419 | },
420 | "outputs": [
421 | {
422 | "data": {
423 | "application/vnd.jupyter.widget-view+json": {
424 | "model_id": "50b34b3259d74f1f9b5e1d40703c14d0",
425 | "version_major": 2,
426 | "version_minor": 0
427 | },
428 | "text/plain": [
429 | "Generating train split: 0 examples [00:00, ? examples/s]"
430 | ]
431 | },
432 | "metadata": {},
433 | "output_type": "display_data"
434 | }
435 | ],
436 | "source": [
437 | "from datasets import load_dataset\n",
438 | "import os\n",
439 | "\n",
440 | "cwd = os.getcwd()\n",
441 | "dialogue_data = load_dataset(cwd + \"/data/customer_service_chatbot\", cache_dir=\"./cache\")[\"train\"]"
442 | ]
443 | },
444 | {
445 | "cell_type": "code",
446 | "execution_count": 14,
447 | "id": "4130ed17-b019-483f-913a-c45776e28560",
448 | "metadata": {
449 | "height": 64,
450 | "tags": []
451 | },
452 | "outputs": [
453 | {
454 | "name": "stdout",
455 | "output_type": "stream",
456 | "text": [
457 | "Agent: Hello, thank you for contacting BrownBox customer support. My name is Alex, how can I assist you today?\n",
458 | "Customer: Hi, I'm calling about my order for a water purifier. I received it yesterday, but it's not working correctly. I want to return it and get a refund.\n",
459 | "Agent: I'm sorry to hear that. I'll be happy to help you with that. Can you please provide me with your order number?\n",
460 | "Customer: Sure, it's 12345.\n",
461 | "Agent: Thank you for the information. May I know the reason for the return?\n",
462 | "Customer: As I mentioned earlier, the product is not working correctly. I want to return it and get a refund.\n",
463 | "Agent: I'm sorry for the inconvenience. We would be happy to process your return and refund. However, since you have opted for Cash on Delivery, it will take some time to process your refund. Our refund timelines for Cash on Delivery returns are usually within 7-14 business days from the date of pickup. \n",
464 | "Customer: What? That's too long. Why does it take so much time?\n",
465 | "Agent: I understand your frustration, but the refund process takes time as we have to verify the product's condition and ensure that it's unused and in its original packaging. Once we receive the product, we will initiate the refund process, and it will take 7-14 business days for the refund to reflect in your account.\n",
466 | "Customer: This is unacceptable. I need the refund immediately. Can't you do anything about it?\n",
467 | "Agent: I'm sorry, but we cannot expedite the refund process. However, I can assure you that we will process your refund as soon as possible. \n",
468 | "Customer: Can you at least tell me the status of my refund?\n",
469 | "Agent: Sure, I can check the status of your refund. Please allow me a moment to check that for you.\n",
470 | "(Customer is put on hold for a few minutes)\n",
471 | "Agent: Thank you for waiting. I have checked your refund status, and I see that your return has been received by our team. The refund process has been initiated, and it will reflect in your account within 7-14 business days.\n",
472 | "Customer: Alright, I understand. Is there anything else I need to do?\n",
473 | "Agent: No, you don't have to do anything else. Our team will process your refund, and you will receive an email confirmation once it's done. \n",
474 | "Customer: Okay, thank you for your help.\n",
475 | "Agent: You're welcome. I apologize for the inconvenience caused. Is there anything else I can assist you with?\n",
476 | "Customer: No, that's all. \n",
477 | "Agent: Alright, please feel free to contact us if you have any further questions or concerns. Have a great day!\n",
478 | "Customer: You too. Bye.\n",
479 | "Agent: Goodbye!\n"
480 | ]
481 | }
482 | ],
483 | "source": [
484 | "sample_zero = dialogue_data[6]\n",
485 | "dialogue_string = sample_zero[\"conversation\"].replace(\"\\n\\n\", \"\\n\")\n",
486 | "print (dialogue_string)"
487 | ]
488 | },
489 | {
490 | "cell_type": "code",
491 | "execution_count": 15,
492 | "id": "9bcceaf5-7be1-4e15-bdd6-24c37d72fa64",
493 | "metadata": {
494 | "height": 183,
495 | "tags": []
496 | },
497 | "outputs": [
498 | {
499 | "name": "stdout",
500 | "output_type": "stream",
501 | "text": [
502 | "\n",
503 | "@dataclass\n",
504 | "class Record:\n",
505 | " agent_name : str # The agent name\n",
506 | " customer_email : str # customer email if provided, else ''\n",
507 | " customer_order : str # The customer order number if provided, else ''\n",
508 | " customer_phone : str # the customer phone number if provided, else ''\n",
509 | " customer_sentiment : str # Overall customer sentiment, either 'frustrated', or 'happy'. Always MUST have a value.\n",
510 | "\n",
511 | "Function:\n",
512 | "update_knowledge(results_list: List[Record])\n",
513 | " \"\"\"\n",
514 | " Registers the information necessary\n",
515 | " \"\"\"\n",
516 | "\n",
517 | "\n",
518 | "User Query:\n",
519 | "Agent: Hello, thank you for contacting BrownBox customer support. My name is Alex, how can I assist you today?\n",
520 | "Customer: Hi, I'm calling about my order for a water purifier. I received it yesterday, but it's not working correctly. I want to return it and get a refund.\n",
521 | "Agent: I'm sorry to hear that. I'll be happy to help you with that. Can you please provide me with your order number?\n",
522 | "Customer: Sure, it's 12345.\n",
523 | "Agent: Thank you for the information. May I know the reason for the return?\n",
524 | "Customer: As I mentioned earlier, the product is not working correctly. I want to return it and get a refund.\n",
525 | "Agent: I'm sorry for the inconvenience. We would be happy to process your return and refund. However, since you have opted for Cash on Delivery, it will take some time to process your refund. Our refund timelines for Cash on Delivery returns are usually within 7-14 business days from the date of pickup. \n",
526 | "Customer: What? That's too long. Why does it take so much time?\n",
527 | "Agent: I understand your frustration, but the refund process takes time as we have to verify the product's condition and ensure that it's unused and in its original packaging. Once we receive the product, we will initiate the refund process, and it will take 7-14 business days for the refund to reflect in your account.\n",
528 | "Customer: This is unacceptable. I need the refund immediately. Can't you do anything about it?\n",
529 | "Agent: I'm sorry, but we cannot expedite the refund process. However, I can assure you that we will process your refund as soon as possible. \n",
530 | "Customer: Can you at least tell me the status of my refund?\n",
531 | "Agent: Sure, I can check the status of your refund. Please allow me a moment to check that for you.\n",
532 | "(Customer is put on hold for a few minutes)\n",
533 | "Agent: Thank you for waiting. I have checked your refund status, and I see that your return has been received by our team. The refund process has been initiated, and it will reflect in your account within 7-14 business days.\n",
534 | "Customer: Alright, I understand. Is there anything else I need to do?\n",
535 | "Agent: No, you don't have to do anything else. Our team will process your refund, and you will receive an email confirmation once it's done. \n",
536 | "Customer: Okay, thank you for your help.\n",
537 | "Agent: You're welcome. I apologize for the inconvenience caused. Is there anything else I can assist you with?\n",
538 | "Customer: No, that's all. \n",
539 | "Agent: Alright, please feel free to contact us if you have any further questions or concerns. Have a great day!\n",
540 | "Customer: You too. Bye.\n",
541 | "Agent: Goodbye!\n"
542 | ]
543 | }
544 | ],
545 | "source": [
546 | "import inspect\n",
547 | "\n",
548 | "prompt = \"\\n\" + dialogue_string\n",
549 | "\n",
550 | "signature = inspect.signature(update_knowledge)\n",
551 | "signature = str(signature).replace(\"__main__.Record\", \"Record\")\n",
552 | "docstring = update_knowledge.__doc__\n",
553 | "\n",
554 | "raven_prompt = f'''{dataclass_schema_representation}\\nFunction:\\n{update_knowledge.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n\\nUser Query:{prompt}'''\n",
555 | "print (raven_prompt)"
556 | ]
557 | },
558 | {
559 | "cell_type": "code",
560 | "execution_count": 16,
561 | "id": "80ef5b38-f117-4273-8204-132efcf61e09",
562 | "metadata": {
563 | "height": 47,
564 | "tags": []
565 | },
566 | "outputs": [
567 | {
568 | "name": "stdout",
569 | "output_type": "stream",
570 | "text": [
571 | "update_knowledge(results_list=[Record(agent_name='Alex', customer_email='', customer_order='12345', customer_phone='', customer_sentiment='frustrated')])\n"
572 | ]
573 | }
574 | ],
575 | "source": [
576 | "raven_call = query_raven(raven_prompt)\n",
577 | "print (raven_call)"
578 | ]
579 | },
580 | {
581 | "cell_type": "code",
582 | "execution_count": 17,
583 | "id": "fcfc6880-a5e2-4ed0-824c-fe442ecf3ca4",
584 | "metadata": {
585 | "height": 30,
586 | "tags": []
587 | },
588 | "outputs": [
589 | {
590 | "name": "stdout",
591 | "output_type": "stream",
592 | "text": [
593 | "Records inserted successfully.\n"
594 | ]
595 | }
596 | ],
597 | "source": [
598 | "exec(raven_call)"
599 | ]
600 | },
601 | {
602 | "cell_type": "code",
603 | "execution_count": 18,
604 | "id": "bb28ea92-4540-47e2-acbb-ef1f0c44ed19",
605 | "metadata": {
606 | "height": 251,
607 | "tags": []
608 | },
609 | "outputs": [
610 | {
611 | "name": "stdout",
612 | "output_type": "stream",
613 | "text": [
614 | "update_knowledge(results_list=[Record(agent_name='John', customer_email='', customer_order='#BB789012', customer_phone='', customer_sentiment='happy')])\n",
615 | "Records inserted successfully.\n"
616 | ]
617 | }
618 | ],
619 | "source": [
620 | "import inspect\n",
621 | "\n",
622 | "sample_zero = dialogue_data[10]\n",
623 | "dialogue_string = sample_zero[\"conversation\"].replace(\"\\n\\n\", \"\\n\")\n",
624 | "\n",
625 | "prompt = \"\\n\" + dialogue_string\n",
626 | "signature = inspect.signature(update_knowledge)\n",
627 | "docstring = update_knowledge.__doc__\n",
628 | "raven_prompt = f'''{dataclass_schema_representation}\\nFunction:\\n{update_knowledge.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n{prompt}'''\n",
629 | "\n",
630 | "raven_call = query_raven(raven_prompt)\n",
631 | "print (raven_call)\n",
632 | "exec(raven_call)\n"
633 | ]
634 | },
635 | {
636 | "cell_type": "code",
637 | "execution_count": 19,
638 | "id": "b0e719ae-c35d-4659-85c2-59af988af124",
639 | "metadata": {
640 | "height": 115,
641 | "tags": []
642 | },
643 | "outputs": [
644 | {
645 | "name": "stdout",
646 | "output_type": "stream",
647 | "text": [
648 | "Query operation executed successfully. Number of rows returned: 1\n"
649 | ]
650 | },
651 | {
652 | "data": {
653 | "text/plain": [
654 | "[(1,)]"
655 | ]
656 | },
657 | "execution_count": 19,
658 | "metadata": {},
659 | "output_type": "execute_result"
660 | }
661 | ],
662 | "source": [
663 | "execute_sql(\n",
664 | " '''\n",
665 | " SELECT COUNT(customer_sentiment) \n",
666 | " FROM customer_information\n",
667 | " WHERE agent_name = \"John\" AND customer_sentiment = \"happy\"\n",
668 | " ''')"
669 | ]
670 | },
671 | {
672 | "cell_type": "code",
673 | "execution_count": 20,
674 | "id": "57dfa8db-7286-414d-a769-e6ad6dfb7474",
675 | "metadata": {
676 | "height": 370,
677 | "tags": []
678 | },
679 | "outputs": [
680 | {
681 | "name": "stdout",
682 | "output_type": "stream",
683 | "text": [
684 | "\n",
685 | "CREATE TABLE customer_information (\n",
686 | " id INTEGER PRIMARY KEY AUTOINCREMENT,\n",
687 | " agent_name TEXT,\n",
688 | " customer_email TEXT,\n",
689 | " customer_order TEXT,\n",
690 | " customer_phone TEXT,\n",
691 | " customer_sentiment TEXT\n",
692 | ");\n",
693 | "\n",
694 | "Function:\n",
695 | "execute_sql(sql: str)\n",
696 | " \"\"\" Runs SQL code for the given schema. Make sure to properly leverage the schema to answer the user's question in the best way possible. \"\"\"\n",
697 | "\n",
698 | "\n",
699 | "User Query:how many customers John has made happy.\n"
700 | ]
701 | }
702 | ],
703 | "source": [
704 | "prompt = \"how many customers John has made happy.\"\n",
705 | "\n",
706 | "signature = inspect.signature(execute_sql)\n",
707 | "\n",
708 | "docstring = execute_sql.__doc__\n",
709 | "\n",
710 | "sql_schema_representation = \\\n",
711 | "\"\"\"\n",
712 | "CREATE TABLE customer_information (\n",
713 | " id INTEGER PRIMARY KEY AUTOINCREMENT,\n",
714 | " agent_name TEXT,\n",
715 | " customer_email TEXT,\n",
716 | " customer_order TEXT,\n",
717 | " customer_phone TEXT,\n",
718 | " customer_sentiment TEXT\n",
719 | ");\n",
720 | "\"\"\"\n",
721 | "\n",
722 | "raven_prompt = f'''{sql_schema_representation}\\nFunction:\\n{execute_sql.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n\\nUser Query:{prompt}'''\n",
723 | "\n",
724 | "print (raven_prompt)"
725 | ]
726 | },
727 | {
728 | "cell_type": "code",
729 | "execution_count": 21,
730 | "id": "963ef081-30ac-4813-b17c-ef9dcf1ecdd8",
731 | "metadata": {
732 | "height": 64,
733 | "tags": []
734 | },
735 | "outputs": [
736 | {
737 | "name": "stdout",
738 | "output_type": "stream",
739 | "text": [
740 | "execute_sql(sql='SELECT COUNT(customer_sentiment) FROM customer_information WHERE agent_name = \"John\" AND customer_sentiment = \"happy\"')\n"
741 | ]
742 | }
743 | ],
744 | "source": [
745 | "raven_call = query_raven(raven_prompt)\n",
746 | "\n",
747 | "print (raven_call)"
748 | ]
749 | },
750 | {
751 | "cell_type": "code",
752 | "execution_count": 22,
753 | "id": "80cd0082-e0a2-4133-8018-e57cf5fca8f6",
754 | "metadata": {
755 | "height": 30,
756 | "tags": []
757 | },
758 | "outputs": [
759 | {
760 | "name": "stdout",
761 | "output_type": "stream",
762 | "text": [
763 | "Query operation executed successfully. Number of rows returned: 1\n"
764 | ]
765 | },
766 | {
767 | "data": {
768 | "text/plain": [
769 | "[(1,)]"
770 | ]
771 | },
772 | "execution_count": 22,
773 | "metadata": {},
774 | "output_type": "execute_result"
775 | }
776 | ],
777 | "source": [
778 | "eval(raven_call)"
779 | ]
780 | },
781 | {
782 | "cell_type": "code",
783 | "execution_count": 23,
784 | "id": "37241723-ec18-42f5-a8dc-16d9ac8998e0",
785 | "metadata": {
786 | "height": 47,
787 | "tags": []
788 | },
789 | "outputs": [
790 | {
791 | "name": "stdout",
792 | "output_type": "stream",
793 | "text": [
794 | "Table customer_information created successfully.\n"
795 | ]
796 | }
797 | ],
798 | "source": [
799 | "!rm extracted.db\n",
800 | "initialize_db()"
801 | ]
802 | },
803 | {
804 | "cell_type": "code",
805 | "execution_count": 24,
806 | "id": "1d17f5dd-4879-49b7-a7b4-a1a970efa45f",
807 | "metadata": {
808 | "height": 251,
809 | "tags": []
810 | },
811 | "outputs": [
812 | {
813 | "name": "stderr",
814 | "output_type": "stream",
815 | "text": [
816 | " 10%|█ | 1/10 [00:01<00:15, 1.68s/it]"
817 | ]
818 | },
819 | {
820 | "name": "stdout",
821 | "output_type": "stream",
822 | "text": [
823 | "update_knowledge(results_list=[Record(agent_name='Tom', customer_email='johndoe@email.com', customer_order='', customer_phone='+1 123-456-7890', customer_sentiment='happy')])\n",
824 | "Records inserted successfully.\n"
825 | ]
826 | },
827 | {
828 | "name": "stderr",
829 | "output_type": "stream",
830 | "text": [
831 | "\r",
832 | " 20%|██ | 2/10 [00:02<00:11, 1.44s/it]"
833 | ]
834 | },
835 | {
836 | "name": "stdout",
837 | "output_type": "stream",
838 | "text": [
839 | "update_knowledge(results_list=[Record(agent_name='Alex', customer_email='', customer_order='789101', customer_phone='', customer_sentiment='happy')])\n",
840 | "Records inserted successfully.\n"
841 | ]
842 | },
843 | {
844 | "name": "stderr",
845 | "output_type": "stream",
846 | "text": [
847 | "\r",
848 | " 30%|███ | 3/10 [00:04<00:10, 1.48s/it]"
849 | ]
850 | },
851 | {
852 | "name": "stdout",
853 | "output_type": "stream",
854 | "text": [
855 | "update_knowledge(results_list=[Record(agent_name='Sarah', customer_email='jane.doe@email.com', customer_order='987654', customer_phone='', customer_sentiment='happy')])\n",
856 | "Records inserted successfully.\n"
857 | ]
858 | },
859 | {
860 | "name": "stderr",
861 | "output_type": "stream",
862 | "text": [
863 | "\r",
864 | " 40%|████ | 4/10 [00:06<00:10, 1.73s/it]"
865 | ]
866 | },
867 | {
868 | "name": "stdout",
869 | "output_type": "stream",
870 | "text": [
871 | "update_knowledge(results_list=[Record(agent_name='BrownBox', customer_email='john.doe@gmail.com', customer_order='BB98765432', customer_phone='123-456-7890', customer_sentiment='happy')])\n",
872 | "Records inserted successfully.\n"
873 | ]
874 | },
875 | {
876 | "name": "stderr",
877 | "output_type": "stream",
878 | "text": [
879 | "\r",
880 | " 50%|█████ | 5/10 [00:08<00:08, 1.67s/it]"
881 | ]
882 | },
883 | {
884 | "name": "stdout",
885 | "output_type": "stream",
886 | "text": [
887 | "update_knowledge(results_list=[Record(agent_name='Sarah', customer_email='', customer_order='BB123456', customer_phone='', customer_sentiment='frustrated')])\n",
888 | "Records inserted successfully.\n"
889 | ]
890 | },
891 | {
892 | "name": "stderr",
893 | "output_type": "stream",
894 | "text": [
895 | "\r",
896 | " 60%|██████ | 6/10 [00:09<00:06, 1.65s/it]"
897 | ]
898 | },
899 | {
900 | "name": "stdout",
901 | "output_type": "stream",
902 | "text": [
903 | "update_knowledge(results_list=[Record(agent_name='Alex', customer_email='johnsmith@email.com', customer_order='', customer_phone='123-456-7890', customer_sentiment='happy')])\n",
904 | "Records inserted successfully.\n"
905 | ]
906 | },
907 | {
908 | "name": "stderr",
909 | "output_type": "stream",
910 | "text": [
911 | "\r",
912 | " 70%|███████ | 7/10 [00:11<00:04, 1.54s/it]"
913 | ]
914 | },
915 | {
916 | "name": "stdout",
917 | "output_type": "stream",
918 | "text": [
919 | "update_knowledge(results_list=[Record(agent_name='Alex', customer_email='', customer_order='12345', customer_phone='', customer_sentiment='frustrated')])\n",
920 | "Records inserted successfully.\n"
921 | ]
922 | },
923 | {
924 | "name": "stderr",
925 | "output_type": "stream",
926 | "text": [
927 | "\r",
928 | " 80%|████████ | 8/10 [00:12<00:02, 1.43s/it]"
929 | ]
930 | },
931 | {
932 | "name": "stdout",
933 | "output_type": "stream",
934 | "text": [
935 | "update_knowledge(results_list=[Record(agent_name='Rachel', customer_email='', customer_order='', customer_phone='', customer_sentiment='happy')])\n",
936 | "Records inserted successfully.\n"
937 | ]
938 | },
939 | {
940 | "name": "stderr",
941 | "output_type": "stream",
942 | "text": [
943 | "\r",
944 | " 90%|█████████ | 9/10 [00:13<00:01, 1.45s/it]"
945 | ]
946 | },
947 | {
948 | "name": "stdout",
949 | "output_type": "stream",
950 | "text": [
951 | "update_knowledge(results_list=[Record(agent_name='Sarah', customer_email='', customer_order='#98765', customer_phone='', customer_sentiment='happy')])\n",
952 | "Records inserted successfully.\n"
953 | ]
954 | },
955 | {
956 | "name": "stderr",
957 | "output_type": "stream",
958 | "text": [
959 | "100%|██████████| 10/10 [00:15<00:00, 1.56s/it]"
960 | ]
961 | },
962 | {
963 | "name": "stdout",
964 | "output_type": "stream",
965 | "text": [
966 | "update_knowledge(results_list=[Record(agent_name='Sarah', customer_email='jane@email.com', customer_order='', customer_phone='9876543210', customer_sentiment='frustrated')])\n",
967 | "Records inserted successfully.\n"
968 | ]
969 | },
970 | {
971 | "name": "stderr",
972 | "output_type": "stream",
973 | "text": [
974 | "\n"
975 | ]
976 | }
977 | ],
978 | "source": [
979 | "from tqdm import tqdm\n",
980 | "\n",
981 | "for i in tqdm(range(0, 10)):\n",
982 | " data = dialogue_data[i]\n",
983 | " dialogue_string = data[\"conversation\"].replace(\"\\n\\n\", \"\\n\")\n",
984 | " \n",
985 | " # Ask Raven to extract the information we want out of this dialogue. \n",
986 | " prompt = \"\\n\" + dialogue_string\n",
987 | " signature = inspect.signature(update_knowledge)\n",
988 | " docstring = update_knowledge.__doc__\n",
989 | " raven_prompt = f'''{dataclass_schema_representation}\\nFunction:\\n{update_knowledge.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n\\nUser Query:{prompt}'''\n",
990 | " raven_call = query_raven(raven_prompt)\n",
991 | " print (raven_call)\n",
992 | " exec(raven_call)"
993 | ]
994 | },
995 | {
996 | "cell_type": "code",
997 | "execution_count": 25,
998 | "id": "6c22fce8-ddf3-4d4b-9d71-fab489581884",
999 | "metadata": {
1000 | "height": 404,
1001 | "tags": []
1002 | },
1003 | "outputs": [
1004 | {
1005 | "name": "stdout",
1006 | "output_type": "stream",
1007 | "text": [
1008 | "\n",
1009 | "CREATE TABLE customer_information (\n",
1010 | " id INTEGER PRIMARY KEY AUTOINCREMENT,\n",
1011 | " agent_name TEXT,\n",
1012 | " customer_email TEXT,\n",
1013 | " customer_order TEXT,\n",
1014 | " customer_phone TEXT,\n",
1015 | " customer_sentiment TEXT\n",
1016 | ");\n",
1017 | "\n",
1018 | "Function:\n",
1019 | "execute_sql(sql: str)\n",
1020 | " \"\"\" Runs SQL code for the given schema. Make sure to properly leverage the schema to answer the user's question in the best way possible. \"\"\"\n",
1021 | "\n",
1022 | "\n",
1023 | "User Query: How many happy customers?\n",
1024 | "execute_sql(sql='SELECT COUNT(*) FROM customer_information WHERE customer_sentiment = \"happy\";')\n",
1025 | "Query operation executed successfully. Number of rows returned: 1\n"
1026 | ]
1027 | },
1028 | {
1029 | "data": {
1030 | "text/plain": [
1031 | "[(7,)]"
1032 | ]
1033 | },
1034 | "execution_count": 25,
1035 | "metadata": {},
1036 | "output_type": "execute_result"
1037 | }
1038 | ],
1039 | "source": [
1040 | "signature = inspect.signature(execute_sql)\n",
1041 | "\n",
1042 | "docstring = execute_sql.__doc__\n",
1043 | "\n",
1044 | "schema_representation = \\\n",
1045 | "\"\"\"\n",
1046 | "CREATE TABLE customer_information (\n",
1047 | " id INTEGER PRIMARY KEY AUTOINCREMENT,\n",
1048 | " agent_name TEXT,\n",
1049 | " customer_email TEXT,\n",
1050 | " customer_order TEXT,\n",
1051 | " customer_phone TEXT,\n",
1052 | " customer_sentiment TEXT\n",
1053 | ");\n",
1054 | "\"\"\"\n",
1055 | "\n",
1056 | "raven_prompt = f'''{schema_representation}\\nFunction:\\n{execute_sql.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n\\n'''\n",
1057 | "raven_prompt = raven_prompt + \"User Query: How many happy customers?\"\n",
1058 | "print (raven_prompt)\n",
1059 | "raven_call = query_raven(raven_prompt)\n",
1060 | "\n",
1061 | "print (raven_call)\n",
1062 | "eval(raven_call)"
1063 | ]
1064 | },
1065 | {
1066 | "cell_type": "code",
1067 | "execution_count": 26,
1068 | "id": "de0a70a9-1cb1-4d70-8da7-8450b467fd8c",
1069 | "metadata": {
1070 | "height": 183,
1071 | "tags": []
1072 | },
1073 | "outputs": [
1074 | {
1075 | "name": "stdout",
1076 | "output_type": "stream",
1077 | "text": [
1078 | "\n",
1079 | "CREATE TABLE customer_information (\n",
1080 | " id INTEGER PRIMARY KEY AUTOINCREMENT,\n",
1081 | " agent_name TEXT,\n",
1082 | " customer_email TEXT,\n",
1083 | " customer_order TEXT,\n",
1084 | " customer_phone TEXT,\n",
1085 | " customer_sentiment TEXT\n",
1086 | ");\n",
1087 | "\n",
1088 | "Function:\n",
1089 | "execute_sql(sql: str)\n",
1090 | " \"\"\" Runs SQL code for the given schema. Make sure to properly leverage the schema to answer the user's question in the best way possible. \"\"\"\n",
1091 | "\n",
1092 | "\n",
1093 | "User Query: Give me the names and phone numbers of the oneswho are frustrated and the order numbers?\n",
1094 | "execute_sql(sql='SELECT agent_name, customer_phone, customer_order FROM customer_information WHERE customer_sentiment = \"frustrated\";')\n",
1095 | "Query operation executed successfully. Number of rows returned: 3\n"
1096 | ]
1097 | },
1098 | {
1099 | "data": {
1100 | "text/plain": [
1101 | "[('Sarah', '', 'BB123456'), ('Alex', '', '12345'), ('Sarah', '9876543210', '')]"
1102 | ]
1103 | },
1104 | "execution_count": 26,
1105 | "metadata": {},
1106 | "output_type": "execute_result"
1107 | }
1108 | ],
1109 | "source": [
1110 | "raven_prompt = f'''{schema_representation}\\nFunction:\\n{execute_sql.__name__}{signature}\\n \"\"\"{docstring}\"\"\"\\n\\n\\n'''\n",
1111 | "raven_prompt = raven_prompt + \\\n",
1112 | "\"User Query: Give me the names and phone numbers of the ones\"\\\n",
1113 | "\"who are frustrated and the order numbers?\"\n",
1114 | "\n",
1115 | "print (raven_prompt)\n",
1116 | "raven_call = query_raven(raven_prompt)\n",
1117 | "\n",
1118 | "print (raven_call)\n",
1119 | "eval(raven_call)"
1120 | ]
1121 | },
1122 | {
1123 | "cell_type": "code",
1124 | "execution_count": null,
1125 | "id": "958c3275-5edb-484d-a743-680f8bcb9173",
1126 | "metadata": {
1127 | "height": 30
1128 | },
1129 | "outputs": [],
1130 | "source": []
1131 | }
1132 | ],
1133 | "metadata": {
1134 | "kernelspec": {
1135 | "display_name": "Python 3 (ipykernel)",
1136 | "language": "python",
1137 | "name": "python3"
1138 | },
1139 | "language_info": {
1140 | "codemirror_mode": {
1141 | "name": "ipython",
1142 | "version": 3
1143 | },
1144 | "file_extension": ".py",
1145 | "mimetype": "text/x-python",
1146 | "name": "python",
1147 | "nbconvert_exporter": "python",
1148 | "pygments_lexer": "ipython3",
1149 | "version": "3.11.9"
1150 | }
1151 | },
1152 | "nbformat": 4,
1153 | "nbformat_minor": 5
1154 | }
1155 |
--------------------------------------------------------------------------------
/Lesson_5_Student.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "ecc18f12-db18-46c1-9bf4-7dc85d7c59c8",
6 | "metadata": {},
7 | "source": [
8 | "## Adding Web Search To Your LLM"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 1,
14 | "id": "2d90723f-17e9-4697-98e7-052f8613bf45",
15 | "metadata": {
16 | "height": 47
17 | },
18 | "outputs": [],
19 | "source": [
20 | "from dotenv import load_dotenv\n",
21 | "_ = load_dotenv()"
22 | ]
23 | },
24 | {
25 | "cell_type": "markdown",
26 | "id": "adf60829-5347-4e78-88ad-d720e4f370f0",
27 | "metadata": {},
28 | "source": [
29 | "#### Asking Your LLM For The Latest Information"
30 | ]
31 | },
32 | {
33 | "cell_type": "code",
34 | "execution_count": 2,
35 | "id": "051e1fb4-7730-4458-ad0b-c63eea7781e5",
36 | "metadata": {
37 | "height": 149
38 | },
39 | "outputs": [
40 | {
41 | "data": {
42 | "text/plain": [
43 | "'I\\'m sorry, but I don\\'t have any information about a specific \"R1\" thing that was announced by Rabbit. It\\'s possible that you may have misspoken or misunderstood the information you received. If you could provide more context or clarify your question, I would be happy to try and help you.'"
44 | ]
45 | },
46 | "execution_count": 2,
47 | "metadata": {},
48 | "output_type": "execute_result"
49 | }
50 | ],
51 | "source": [
52 | "from utils import query_raven\n",
53 | "question = \"Hey, can you tell me more about this R1 thing that was announced by Rabbit? \"\n",
54 | "\n",
55 | "no_function_calling_prompt = \\\n",
56 | "f\"\"\"\n",
57 | " [INST] {question} [/INST]\n",
58 | "\"\"\"\n",
59 | "query_raven(no_function_calling_prompt)"
60 | ]
61 | },
62 | {
63 | "cell_type": "markdown",
64 | "id": "f1d2c1f5-78fc-4ee1-94f3-23e883f463ee",
65 | "metadata": {},
66 | "source": [
67 | "#### Providing Up To Date Information"
68 | ]
69 | },
70 | {
71 | "cell_type": "code",
72 | "execution_count": 3,
73 | "id": "1f6ca927-0e66-4db4-9746-961de1ef81d1",
74 | "metadata": {
75 | "height": 370
76 | },
77 | "outputs": [],
78 | "source": [
79 | "import os\n",
80 | "\n",
81 | "def do_web_search(full_user_prompt : str, num_results : int = 5):\n",
82 | " API_URL = f'{os.getenv(\"DLAI_TAVILY_BASE_URL\", \"https://api.tavily.com\")}/search'\n",
83 | " payload = \\\n",
84 | " {\n",
85 | " \"api_key\": os.environ[\"TAVILY_API_KEY\"],\n",
86 | " \"query\": full_user_prompt,\n",
87 | " \"search_depth\": \"basic\",\n",
88 | " \"include_answer\": False,\n",
89 | " \"include_images\": False,\n",
90 | " \"include_raw_content\": False,\n",
91 | " \"max_results\": num_results,\n",
92 | " \"include_domains\": [],\n",
93 | " \"exclude_domains\": []\n",
94 | " }\n",
95 | " import requests\n",
96 | " response = requests.post(API_URL, json=payload)\n",
97 | " response = response.json()\n",
98 | " all_results = \"\\n\\n\".join(item[\"content\"] for item in response[\"results\"])\n",
99 | " return all_results"
100 | ]
101 | },
102 | {
103 | "cell_type": "markdown",
104 | "id": "b54b8d1e-d084-4e22-8b42-a15510e4149d",
105 | "metadata": {},
106 | "source": [
107 | "#### Calling Raven"
108 | ]
109 | },
110 | {
111 | "cell_type": "code",
112 | "execution_count": 4,
113 | "id": "8910dd2e-ed87-4883-8508-48a4718ee5aa",
114 | "metadata": {
115 | "height": 285
116 | },
117 | "outputs": [
118 | {
119 | "name": "stdout",
120 | "output_type": "stream",
121 | "text": [
122 | "do_web_search(full_user_prompt='R1 thing')\n"
123 | ]
124 | }
125 | ],
126 | "source": [
127 | "function_calling_prompt = \\\n",
128 | "\"\"\"\n",
129 | "Function:\n",
130 | "def do_web_search(full_user_prompt : str, num_results : int = 5):\n",
131 | " '''\n",
132 | " Searches the web for the user question.\n",
133 | " '''\n",
134 | "\n",
135 | "Example:\n",
136 | "User Query: What is the oldest capital in the world?\n",
137 | "Call: do_web_search(full_user_prompt=\"oldest capital\")\n",
138 | "\n",
139 | "User Query: {query}\n",
140 | "\"\"\"\n",
141 | "fc_result = query_raven(function_calling_prompt.format(query=question))\n",
142 | "print (fc_result)"
143 | ]
144 | },
145 | {
146 | "cell_type": "code",
147 | "execution_count": 5,
148 | "id": "d25889b3-b7db-4144-aebd-b038717d4d1f",
149 | "metadata": {
150 | "height": 47
151 | },
152 | "outputs": [],
153 | "source": [
154 | "result = eval(fc_result)\n"
155 | ]
156 | },
157 | {
158 | "cell_type": "code",
159 | "execution_count": 6,
160 | "id": "a13e640c-e6c3-4103-bd36-60f5ef87c39a",
161 | "metadata": {
162 | "height": 200
163 | },
164 | "outputs": [],
165 | "source": [
166 | "full_prompt = \\\n",
167 | "f\"\"\"\n",
168 | " [INST]\n",
169 | "{result}\n",
170 | "\n",
171 | "Use the information above to answer the following question concisely.\n",
172 | "\n",
173 | "Question:\n",
174 | "{question} [/INST]\n",
175 | "\"\"\"\n"
176 | ]
177 | },
178 | {
179 | "cell_type": "code",
180 | "execution_count": 7,
181 | "id": "a0de0eab-230b-4951-896e-719e99740ec6",
182 | "metadata": {
183 | "height": 47
184 | },
185 | "outputs": [],
186 | "source": [
187 | "grounded_response = query_raven(full_prompt.format(question = question))\n"
188 | ]
189 | },
190 | {
191 | "cell_type": "code",
192 | "execution_count": 8,
193 | "id": "57d01c0b-4327-4b96-b361-4bde9c34a266",
194 | "metadata": {
195 | "height": 30
196 | },
197 | "outputs": [
198 | {
199 | "name": "stdout",
200 | "output_type": "stream",
201 | "text": [
202 | "The R1 is an AI-powered gadget that can use your apps for you. It's a voice assistant that can answer questions, play music, and more. It's not a phone, but it can be used to control your apps. The R1 is powered by a custom-built natural-language operating system called rabbit OS. It's the first OS ever designed for voice assistants. The R1 is also connected to Perplexity, an AI search engine, so it can deliver more or less real-time information about news, sports scores, and more. The R1 is not a phone, but it can be used to control your apps. The R1 is a voice assistant that can use your apps for you.\n"
203 | ]
204 | }
205 | ],
206 | "source": [
207 | "print (grounded_response)"
208 | ]
209 | },
210 | {
211 | "cell_type": "markdown",
212 | "id": "a01059e6-4f7e-4158-9411-c5241888d90f",
213 | "metadata": {},
214 | "source": [
215 | "## Chatting With Your SQL Database\n",
216 | "> Note below: The database values are randomly generated so your values may differ from those in the video.\n"
217 | ]
218 | },
219 | {
220 | "cell_type": "code",
221 | "execution_count": 9,
222 | "id": "1d4498e7-2321-4217-9b5d-676e66123d37",
223 | "metadata": {
224 | "height": 47
225 | },
226 | "outputs": [
227 | {
228 | "name": "stdout",
229 | "output_type": "stream",
230 | "text": [
231 | "Toys in database:\n",
232 | "(1, 'Mighty Doll', 6.25)\n",
233 | "(2, 'Crazy Bear', 13.25)\n",
234 | "(3, 'Magic Robot', 19.4)\n",
235 | "(4, 'Wonder Car', 15.14)\n",
236 | "(5, 'Super Bear', 19.01)\n",
237 | "(6, 'Wonder Bear', 15.8)\n",
238 | "(7, 'Super Doll', 8.78)\n",
239 | "(8, 'Super Robot', 18.72)\n",
240 | "(9, 'Wonder Car', 6.85)\n",
241 | "(10, 'Happy Car', 11.09)\n",
242 | "(11, 'Mighty Doll', 5.38)\n",
243 | "(12, 'Magic Dragon', 16.52)\n",
244 | "(13, 'Wonder Car', 7.81)\n",
245 | "(14, 'Mighty Doll', 7.63)\n",
246 | "(15, 'Happy Car', 14.53)\n",
247 | "(16, 'Happy Car', 6.08)\n",
248 | "(17, 'Crazy Doll', 7.29)\n",
249 | "(18, 'Super Bear', 7.9)\n",
250 | "(19, 'Happy Bear', 12.83)\n",
251 | "(20, 'Crazy Car', 9.16)\n",
252 | "(21, 'Mighty Robot', 7.72)\n",
253 | "(22, 'Crazy Car', 13.77)\n",
254 | "(23, 'Wonder Train', 11.39)\n",
255 | "(24, 'Wonder Car', 19.0)\n",
256 | "(25, 'Wonder Bear', 9.78)\n",
257 | "(26, 'Mighty Doll', 13.8)\n",
258 | "(27, 'Crazy Robot', 19.86)\n",
259 | "(28, 'Super Train', 5.96)\n",
260 | "(29, 'Mighty Bear', 7.9)\n",
261 | "(30, 'Magic Bear', 9.6)\n",
262 | "(31, 'Mighty Car', 5.8)\n",
263 | "(32, 'Super Bear', 8.75)\n",
264 | "(33, 'Super Robot', 15.95)\n",
265 | "(34, 'Magic Car', 12.71)\n",
266 | "(35, 'Crazy Robot', 19.4)\n",
267 | "(36, 'Crazy Train', 19.25)\n",
268 | "(37, 'Crazy Train', 8.37)\n",
269 | "(38, 'Happy Car', 11.37)\n",
270 | "(39, 'Crazy Robot', 18.27)\n",
271 | "(40, 'Wonder Train', 7.81)\n",
272 | "(41, 'Magic Bear', 10.19)\n",
273 | "(42, 'Crazy Car', 7.74)\n",
274 | "(43, 'Wonder Car', 18.46)\n",
275 | "(44, 'Crazy Car', 7.5)\n",
276 | "(45, 'Mighty Robot', 13.44)\n",
277 | "(46, 'Wonder Bear', 16.91)\n",
278 | "(47, 'Magic Dragon', 12.26)\n",
279 | "(48, 'Wonder Train', 5.49)\n",
280 | "(49, 'Mighty Robot', 5.53)\n",
281 | "(50, 'Happy Robot', 19.91)\n",
282 | "(51, 'Wonder Robot', 5.7)\n",
283 | "(52, 'Magic Doll', 18.85)\n",
284 | "(53, 'Super Car', 13.69)\n",
285 | "(54, 'Happy Robot', 11.18)\n",
286 | "(55, 'Wonder Bear', 8.7)\n",
287 | "(56, 'Wonder Dragon', 13.87)\n",
288 | "(57, 'Super Dragon', 7.0)\n",
289 | "(58, 'Wonder Dragon', 10.54)\n",
290 | "(59, 'Wonder Dragon', 17.91)\n",
291 | "(60, 'Happy Car', 10.04)\n",
292 | "(61, 'Super Dragon', 7.96)\n",
293 | "(62, 'Crazy Car', 9.13)\n",
294 | "(63, 'Happy Robot', 5.84)\n",
295 | "(64, 'Crazy Doll', 9.11)\n",
296 | "(65, 'Wonder Bear', 13.47)\n",
297 | "(66, 'Crazy Train', 11.81)\n",
298 | "(67, 'Happy Doll', 18.3)\n",
299 | "(68, 'Magic Dragon', 18.62)\n",
300 | "(69, 'Mighty Train', 13.28)\n",
301 | "(70, 'Mighty Bear', 15.7)\n",
302 | "(71, 'Happy Doll', 9.58)\n",
303 | "(72, 'Happy Bear', 12.97)\n",
304 | "(73, 'Wonder Doll', 8.43)\n",
305 | "(74, 'Super Train', 19.92)\n",
306 | "(75, 'Mighty Train', 13.58)\n",
307 | "(76, 'Happy Doll', 9.72)\n",
308 | "(77, 'Magic Car', 6.27)\n",
309 | "(78, 'Magic Doll', 15.95)\n",
310 | "(79, 'Super Train', 10.45)\n",
311 | "(80, 'Super Train', 5.62)\n",
312 | "(81, 'Super Bear', 14.2)\n",
313 | "(82, 'Magic Dragon', 13.48)\n",
314 | "(83, 'Magic Dragon', 7.89)\n",
315 | "(84, 'Magic Bear', 11.51)\n",
316 | "(85, 'Crazy Robot', 14.92)\n",
317 | "(86, 'Happy Doll', 10.63)\n",
318 | "(87, 'Wonder Bear', 5.38)\n",
319 | "(88, 'Happy Car', 15.47)\n",
320 | "(89, 'Wonder Car', 16.5)\n",
321 | "(90, 'Crazy Robot', 8.26)\n",
322 | "(91, 'Super Bear', 17.54)\n",
323 | "(92, 'Crazy Car', 5.97)\n",
324 | "(93, 'Wonder Car', 13.73)\n",
325 | "(94, 'Mighty Bear', 7.18)\n",
326 | "(95, 'Crazy Car', 14.18)\n",
327 | "(96, 'Super Dragon', 16.77)\n",
328 | "(97, 'Wonder Bear', 6.37)\n",
329 | "(98, 'Crazy Car', 14.0)\n",
330 | "(99, 'Mighty Car', 12.76)\n",
331 | "(100, 'Super Train', 5.53)\n",
332 | "(101, 'Wonder Train', 5.78)\n",
333 | "(102, 'Mighty Doll', 7.53)\n",
334 | "(103, 'Wonder Doll', 12.19)\n",
335 | "(104, 'Magic Doll', 6.8)\n",
336 | "(105, 'Magic Train', 17.67)\n",
337 | "(106, 'Super Dragon', 13.49)\n",
338 | "(107, 'Wonder Train', 19.25)\n",
339 | "(108, 'Happy Train', 15.74)\n",
340 | "(109, 'Wonder Dragon', 5.89)\n",
341 | "(110, 'Happy Bear', 17.7)\n",
342 | "(111, 'Wonder Doll', 9.32)\n",
343 | "(112, 'Crazy Car', 8.75)\n",
344 | "(113, 'Super Train', 17.85)\n",
345 | "(114, 'Super Dragon', 17.68)\n",
346 | "(115, 'Magic Car', 18.87)\n",
347 | "(116, 'Mighty Dragon', 13.11)\n",
348 | "(117, 'Wonder Doll', 8.43)\n",
349 | "(118, 'Magic Train', 12.87)\n",
350 | "(119, 'Super Robot', 8.28)\n",
351 | "(120, 'Magic Bear', 10.42)\n",
352 | "(121, 'Crazy Dragon', 18.93)\n",
353 | "(122, 'Super Bear', 8.0)\n",
354 | "(123, 'Magic Train', 18.42)\n",
355 | "(124, 'Wonder Car', 17.26)\n",
356 | "(125, 'Wonder Train', 19.56)\n",
357 | "(126, 'Wonder Car', 10.46)\n",
358 | "(127, 'Mighty Dragon', 16.01)\n",
359 | "(128, 'Happy Train', 10.52)\n",
360 | "(129, 'Wonder Dragon', 10.62)\n",
361 | "(130, 'Magic Car', 6.67)\n",
362 | "(131, 'Happy Dragon', 15.48)\n",
363 | "(132, 'Crazy Car', 12.71)\n",
364 | "(133, 'Happy Bear', 19.65)\n",
365 | "(134, 'Happy Dragon', 11.97)\n",
366 | "(135, 'Happy Robot', 19.69)\n",
367 | "(136, 'Mighty Car', 18.93)\n",
368 | "(137, 'Super Robot', 14.04)\n",
369 | "(138, 'Wonder Doll', 7.34)\n",
370 | "(139, 'Wonder Train', 16.13)\n",
371 | "(140, 'Mighty Bear', 10.0)\n",
372 | "(141, 'Super Train', 15.42)\n",
373 | "(142, 'Happy Doll', 12.39)\n",
374 | "(143, 'Mighty Train', 14.37)\n",
375 | "(144, 'Crazy Doll', 9.55)\n",
376 | "(145, 'Mighty Train', 9.95)\n",
377 | "(146, 'Mighty Train', 16.39)\n",
378 | "(147, 'Magic Car', 16.25)\n",
379 | "(148, 'Crazy Car', 18.94)\n",
380 | "(149, 'Crazy Train', 19.84)\n",
381 | "(150, 'Happy Train', 18.49)\n",
382 | "(151, 'Crazy Doll', 19.23)\n",
383 | "(152, 'Crazy Robot', 7.22)\n",
384 | "(153, 'Super Robot', 9.27)\n",
385 | "(154, 'Super Bear', 8.7)\n",
386 | "(155, 'Magic Doll', 18.75)\n",
387 | "(156, 'Magic Robot', 19.37)\n",
388 | "(157, 'Happy Doll', 7.03)\n",
389 | "(158, 'Super Robot', 6.63)\n",
390 | "(159, 'Magic Car', 12.94)\n",
391 | "(160, 'Mighty Dragon', 8.21)\n",
392 | "(161, 'Mighty Robot', 5.64)\n",
393 | "(162, 'Super Train', 13.9)\n",
394 | "(163, 'Wonder Robot', 13.91)\n",
395 | "(164, 'Crazy Doll', 13.78)\n",
396 | "(165, 'Happy Bear', 11.87)\n",
397 | "(166, 'Mighty Train', 12.79)\n",
398 | "(167, 'Happy Doll', 17.85)\n",
399 | "(168, 'Crazy Train', 14.72)\n",
400 | "(169, 'Mighty Bear', 8.97)\n",
401 | "(170, 'Magic Bear', 6.76)\n",
402 | "(171, 'Magic Bear', 15.78)\n",
403 | "(172, 'Super Robot', 14.21)\n",
404 | "(173, 'Magic Doll', 5.03)\n",
405 | "(174, 'Mighty Robot', 18.13)\n",
406 | "(175, 'Super Bear', 5.27)\n",
407 | "(176, 'Super Train', 8.84)\n",
408 | "(177, 'Wonder Train', 10.28)\n",
409 | "(178, 'Super Doll', 10.32)\n",
410 | "(179, 'Happy Car', 14.27)\n",
411 | "(180, 'Happy Train', 6.46)\n",
412 | "(181, 'Crazy Robot', 13.58)\n",
413 | "(182, 'Wonder Dragon', 16.66)\n",
414 | "(183, 'Super Robot', 11.53)\n",
415 | "(184, 'Super Doll', 11.9)\n",
416 | "(185, 'Super Train', 15.34)\n",
417 | "(186, 'Mighty Robot', 16.18)\n",
418 | "(187, 'Magic Bear', 14.76)\n",
419 | "(188, 'Super Dragon', 17.32)\n",
420 | "(189, 'Wonder Bear', 10.26)\n",
421 | "(190, 'Mighty Doll', 5.71)\n",
422 | "(191, 'Mighty Dragon', 13.01)\n",
423 | "(192, 'Magic Robot', 13.78)\n",
424 | "(193, 'Happy Robot', 15.3)\n",
425 | "(194, 'Super Car', 8.5)\n",
426 | "(195, 'Wonder Bear', 5.26)\n",
427 | "(196, 'Super Robot', 11.63)\n",
428 | "(197, 'Crazy Robot', 8.45)\n",
429 | "(198, 'Super Car', 9.89)\n",
430 | "(199, 'Mighty Dragon', 17.04)\n",
431 | "(200, 'Wonder Bear', 12.1)\n",
432 | "(201, 'Wonder Train', 11.26)\n",
433 | "(202, 'Wonder Dragon', 15.73)\n",
434 | "(203, 'Super Dragon', 5.13)\n",
435 | "(204, 'Wonder Car', 8.65)\n",
436 | "(205, 'Mighty Bear', 16.64)\n",
437 | "(206, 'Super Robot', 8.86)\n",
438 | "(207, 'Crazy Doll', 12.86)\n",
439 | "(208, 'Magic Car', 19.88)\n",
440 | "(209, 'Crazy Bear', 11.3)\n",
441 | "(210, 'Wonder Train', 16.26)\n",
442 | "(211, 'Wonder Robot', 15.37)\n",
443 | "(212, 'Happy Train', 7.43)\n",
444 | "(213, 'Happy Robot', 5.35)\n",
445 | "(214, 'Super Train', 15.33)\n",
446 | "(215, 'Magic Doll', 5.51)\n",
447 | "(216, 'Mighty Car', 12.56)\n",
448 | "(217, 'Magic Car', 16.31)\n",
449 | "(218, 'Wonder Robot', 6.41)\n",
450 | "(219, 'Wonder Dragon', 9.56)\n",
451 | "(220, 'Mighty Car', 19.68)\n",
452 | "(221, 'Mighty Car', 5.77)\n",
453 | "(222, 'Wonder Robot', 14.23)\n",
454 | "(223, 'Happy Bear', 7.1)\n",
455 | "(224, 'Magic Car', 6.74)\n",
456 | "(225, 'Wonder Train', 6.42)\n",
457 | "(226, 'Happy Car', 7.12)\n",
458 | "(227, 'Crazy Car', 15.95)\n",
459 | "(228, 'Crazy Train', 13.47)\n",
460 | "(229, 'Wonder Car', 6.26)\n",
461 | "(230, 'Crazy Dragon', 17.87)\n",
462 | "(231, 'Magic Dragon', 7.92)\n",
463 | "(232, 'Happy Bear', 16.95)\n",
464 | "(233, 'Happy Dragon', 16.09)\n",
465 | "(234, 'Magic Bear', 7.89)\n",
466 | "(235, 'Mighty Car', 16.7)\n",
467 | "(236, 'Magic Bear', 14.47)\n",
468 | "(237, 'Wonder Car', 7.8)\n",
469 | "(238, 'Super Train', 10.75)\n",
470 | "(239, 'Magic Bear', 7.3)\n",
471 | "(240, 'Wonder Train', 10.74)\n",
472 | "(241, 'Super Doll', 14.02)\n",
473 | "(242, 'Super Bear', 18.5)\n",
474 | "(243, 'Happy Doll', 8.78)\n",
475 | "(244, 'Super Bear', 11.93)\n",
476 | "(245, 'Mighty Car', 17.84)\n",
477 | "(246, 'Mighty Bear', 9.39)\n",
478 | "(247, 'Crazy Robot', 19.4)\n",
479 | "(248, 'Crazy Train', 6.03)\n",
480 | "(249, 'Magic Doll', 6.74)\n",
481 | "(250, 'Magic Bear', 18.44)\n",
482 | "(251, 'Wonder Doll', 11.73)\n",
483 | "(252, 'Crazy Robot', 15.23)\n",
484 | "(253, 'Wonder Car', 9.65)\n",
485 | "(254, 'Mighty Bear', 16.84)\n",
486 | "(255, 'Wonder Robot', 5.94)\n",
487 | "(256, 'Super Car', 15.14)\n",
488 | "(257, 'Magic Bear', 7.92)\n",
489 | "(258, 'Mighty Train', 6.98)\n",
490 | "(259, 'Wonder Doll', 15.0)\n",
491 | "(260, 'Super Robot', 7.04)\n",
492 | "(261, 'Wonder Robot', 9.8)\n",
493 | "(262, 'Wonder Train', 16.61)\n",
494 | "(263, 'Happy Bear', 8.55)\n",
495 | "(264, 'Magic Doll', 7.31)\n",
496 | "(265, 'Mighty Bear', 5.99)\n",
497 | "(266, 'Crazy Robot', 19.26)\n",
498 | "(267, 'Happy Train', 7.29)\n",
499 | "(268, 'Mighty Doll', 17.51)\n",
500 | "(269, 'Mighty Dragon', 16.62)\n",
501 | "(270, 'Super Car', 12.98)\n",
502 | "(271, 'Wonder Car', 17.63)\n",
503 | "(272, 'Happy Bear', 10.4)\n",
504 | "(273, 'Crazy Bear', 15.89)\n",
505 | "(274, 'Super Train', 8.94)\n",
506 | "(275, 'Magic Robot', 5.47)\n",
507 | "(276, 'Super Robot', 8.4)\n",
508 | "(277, 'Happy Robot', 16.9)\n",
509 | "(278, 'Mighty Train', 15.69)\n",
510 | "(279, 'Mighty Car', 19.63)\n",
511 | "(280, 'Magic Bear', 11.95)\n",
512 | "(281, 'Crazy Train', 19.07)\n",
513 | "(282, 'Magic Dragon', 7.53)\n",
514 | "(283, 'Crazy Robot', 13.66)\n",
515 | "(284, 'Crazy Train', 15.58)\n",
516 | "(285, 'Super Car', 5.08)\n",
517 | "(286, 'Wonder Robot', 13.74)\n",
518 | "(287, 'Super Doll', 18.43)\n",
519 | "(288, 'Magic Bear', 6.96)\n",
520 | "(289, 'Happy Robot', 8.08)\n",
521 | "(290, 'Happy Dragon', 6.7)\n",
522 | "(291, 'Wonder Doll', 9.61)\n",
523 | "(292, 'Super Dragon', 15.99)\n",
524 | "(293, 'Happy Robot', 9.31)\n",
525 | "(294, 'Super Bear', 10.27)\n",
526 | "(295, 'Mighty Train', 15.33)\n",
527 | "(296, 'Mighty Train', 9.75)\n",
528 | "(297, 'Crazy Car', 19.4)\n",
529 | "(298, 'Super Bear', 13.6)\n",
530 | "(299, 'Super Train', 11.79)\n",
531 | "(300, 'Mighty Dragon', 15.05)\n",
532 | "(301, 'Crazy Train', 18.43)\n",
533 | "(302, 'Crazy Car', 7.56)\n",
534 | "(303, 'Magic Car', 13.83)\n",
535 | "(304, 'Super Doll', 12.33)\n",
536 | "(305, 'Mighty Car', 7.03)\n",
537 | "(306, 'Magic Dragon', 11.6)\n",
538 | "(307, 'Super Doll', 10.44)\n",
539 | "(308, 'Super Train', 9.8)\n",
540 | "(309, 'Mighty Train', 14.85)\n",
541 | "(310, 'Magic Dragon', 15.32)\n",
542 | "(311, 'Magic Robot', 6.56)\n",
543 | "(312, 'Crazy Doll', 10.18)\n",
544 | "(313, 'Super Train', 6.94)\n",
545 | "(314, 'Crazy Train', 14.19)\n",
546 | "(315, 'Magic Bear', 18.35)\n",
547 | "(316, 'Happy Train', 12.97)\n",
548 | "(317, 'Crazy Doll', 8.88)\n",
549 | "(318, 'Mighty Bear', 8.51)\n",
550 | "(319, 'Mighty Train', 17.48)\n",
551 | "(320, 'Happy Robot', 17.92)\n",
552 | "(321, 'Wonder Car', 10.36)\n",
553 | "(322, 'Mighty Train', 19.82)\n",
554 | "(323, 'Super Doll', 7.07)\n",
555 | "(324, 'Happy Robot', 6.95)\n",
556 | "(325, 'Crazy Train', 7.01)\n",
557 | "(326, 'Magic Dragon', 6.67)\n",
558 | "(327, 'Crazy Dragon', 5.66)\n",
559 | "(328, 'Crazy Dragon', 14.98)\n",
560 | "(329, 'Super Dragon', 10.31)\n",
561 | "(330, 'Magic Bear', 7.2)\n",
562 | "(331, 'Happy Car', 17.91)\n",
563 | "(332, 'Crazy Dragon', 9.36)\n",
564 | "(333, 'Wonder Dragon', 8.37)\n",
565 | "(334, 'Wonder Train', 6.27)\n",
566 | "(335, 'Mighty Robot', 6.92)\n",
567 | "(336, 'Happy Bear', 8.19)\n",
568 | "(337, 'Wonder Doll', 18.36)\n",
569 | "(338, 'Mighty Dragon', 15.89)\n",
570 | "(339, 'Happy Robot', 17.34)\n",
571 | "(340, 'Wonder Robot', 14.74)\n",
572 | "(341, 'Super Train', 16.04)\n",
573 | "(342, 'Wonder Dragon', 12.09)\n",
574 | "(343, 'Happy Doll', 12.01)\n",
575 | "(344, 'Crazy Doll', 11.73)\n",
576 | "(345, 'Magic Bear', 5.46)\n",
577 | "(346, 'Crazy Bear', 6.77)\n",
578 | "(347, 'Super Train', 6.65)\n",
579 | "(348, 'Happy Bear', 17.59)\n",
580 | "(349, 'Mighty Robot', 17.76)\n",
581 | "(350, 'Wonder Train', 7.14)\n",
582 | "(351, 'Happy Bear', 13.61)\n",
583 | "(352, 'Super Bear', 15.39)\n",
584 | "(353, 'Super Dragon', 7.82)\n",
585 | "(354, 'Super Car', 19.29)\n",
586 | "(355, 'Super Car', 19.84)\n",
587 | "(356, 'Mighty Car', 11.74)\n",
588 | "(357, 'Crazy Car', 12.03)\n",
589 | "(358, 'Wonder Car', 16.27)\n",
590 | "(359, 'Wonder Dragon', 18.37)\n",
591 | "(360, 'Happy Doll', 5.97)\n",
592 | "(361, 'Happy Robot', 6.83)\n",
593 | "(362, 'Magic Train', 11.31)\n",
594 | "(363, 'Mighty Dragon', 12.95)\n",
595 | "(364, 'Mighty Robot', 14.82)\n",
596 | "(365, 'Happy Train', 6.32)\n",
597 | "(366, 'Super Doll', 5.15)\n",
598 | "(367, 'Magic Doll', 5.47)\n",
599 | "(368, 'Wonder Car', 11.3)\n",
600 | "(369, 'Happy Bear', 8.71)\n",
601 | "(370, 'Mighty Bear', 9.8)\n",
602 | "(371, 'Super Bear', 13.5)\n",
603 | "(372, 'Super Bear', 16.52)\n",
604 | "(373, 'Mighty Bear', 11.32)\n",
605 | "(374, 'Super Bear', 6.98)\n",
606 | "(375, 'Super Train', 17.9)\n",
607 | "(376, 'Crazy Dragon', 8.3)\n",
608 | "(377, 'Crazy Robot', 14.19)\n",
609 | "(378, 'Happy Dragon', 19.25)\n",
610 | "(379, 'Magic Robot', 17.84)\n",
611 | "(380, 'Crazy Dragon', 12.64)\n",
612 | "(381, 'Wonder Train', 13.32)\n",
613 | "(382, 'Happy Car', 15.07)\n",
614 | "(383, 'Magic Doll', 16.4)\n",
615 | "(384, 'Super Train', 12.15)\n",
616 | "(385, 'Magic Dragon', 9.3)\n",
617 | "(386, 'Crazy Bear', 10.09)\n",
618 | "(387, 'Mighty Dragon', 15.43)\n",
619 | "(388, 'Super Car', 7.7)\n",
620 | "(389, 'Mighty Dragon', 12.42)\n",
621 | "(390, 'Mighty Train', 10.36)\n",
622 | "(391, 'Magic Doll', 16.91)\n",
623 | "(392, 'Wonder Train', 6.44)\n",
624 | "(393, 'Magic Doll', 8.73)\n",
625 | "(394, 'Wonder Car', 5.45)\n",
626 | "(395, 'Happy Bear', 9.94)\n",
627 | "(396, 'Mighty Train', 15.69)\n",
628 | "(397, 'Super Doll', 9.41)\n",
629 | "(398, 'Mighty Bear', 19.33)\n",
630 | "(399, 'Mighty Dragon', 19.33)\n",
631 | "(400, 'Wonder Car', 9.11)\n",
632 | "(401, 'Happy Doll', 9.65)\n",
633 | "(402, 'Happy Doll', 11.55)\n",
634 | "(403, 'Magic Car', 13.99)\n",
635 | "(404, 'Wonder Bear', 5.36)\n",
636 | "(405, 'Crazy Bear', 9.43)\n",
637 | "(406, 'Super Doll', 13.19)\n",
638 | "(407, 'Crazy Car', 13.17)\n",
639 | "(408, 'Happy Doll', 10.79)\n",
640 | "(409, 'Super Doll', 5.65)\n",
641 | "(410, 'Mighty Doll', 14.97)\n",
642 | "(411, 'Wonder Dragon', 7.14)\n",
643 | "(412, 'Wonder Robot', 19.83)\n",
644 | "(413, 'Super Bear', 16.7)\n",
645 | "(414, 'Happy Dragon', 11.34)\n",
646 | "(415, 'Magic Doll', 15.48)\n",
647 | "(416, 'Happy Dragon', 10.15)\n",
648 | "(417, 'Mighty Car', 12.27)\n",
649 | "(418, 'Magic Robot', 9.74)\n",
650 | "(419, 'Super Robot', 9.69)\n",
651 | "(420, 'Wonder Dragon', 12.74)\n",
652 | "(421, 'Wonder Robot', 8.99)\n",
653 | "(422, 'Mighty Car', 19.67)\n",
654 | "(423, 'Mighty Car', 9.13)\n",
655 | "(424, 'Happy Train', 8.87)\n",
656 | "(425, 'Mighty Train', 12.29)\n",
657 | "(426, 'Happy Dragon', 5.73)\n",
658 | "(427, 'Crazy Train', 5.44)\n",
659 | "(428, 'Happy Car', 5.83)\n",
660 | "(429, 'Super Doll', 11.15)\n",
661 | "(430, 'Mighty Doll', 8.27)\n",
662 | "(431, 'Wonder Dragon', 8.3)\n",
663 | "(432, 'Wonder Train', 5.93)\n",
664 | "(433, 'Super Bear', 10.45)\n",
665 | "(434, 'Mighty Dragon', 6.53)\n",
666 | "(435, 'Crazy Robot', 19.29)\n",
667 | "(436, 'Mighty Car', 13.87)\n",
668 | "(437, 'Happy Car', 16.62)\n",
669 | "(438, 'Mighty Train', 7.94)\n",
670 | "(439, 'Wonder Train', 6.92)\n",
671 | "(440, 'Crazy Train', 9.67)\n",
672 | "(441, 'Wonder Doll', 13.09)\n",
673 | "(442, 'Happy Dragon', 6.91)\n",
674 | "(443, 'Super Doll', 19.05)\n",
675 | "(444, 'Crazy Dragon', 13.43)\n",
676 | "(445, 'Mighty Train', 8.86)\n",
677 | "(446, 'Crazy Car', 10.14)\n",
678 | "(447, 'Super Doll', 12.35)\n",
679 | "(448, 'Happy Car', 9.8)\n",
680 | "(449, 'Super Robot', 14.37)\n",
681 | "(450, 'Super Train', 13.05)\n",
682 | "(451, 'Wonder Train', 5.68)\n",
683 | "(452, 'Crazy Doll', 17.98)\n",
684 | "(453, 'Super Robot', 5.38)\n",
685 | "(454, 'Wonder Bear', 11.42)\n",
686 | "(455, 'Wonder Doll', 12.3)\n",
687 | "(456, 'Wonder Bear', 11.55)\n",
688 | "(457, 'Magic Bear', 8.79)\n",
689 | "(458, 'Wonder Train', 13.81)\n",
690 | "(459, 'Happy Bear', 11.73)\n",
691 | "(460, 'Mighty Robot', 19.44)\n",
692 | "(461, 'Mighty Robot', 6.99)\n",
693 | "(462, 'Magic Dragon', 14.21)\n",
694 | "(463, 'Mighty Doll', 7.82)\n",
695 | "(464, 'Wonder Dragon', 19.3)\n",
696 | "(465, 'Crazy Robot', 17.6)\n",
697 | "(466, 'Happy Dragon', 5.59)\n",
698 | "(467, 'Crazy Doll', 13.78)\n",
699 | "(468, 'Happy Doll', 7.87)\n",
700 | "(469, 'Crazy Bear', 7.65)\n",
701 | "(470, 'Crazy Dragon', 7.08)\n",
702 | "(471, 'Wonder Train', 5.59)\n",
703 | "(472, 'Crazy Robot', 12.15)\n",
704 | "(473, 'Wonder Train', 10.34)\n",
705 | "(474, 'Magic Train', 18.58)\n",
706 | "(475, 'Crazy Doll', 18.83)\n",
707 | "(476, 'Crazy Car', 5.43)\n",
708 | "(477, 'Wonder Dragon', 15.15)\n",
709 | "(478, 'Happy Doll', 16.17)\n",
710 | "(479, 'Happy Bear', 6.42)\n",
711 | "(480, 'Happy Dragon', 9.46)\n",
712 | "(481, 'Super Car', 19.69)\n",
713 | "(482, 'Mighty Bear', 9.29)\n",
714 | "(483, 'Mighty Train', 16.41)\n",
715 | "(484, 'Magic Train', 13.38)\n",
716 | "(485, 'Happy Dragon', 11.57)\n",
717 | "(486, 'Crazy Doll', 9.18)\n",
718 | "(487, 'Super Car', 9.66)\n",
719 | "(488, 'Magic Car', 9.78)\n",
720 | "(489, 'Super Robot', 7.4)\n",
721 | "(490, 'Magic Train', 10.11)\n",
722 | "(491, 'Mighty Bear', 9.19)\n",
723 | "(492, 'Crazy Train', 7.39)\n",
724 | "(493, 'Magic Train', 9.46)\n",
725 | "(494, 'Wonder Bear', 10.15)\n",
726 | "(495, 'Wonder Bear', 11.54)\n",
727 | "(496, 'Happy Car', 13.46)\n",
728 | "(497, 'Magic Dragon', 13.49)\n",
729 | "(498, 'Crazy Dragon', 18.69)\n",
730 | "(499, 'Mighty Doll', 8.77)\n",
731 | "(500, 'Crazy Car', 14.01)\n",
732 | "(501, 'Wonder Train', 8.08)\n",
733 | "(502, 'Mighty Train', 5.42)\n",
734 | "(503, 'Crazy Car', 14.15)\n",
735 | "(504, 'Mighty Robot', 14.23)\n",
736 | "(505, 'Happy Robot', 6.07)\n",
737 | "(506, 'Super Train', 5.8)\n",
738 | "(507, 'Mighty Car', 7.44)\n",
739 | "(508, 'Wonder Robot', 8.82)\n",
740 | "(509, 'Wonder Car', 16.6)\n",
741 | "(510, 'Mighty Car', 8.44)\n",
742 | "(511, 'Wonder Train', 15.81)\n",
743 | "(512, 'Super Dragon', 15.54)\n",
744 | "(513, 'Crazy Dragon', 16.37)\n",
745 | "(514, 'Happy Robot', 7.24)\n",
746 | "(515, 'Wonder Bear', 10.66)\n",
747 | "(516, 'Crazy Dragon', 17.08)\n",
748 | "(517, 'Magic Train', 16.85)\n",
749 | "(518, 'Wonder Train', 8.36)\n",
750 | "(519, 'Magic Robot', 14.17)\n",
751 | "(520, 'Happy Dragon', 10.02)\n",
752 | "(521, 'Magic Car', 15.88)\n",
753 | "(522, 'Happy Dragon', 17.27)\n",
754 | "(523, 'Crazy Doll', 5.29)\n",
755 | "(524, 'Mighty Car', 14.67)\n",
756 | "(525, 'Super Dragon', 17.54)\n",
757 | "(526, 'Crazy Robot', 10.73)\n",
758 | "(527, 'Wonder Robot', 14.21)\n",
759 | "(528, 'Happy Train', 17.11)\n",
760 | "(529, 'Wonder Train', 13.28)\n",
761 | "(530, 'Crazy Bear', 7.83)\n",
762 | "(531, 'Super Robot', 17.63)\n",
763 | "(532, 'Magic Bear', 18.66)\n",
764 | "(533, 'Mighty Robot', 15.78)\n",
765 | "(534, 'Wonder Car', 12.32)\n",
766 | "(535, 'Magic Robot', 18.88)\n",
767 | "(536, 'Mighty Dragon', 8.29)\n",
768 | "(537, 'Crazy Car', 18.27)\n",
769 | "(538, 'Super Doll', 14.01)\n",
770 | "(539, 'Happy Train', 11.18)\n",
771 | "(540, 'Crazy Train', 17.65)\n",
772 | "(541, 'Mighty Train', 5.9)\n",
773 | "(542, 'Wonder Doll', 10.46)\n",
774 | "(543, 'Super Dragon', 6.87)\n",
775 | "(544, 'Wonder Dragon', 14.48)\n",
776 | "(545, 'Super Doll', 5.97)\n",
777 | "(546, 'Crazy Train', 19.69)\n",
778 | "(547, 'Crazy Bear', 12.77)\n",
779 | "(548, 'Wonder Train', 18.07)\n",
780 | "(549, 'Crazy Train', 11.68)\n",
781 | "(550, 'Magic Car', 7.78)\n",
782 | "(551, 'Super Doll', 13.68)\n",
783 | "(552, 'Mighty Dragon', 8.49)\n",
784 | "(553, 'Wonder Train', 19.11)\n",
785 | "(554, 'Mighty Robot', 7.07)\n",
786 | "(555, 'Crazy Train', 16.51)\n",
787 | "(556, 'Wonder Car', 14.45)\n",
788 | "(557, 'Magic Robot', 12.06)\n",
789 | "(558, 'Crazy Robot', 8.52)\n",
790 | "(559, 'Super Robot', 11.79)\n",
791 | "(560, 'Happy Train', 15.52)\n",
792 | "(561, 'Super Doll', 18.64)\n",
793 | "(562, 'Wonder Dragon', 14.81)\n",
794 | "(563, 'Magic Robot', 18.89)\n",
795 | "(564, 'Happy Train', 14.3)\n",
796 | "(565, 'Wonder Train', 13.3)\n",
797 | "(566, 'Wonder Car', 15.57)\n",
798 | "(567, 'Wonder Car', 14.99)\n",
799 | "(568, 'Mighty Car', 15.14)\n",
800 | "(569, 'Super Train', 17.97)\n",
801 | "(570, 'Wonder Dragon', 7.38)\n",
802 | "(571, 'Happy Train', 11.9)\n",
803 | "(572, 'Wonder Doll', 10.34)\n",
804 | "(573, 'Super Dragon', 16.63)\n",
805 | "(574, 'Wonder Car', 17.55)\n",
806 | "(575, 'Happy Bear', 8.53)\n",
807 | "(576, 'Magic Doll', 6.49)\n",
808 | "(577, 'Magic Robot', 12.69)\n",
809 | "(578, 'Super Train', 9.08)\n",
810 | "(579, 'Mighty Train', 15.32)\n",
811 | "(580, 'Super Dragon', 11.76)\n",
812 | "(581, 'Crazy Car', 5.77)\n",
813 | "(582, 'Magic Bear', 6.43)\n",
814 | "(583, 'Crazy Robot', 6.6)\n",
815 | "(584, 'Mighty Bear', 10.05)\n",
816 | "(585, 'Wonder Dragon', 6.16)\n",
817 | "(586, 'Super Train', 10.94)\n",
818 | "(587, 'Mighty Doll', 17.18)\n",
819 | "(588, 'Magic Robot', 13.61)\n",
820 | "(589, 'Wonder Car', 15.94)\n",
821 | "(590, 'Magic Dragon', 6.53)\n",
822 | "(591, 'Wonder Train', 14.79)\n",
823 | "(592, 'Magic Robot', 8.36)\n",
824 | "(593, 'Happy Bear', 7.65)\n",
825 | "(594, 'Mighty Train', 5.06)\n",
826 | "(595, 'Crazy Robot', 15.51)\n",
827 | "(596, 'Wonder Car', 12.83)\n",
828 | "(597, 'Super Train', 16.5)\n",
829 | "(598, 'Wonder Train', 13.31)\n",
830 | "(599, 'Crazy Bear', 7.97)\n",
831 | "(600, 'Super Doll', 18.48)\n",
832 | "(601, 'Happy Car', 7.2)\n",
833 | "(602, 'Magic Dragon', 18.71)\n",
834 | "(603, 'Magic Doll', 18.51)\n",
835 | "(604, 'Magic Robot', 15.66)\n",
836 | "(605, 'Crazy Bear', 13.86)\n",
837 | "(606, 'Mighty Train', 5.58)\n",
838 | "(607, 'Magic Dragon', 16.89)\n",
839 | "(608, 'Mighty Train', 16.74)\n",
840 | "(609, 'Wonder Train', 7.48)\n",
841 | "(610, 'Crazy Car', 9.49)\n",
842 | "(611, 'Crazy Bear', 15.89)\n",
843 | "(612, 'Mighty Dragon', 14.3)\n",
844 | "(613, 'Super Car', 14.19)\n",
845 | "(614, 'Happy Doll', 8.21)\n",
846 | "(615, 'Wonder Doll', 15.01)\n",
847 | "(616, 'Super Car', 13.57)\n",
848 | "(617, 'Crazy Bear', 19.12)\n",
849 | "(618, 'Happy Train', 6.58)\n",
850 | "(619, 'Magic Bear', 19.28)\n",
851 | "(620, 'Crazy Car', 10.83)\n",
852 | "(621, 'Super Bear', 16.49)\n",
853 | "(622, 'Magic Robot', 14.7)\n",
854 | "(623, 'Crazy Train', 10.09)\n",
855 | "(624, 'Super Dragon', 15.8)\n",
856 | "(625, 'Happy Bear', 14.66)\n",
857 | "(626, 'Happy Dragon', 16.83)\n",
858 | "(627, 'Wonder Bear', 17.46)\n",
859 | "(628, 'Super Doll', 12.03)\n",
860 | "(629, 'Mighty Robot', 18.41)\n",
861 | "(630, 'Mighty Dragon', 14.14)\n",
862 | "(631, 'Magic Dragon', 15.98)\n",
863 | "(632, 'Happy Car', 13.02)\n",
864 | "(633, 'Wonder Robot', 8.1)\n",
865 | "(634, 'Wonder Doll', 18.22)\n",
866 | "(635, 'Wonder Robot', 7.61)\n",
867 | "(636, 'Happy Car', 17.88)\n",
868 | "(637, 'Crazy Bear', 14.72)\n",
869 | "(638, 'Happy Doll', 13.44)\n",
870 | "(639, 'Crazy Dragon', 18.54)\n",
871 | "(640, 'Wonder Bear', 5.06)\n",
872 | "(641, 'Happy Doll', 15.28)\n",
873 | "(642, 'Super Train', 17.9)\n",
874 | "(643, 'Crazy Doll', 16.26)\n",
875 | "(644, 'Super Dragon', 14.76)\n",
876 | "(645, 'Happy Dragon', 10.35)\n",
877 | "(646, 'Mighty Car', 17.49)\n",
878 | "(647, 'Crazy Train', 19.69)\n",
879 | "(648, 'Mighty Dragon', 15.97)\n",
880 | "(649, 'Crazy Car', 7.74)\n",
881 | "(650, 'Super Bear', 14.85)\n",
882 | "(651, 'Super Robot', 5.59)\n",
883 | "(652, 'Magic Bear', 17.09)\n",
884 | "(653, 'Happy Doll', 6.72)\n",
885 | "(654, 'Super Doll', 8.03)\n",
886 | "(655, 'Magic Car', 19.61)\n",
887 | "(656, 'Crazy Bear', 10.99)\n",
888 | "(657, 'Wonder Robot', 6.7)\n",
889 | "(658, 'Super Bear', 19.36)\n",
890 | "(659, 'Super Doll', 6.34)\n",
891 | "(660, 'Magic Car', 13.54)\n",
892 | "(661, 'Crazy Robot', 5.32)\n",
893 | "(662, 'Super Doll', 12.2)\n",
894 | "(663, 'Magic Bear', 11.18)\n",
895 | "(664, 'Magic Doll', 5.0)\n",
896 | "(665, 'Happy Bear', 12.56)\n",
897 | "(666, 'Happy Bear', 17.21)\n",
898 | "(667, 'Mighty Car', 16.39)\n",
899 | "(668, 'Happy Robot', 17.7)\n",
900 | "(669, 'Crazy Dragon', 18.87)\n",
901 | "(670, 'Mighty Dragon', 14.32)\n",
902 | "(671, 'Mighty Dragon', 12.16)\n",
903 | "(672, 'Mighty Dragon', 18.86)\n",
904 | "(673, 'Wonder Car', 15.73)\n",
905 | "(674, 'Magic Car', 8.48)\n",
906 | "(675, 'Crazy Dragon', 5.25)\n",
907 | "(676, 'Magic Robot', 8.36)\n",
908 | "(677, 'Magic Train', 7.68)\n",
909 | "(678, 'Wonder Bear', 11.74)\n",
910 | "(679, 'Super Bear', 8.1)\n",
911 | "(680, 'Super Car', 16.4)\n",
912 | "(681, 'Happy Dragon', 11.18)\n",
913 | "(682, 'Mighty Robot', 17.05)\n",
914 | "(683, 'Mighty Train', 9.57)\n",
915 | "(684, 'Mighty Train', 5.68)\n",
916 | "(685, 'Wonder Bear', 15.21)\n",
917 | "(686, 'Crazy Bear', 11.74)\n",
918 | "(687, 'Mighty Dragon', 16.14)\n",
919 | "(688, 'Mighty Dragon', 8.33)\n",
920 | "(689, 'Crazy Car', 5.8)\n",
921 | "(690, 'Crazy Dragon', 16.13)\n",
922 | "(691, 'Mighty Robot', 10.94)\n",
923 | "(692, 'Crazy Doll', 18.48)\n",
924 | "(693, 'Mighty Bear', 14.67)\n",
925 | "(694, 'Wonder Dragon', 5.24)\n",
926 | "(695, 'Super Robot', 6.23)\n",
927 | "(696, 'Magic Train', 13.92)\n",
928 | "(697, 'Crazy Doll', 7.5)\n",
929 | "(698, 'Super Train', 12.65)\n",
930 | "(699, 'Magic Robot', 15.35)\n",
931 | "(700, 'Crazy Car', 5.07)\n",
932 | "(701, 'Crazy Train', 16.98)\n",
933 | "(702, 'Super Robot', 7.08)\n",
934 | "(703, 'Crazy Train', 7.06)\n",
935 | "(704, 'Crazy Dragon', 19.36)\n",
936 | "(705, 'Wonder Doll', 11.16)\n",
937 | "(706, 'Magic Bear', 19.47)\n",
938 | "(707, 'Magic Train', 7.63)\n",
939 | "(708, 'Happy Robot', 13.41)\n",
940 | "(709, 'Mighty Robot', 13.28)\n",
941 | "(710, 'Magic Doll', 18.52)\n",
942 | "(711, 'Super Train', 8.66)\n",
943 | "(712, 'Mighty Doll', 10.22)\n",
944 | "(713, 'Happy Doll', 9.73)\n",
945 | "(714, 'Magic Robot', 7.62)\n",
946 | "(715, 'Super Car', 10.17)\n",
947 | "(716, 'Super Train', 13.88)\n",
948 | "(717, 'Super Car', 18.17)\n",
949 | "(718, 'Super Car', 7.91)\n",
950 | "(719, 'Happy Robot', 6.53)\n",
951 | "(720, 'Happy Car', 17.52)\n",
952 | "(721, 'Happy Doll', 7.56)\n",
953 | "(722, 'Crazy Bear', 18.4)\n",
954 | "(723, 'Wonder Train', 15.91)\n",
955 | "(724, 'Happy Doll', 14.49)\n",
956 | "(725, 'Wonder Robot', 19.94)\n",
957 | "(726, 'Wonder Car', 17.58)\n",
958 | "(727, 'Super Doll', 5.07)\n",
959 | "(728, 'Super Doll', 5.56)\n",
960 | "(729, 'Wonder Robot', 9.16)\n",
961 | "(730, 'Magic Robot', 16.38)\n",
962 | "(731, 'Magic Train', 17.97)\n",
963 | "(732, 'Magic Bear', 7.47)\n",
964 | "(733, 'Wonder Robot', 12.63)\n",
965 | "(734, 'Magic Bear', 12.88)\n",
966 | "(735, 'Mighty Robot', 10.69)\n",
967 | "(736, 'Mighty Robot', 13.3)\n",
968 | "(737, 'Magic Doll', 11.07)\n",
969 | "(738, 'Crazy Dragon', 8.31)\n",
970 | "(739, 'Magic Doll', 13.37)\n",
971 | "(740, 'Crazy Car', 7.87)\n",
972 | "(741, 'Happy Robot', 5.73)\n",
973 | "(742, 'Happy Robot', 10.32)\n",
974 | "(743, 'Magic Bear', 11.38)\n",
975 | "(744, 'Wonder Dragon', 13.24)\n",
976 | "(745, 'Crazy Doll', 8.03)\n",
977 | "(746, 'Super Train', 11.72)\n",
978 | "(747, 'Magic Robot', 18.67)\n",
979 | "(748, 'Super Dragon', 15.12)\n",
980 | "(749, 'Mighty Dragon', 7.2)\n",
981 | "(750, 'Happy Train', 6.67)\n",
982 | "(751, 'Mighty Robot', 17.53)\n",
983 | "(752, 'Mighty Doll', 16.83)\n",
984 | "(753, 'Mighty Bear', 13.33)\n",
985 | "(754, 'Happy Robot', 14.15)\n",
986 | "(755, 'Magic Doll', 5.75)\n",
987 | "(756, 'Magic Doll', 17.83)\n",
988 | "(757, 'Mighty Train', 15.73)\n",
989 | "(758, 'Mighty Robot', 13.04)\n",
990 | "(759, 'Magic Train', 11.54)\n",
991 | "(760, 'Mighty Robot', 12.92)\n",
992 | "(761, 'Crazy Doll', 6.24)\n",
993 | "(762, 'Crazy Robot', 8.75)\n",
994 | "(763, 'Magic Robot', 8.01)\n",
995 | "(764, 'Super Dragon', 7.5)\n",
996 | "(765, 'Magic Train', 7.46)\n",
997 | "(766, 'Super Train', 14.31)\n",
998 | "(767, 'Magic Bear', 11.7)\n",
999 | "(768, 'Crazy Bear', 12.75)\n",
1000 | "(769, 'Happy Bear', 7.6)\n",
1001 | "(770, 'Mighty Robot', 14.49)\n",
1002 | "(771, 'Magic Train', 10.71)\n",
1003 | "(772, 'Crazy Car', 14.12)\n",
1004 | "(773, 'Happy Train', 9.35)\n",
1005 | "(774, 'Happy Train', 15.33)\n",
1006 | "(775, 'Super Train', 6.3)\n",
1007 | "(776, 'Magic Doll', 14.43)\n",
1008 | "(777, 'Crazy Bear', 5.37)\n",
1009 | "(778, 'Mighty Dragon', 7.8)\n",
1010 | "(779, 'Crazy Dragon', 19.29)\n",
1011 | "(780, 'Mighty Robot', 13.82)\n",
1012 | "(781, 'Magic Bear', 18.74)\n",
1013 | "(782, 'Happy Car', 5.47)\n",
1014 | "(783, 'Happy Train', 13.03)\n",
1015 | "(784, 'Super Robot', 15.26)\n",
1016 | "(785, 'Crazy Car', 6.97)\n",
1017 | "(786, 'Happy Dragon', 10.67)\n",
1018 | "(787, 'Mighty Doll', 6.75)\n",
1019 | "(788, 'Wonder Bear', 15.57)\n",
1020 | "(789, 'Magic Robot', 16.76)\n",
1021 | "(790, 'Happy Robot', 10.07)\n",
1022 | "(791, 'Crazy Doll', 14.56)\n",
1023 | "(792, 'Crazy Dragon', 7.41)\n",
1024 | "(793, 'Mighty Train', 8.82)\n",
1025 | "(794, 'Crazy Robot', 12.69)\n",
1026 | "(795, 'Magic Doll', 12.78)\n",
1027 | "(796, 'Magic Doll', 17.02)\n",
1028 | "(797, 'Happy Doll', 14.29)\n",
1029 | "(798, 'Super Doll', 12.83)\n",
1030 | "(799, 'Happy Doll', 10.27)\n",
1031 | "(800, 'Super Car', 6.48)\n",
1032 | "(801, 'Happy Car', 18.7)\n",
1033 | "(802, 'Super Car', 5.9)\n",
1034 | "(803, 'Happy Car', 16.08)\n",
1035 | "(804, 'Crazy Bear', 18.8)\n",
1036 | "(805, 'Wonder Bear', 13.06)\n",
1037 | "(806, 'Wonder Bear', 18.58)\n",
1038 | "(807, 'Crazy Car', 10.91)\n",
1039 | "(808, 'Happy Train', 5.42)\n",
1040 | "(809, 'Crazy Bear', 12.36)\n",
1041 | "(810, 'Magic Car', 11.7)\n",
1042 | "(811, 'Magic Car', 10.48)\n",
1043 | "(812, 'Super Dragon', 14.06)\n",
1044 | "(813, 'Happy Car', 6.67)\n",
1045 | "(814, 'Super Robot', 10.4)\n",
1046 | "(815, 'Crazy Dragon', 19.96)\n",
1047 | "(816, 'Wonder Robot', 9.84)\n",
1048 | "(817, 'Magic Train', 15.88)\n",
1049 | "(818, 'Super Robot', 8.78)\n",
1050 | "(819, 'Happy Dragon', 13.66)\n",
1051 | "(820, 'Crazy Bear', 15.82)\n",
1052 | "(821, 'Super Robot', 12.29)\n",
1053 | "(822, 'Super Robot', 7.96)\n",
1054 | "(823, 'Super Bear', 6.2)\n",
1055 | "(824, 'Magic Dragon', 12.06)\n",
1056 | "(825, 'Happy Dragon', 14.39)\n",
1057 | "(826, 'Crazy Car', 12.37)\n",
1058 | "(827, 'Mighty Doll', 14.28)\n",
1059 | "(828, 'Super Robot', 8.2)\n",
1060 | "(829, 'Wonder Train', 13.22)\n",
1061 | "(830, 'Happy Bear', 17.78)\n",
1062 | "(831, 'Crazy Car', 10.92)\n",
1063 | "(832, 'Happy Train', 13.31)\n",
1064 | "(833, 'Magic Dragon', 17.32)\n",
1065 | "(834, 'Magic Robot', 16.85)\n",
1066 | "(835, 'Magic Car', 12.08)\n",
1067 | "(836, 'Super Doll', 19.51)\n",
1068 | "(837, 'Crazy Dragon', 13.19)\n",
1069 | "(838, 'Mighty Robot', 11.13)\n",
1070 | "(839, 'Magic Bear', 5.63)\n",
1071 | "(840, 'Happy Car', 7.24)\n",
1072 | "(841, 'Mighty Car', 14.46)\n",
1073 | "(842, 'Super Doll', 8.56)\n",
1074 | "(843, 'Super Bear', 5.35)\n",
1075 | "(844, 'Super Robot', 7.9)\n",
1076 | "(845, 'Wonder Train', 19.34)\n",
1077 | "(846, 'Happy Robot', 9.17)\n",
1078 | "(847, 'Crazy Bear', 17.44)\n",
1079 | "(848, 'Happy Doll', 11.74)\n",
1080 | "(849, 'Crazy Train', 19.68)\n",
1081 | "(850, 'Happy Doll', 5.68)\n",
1082 | "(851, 'Super Dragon', 10.41)\n",
1083 | "(852, 'Mighty Train', 18.7)\n",
1084 | "(853, 'Mighty Dragon', 14.73)\n",
1085 | "(854, 'Super Doll', 6.2)\n",
1086 | "(855, 'Happy Dragon', 18.6)\n",
1087 | "(856, 'Mighty Doll', 10.56)\n",
1088 | "(857, 'Crazy Dragon', 9.4)\n",
1089 | "(858, 'Crazy Doll', 17.51)\n",
1090 | "(859, 'Magic Train', 15.86)\n",
1091 | "(860, 'Magic Car', 6.66)\n",
1092 | "(861, 'Happy Bear', 15.73)\n",
1093 | "(862, 'Magic Train', 15.37)\n",
1094 | "(863, 'Mighty Train', 12.06)\n",
1095 | "(864, 'Mighty Car', 6.53)\n",
1096 | "(865, 'Super Robot', 12.82)\n",
1097 | "(866, 'Super Robot', 6.96)\n",
1098 | "(867, 'Mighty Car', 11.4)\n",
1099 | "(868, 'Crazy Bear', 17.39)\n",
1100 | "(869, 'Super Bear', 15.03)\n",
1101 | "(870, 'Happy Dragon', 16.09)\n",
1102 | "(871, 'Magic Robot', 11.19)\n",
1103 | "(872, 'Super Doll', 8.9)\n",
1104 | "(873, 'Super Robot', 5.17)\n",
1105 | "(874, 'Crazy Robot', 9.02)\n",
1106 | "(875, 'Magic Dragon', 10.28)\n",
1107 | "(876, 'Wonder Car', 6.05)\n",
1108 | "(877, 'Magic Dragon', 15.51)\n",
1109 | "(878, 'Magic Doll', 12.45)\n",
1110 | "(879, 'Mighty Bear', 14.11)\n",
1111 | "(880, 'Wonder Bear', 18.24)\n",
1112 | "(881, 'Happy Train', 6.71)\n",
1113 | "(882, 'Super Doll', 18.27)\n",
1114 | "(883, 'Happy Doll', 14.24)\n",
1115 | "(884, 'Wonder Doll', 19.61)\n",
1116 | "(885, 'Mighty Train', 17.74)\n",
1117 | "(886, 'Wonder Car', 18.97)\n",
1118 | "(887, 'Mighty Train', 9.72)\n",
1119 | "(888, 'Super Robot', 17.48)\n",
1120 | "(889, 'Happy Robot', 18.89)\n",
1121 | "(890, 'Mighty Dragon', 18.76)\n",
1122 | "(891, 'Mighty Dragon', 5.91)\n",
1123 | "(892, 'Wonder Train', 15.79)\n",
1124 | "(893, 'Magic Robot', 8.06)\n",
1125 | "(894, 'Wonder Doll', 19.35)\n",
1126 | "(895, 'Magic Dragon', 7.74)\n",
1127 | "(896, 'Crazy Car', 17.56)\n",
1128 | "(897, 'Happy Bear', 6.18)\n",
1129 | "(898, 'Magic Car', 18.18)\n",
1130 | "(899, 'Crazy Train', 5.53)\n",
1131 | "(900, 'Super Robot', 6.67)\n",
1132 | "(901, 'Super Robot', 16.23)\n",
1133 | "(902, 'Super Dragon', 17.68)\n",
1134 | "(903, 'Crazy Train', 10.81)\n",
1135 | "(904, 'Wonder Robot', 15.82)\n",
1136 | "(905, 'Super Robot', 16.8)\n",
1137 | "(906, 'Super Train', 7.28)\n",
1138 | "(907, 'Super Bear', 5.71)\n",
1139 | "(908, 'Magic Robot', 18.51)\n",
1140 | "(909, 'Magic Car', 13.87)\n",
1141 | "(910, 'Super Train', 9.7)\n",
1142 | "(911, 'Magic Robot', 7.53)\n",
1143 | "(912, 'Mighty Robot', 15.69)\n",
1144 | "(913, 'Super Doll', 5.27)\n",
1145 | "(914, 'Super Robot', 14.81)\n",
1146 | "(915, 'Magic Robot', 11.49)\n",
1147 | "(916, 'Super Bear', 12.11)\n",
1148 | "(917, 'Mighty Bear', 8.82)\n",
1149 | "(918, 'Magic Train', 7.67)\n",
1150 | "(919, 'Crazy Doll', 18.4)\n",
1151 | "(920, 'Mighty Car', 9.05)\n",
1152 | "(921, 'Happy Robot', 10.41)\n",
1153 | "(922, 'Magic Doll', 6.97)\n",
1154 | "(923, 'Wonder Doll', 7.48)\n",
1155 | "(924, 'Super Train', 15.2)\n",
1156 | "(925, 'Mighty Doll', 10.96)\n",
1157 | "(926, 'Super Doll', 18.47)\n",
1158 | "(927, 'Happy Bear', 9.78)\n",
1159 | "(928, 'Happy Bear', 13.03)\n",
1160 | "(929, 'Wonder Bear', 18.08)\n",
1161 | "(930, 'Wonder Dragon', 16.74)\n",
1162 | "(931, 'Mighty Robot', 17.86)\n",
1163 | "(932, 'Wonder Dragon', 17.54)\n",
1164 | "(933, 'Magic Car', 16.0)\n",
1165 | "(934, 'Crazy Car', 11.56)\n",
1166 | "(935, 'Wonder Doll', 10.07)\n",
1167 | "(936, 'Mighty Bear', 14.42)\n",
1168 | "(937, 'Magic Bear', 17.96)\n",
1169 | "(938, 'Wonder Car', 17.19)\n",
1170 | "(939, 'Wonder Bear', 13.85)\n",
1171 | "(940, 'Magic Doll', 18.3)\n",
1172 | "(941, 'Wonder Dragon', 13.76)\n",
1173 | "(942, 'Super Dragon', 16.75)\n",
1174 | "(943, 'Happy Robot', 19.42)\n",
1175 | "(944, 'Crazy Robot', 12.62)\n",
1176 | "(945, 'Crazy Robot', 16.47)\n",
1177 | "(946, 'Super Robot', 18.13)\n",
1178 | "(947, 'Crazy Bear', 19.88)\n",
1179 | "(948, 'Mighty Car', 11.23)\n",
1180 | "(949, 'Mighty Train', 18.49)\n",
1181 | "(950, 'Mighty Robot', 11.27)\n",
1182 | "(951, 'Happy Car', 11.42)\n",
1183 | "(952, 'Super Car', 19.25)\n",
1184 | "(953, 'Crazy Robot', 16.36)\n",
1185 | "(954, 'Crazy Car', 7.05)\n",
1186 | "(955, 'Magic Bear', 17.79)\n",
1187 | "(956, 'Mighty Dragon', 12.79)\n",
1188 | "(957, 'Mighty Bear', 7.38)\n",
1189 | "(958, 'Happy Train', 6.43)\n",
1190 | "(959, 'Mighty Car', 11.33)\n",
1191 | "(960, 'Magic Car', 15.36)\n",
1192 | "(961, 'Magic Robot', 11.17)\n",
1193 | "(962, 'Happy Bear', 9.43)\n",
1194 | "(963, 'Super Bear', 12.54)\n",
1195 | "(964, 'Super Doll', 17.08)\n",
1196 | "(965, 'Happy Bear', 16.5)\n",
1197 | "(966, 'Super Train', 14.5)\n",
1198 | "(967, 'Mighty Train', 16.07)\n",
1199 | "(968, 'Mighty Bear', 14.01)\n",
1200 | "(969, 'Super Dragon', 14.02)\n",
1201 | "(970, 'Crazy Robot', 17.42)\n",
1202 | "(971, 'Crazy Doll', 12.12)\n",
1203 | "(972, 'Super Train', 17.54)\n",
1204 | "(973, 'Super Dragon', 13.3)\n",
1205 | "(974, 'Wonder Car', 13.54)\n",
1206 | "(975, 'Magic Train', 8.72)\n",
1207 | "(976, 'Wonder Dragon', 15.27)\n",
1208 | "(977, 'Happy Car', 10.09)\n",
1209 | "(978, 'Crazy Doll', 17.46)\n",
1210 | "(979, 'Mighty Car', 10.04)\n",
1211 | "(980, 'Super Car', 6.87)\n",
1212 | "(981, 'Super Dragon', 5.92)\n",
1213 | "(982, 'Happy Dragon', 5.3)\n",
1214 | "(983, 'Crazy Robot', 17.98)\n",
1215 | "(984, 'Wonder Train', 19.07)\n",
1216 | "(985, 'Happy Robot', 6.03)\n",
1217 | "(986, 'Super Robot', 16.45)\n",
1218 | "(987, 'Crazy Car', 15.27)\n",
1219 | "(988, 'Mighty Robot', 6.8)\n",
1220 | "(989, 'Crazy Robot', 12.58)\n",
1221 | "(990, 'Happy Train', 5.16)\n",
1222 | "(991, 'Crazy Car', 13.54)\n",
1223 | "(992, 'Super Car', 9.08)\n",
1224 | "(993, 'Mighty Bear', 6.16)\n",
1225 | "(994, 'Wonder Doll', 9.16)\n",
1226 | "(995, 'Wonder Bear', 9.76)\n",
1227 | "(996, 'Super Robot', 11.43)\n",
1228 | "(997, 'Wonder Car', 11.37)\n",
1229 | "(998, 'Magic Doll', 6.49)\n",
1230 | "(999, 'Happy Bear', 7.8)\n",
1231 | "(1000, 'Crazy Robot', 18.17)\n",
1232 | "(1001, 'Mighty Robot', 8.77)\n",
1233 | "(1002, 'Magic Robot', 14.23)\n",
1234 | "(1003, 'Wonder Car', 14.24)\n",
1235 | "(1004, 'Wonder Train', 18.76)\n",
1236 | "(1005, 'Mighty Bear', 7.46)\n",
1237 | "(1006, 'Crazy Car', 13.17)\n",
1238 | "(1007, 'Wonder Bear', 13.71)\n",
1239 | "(1008, 'Magic Dragon', 18.83)\n",
1240 | "(1009, 'Wonder Bear', 18.73)\n",
1241 | "(1010, 'Super Doll', 18.94)\n",
1242 | "(1011, 'Wonder Robot', 10.81)\n",
1243 | "(1012, 'Magic Dragon', 8.08)\n",
1244 | "(1013, 'Magic Bear', 13.93)\n",
1245 | "(1014, 'Super Dragon', 17.43)\n",
1246 | "(1015, 'Magic Car', 7.59)\n",
1247 | "(1016, 'Super Robot', 6.27)\n",
1248 | "(1017, 'Magic Bear', 6.93)\n",
1249 | "(1018, 'Super Bear', 10.31)\n",
1250 | "(1019, 'Crazy Bear', 10.91)\n",
1251 | "(1020, 'Happy Train', 9.67)\n",
1252 | "(1021, 'Crazy Dragon', 16.99)\n",
1253 | "(1022, 'Mighty Car', 15.92)\n",
1254 | "(1023, 'Happy Dragon', 17.09)\n",
1255 | "(1024, 'Magic Bear', 18.88)\n",
1256 | "(1025, 'Crazy Train', 10.31)\n",
1257 | "(1026, 'Mighty Dragon', 18.74)\n",
1258 | "(1027, 'Super Robot', 5.42)\n",
1259 | "(1028, 'Happy Train', 12.2)\n",
1260 | "(1029, 'Magic Robot', 15.93)\n",
1261 | "(1030, 'Wonder Doll', 8.82)\n",
1262 | "(1031, 'Magic Car', 13.72)\n",
1263 | "(1032, 'Crazy Car', 12.84)\n",
1264 | "(1033, 'Super Doll', 8.36)\n",
1265 | "(1034, 'Mighty Car', 14.94)\n",
1266 | "(1035, 'Wonder Bear', 19.13)\n",
1267 | "(1036, 'Super Robot', 12.66)\n",
1268 | "(1037, 'Magic Train', 16.17)\n",
1269 | "(1038, 'Wonder Doll', 9.96)\n",
1270 | "(1039, 'Magic Bear', 17.89)\n",
1271 | "(1040, 'Happy Doll', 12.68)\n",
1272 | "(1041, 'Wonder Train', 15.09)\n",
1273 | "(1042, 'Super Bear', 9.74)\n",
1274 | "(1043, 'Crazy Bear', 17.13)\n",
1275 | "(1044, 'Mighty Robot', 14.39)\n",
1276 | "(1045, 'Happy Robot', 9.93)\n",
1277 | "(1046, 'Wonder Dragon', 6.76)\n",
1278 | "(1047, 'Happy Bear', 12.68)\n",
1279 | "(1048, 'Mighty Dragon', 13.38)\n",
1280 | "(1049, 'Happy Bear', 7.28)\n",
1281 | "(1050, 'Mighty Train', 7.47)\n",
1282 | "(1051, 'Super Doll', 16.48)\n",
1283 | "(1052, 'Happy Train', 7.8)\n",
1284 | "(1053, 'Happy Doll', 5.64)\n",
1285 | "(1054, 'Crazy Doll', 10.31)\n",
1286 | "(1055, 'Magic Dragon', 19.95)\n",
1287 | "(1056, 'Magic Dragon', 6.26)\n",
1288 | "(1057, 'Super Bear', 16.88)\n",
1289 | "(1058, 'Crazy Train', 7.11)\n",
1290 | "(1059, 'Magic Dragon', 11.98)\n",
1291 | "(1060, 'Mighty Robot', 15.0)\n",
1292 | "(1061, 'Crazy Train', 12.14)\n",
1293 | "(1062, 'Super Doll', 9.96)\n",
1294 | "(1063, 'Wonder Bear', 15.48)\n",
1295 | "(1064, 'Crazy Robot', 15.74)\n",
1296 | "(1065, 'Mighty Bear', 7.93)\n",
1297 | "(1066, 'Magic Doll', 10.72)\n",
1298 | "(1067, 'Wonder Train', 15.84)\n",
1299 | "(1068, 'Crazy Bear', 18.09)\n",
1300 | "(1069, 'Magic Robot', 13.74)\n",
1301 | "(1070, 'Wonder Bear', 9.46)\n",
1302 | "(1071, 'Happy Train', 17.08)\n",
1303 | "(1072, 'Mighty Bear', 11.76)\n",
1304 | "(1073, 'Super Robot', 8.49)\n",
1305 | "(1074, 'Magic Car', 10.92)\n",
1306 | "(1075, 'Super Bear', 10.8)\n",
1307 | "(1076, 'Super Robot', 10.77)\n",
1308 | "(1077, 'Crazy Doll', 5.76)\n",
1309 | "(1078, 'Wonder Doll', 12.49)\n",
1310 | "(1079, 'Super Robot', 11.31)\n",
1311 | "(1080, 'Magic Train', 6.94)\n",
1312 | "(1081, 'Wonder Train', 8.79)\n",
1313 | "(1082, 'Magic Dragon', 12.6)\n",
1314 | "(1083, 'Super Robot', 9.62)\n",
1315 | "(1084, 'Wonder Train', 12.42)\n",
1316 | "(1085, 'Happy Bear', 10.0)\n",
1317 | "(1086, 'Super Train', 9.19)\n",
1318 | "(1087, 'Super Bear', 7.68)\n",
1319 | "(1088, 'Wonder Dragon', 11.6)\n",
1320 | "(1089, 'Super Dragon', 10.7)\n",
1321 | "(1090, 'Mighty Bear', 14.44)\n",
1322 | "(1091, 'Super Dragon', 5.07)\n",
1323 | "(1092, 'Wonder Train', 15.42)\n",
1324 | "(1093, 'Super Car', 17.94)\n",
1325 | "(1094, 'Magic Train', 17.85)\n",
1326 | "(1095, 'Super Doll', 15.27)\n",
1327 | "(1096, 'Wonder Robot', 12.39)\n",
1328 | "(1097, 'Crazy Robot', 13.98)\n",
1329 | "(1098, 'Magic Car', 11.24)\n",
1330 | "(1099, 'Happy Robot', 15.08)\n",
1331 | "(1100, 'Wonder Dragon', 13.63)\n"
1332 | ]
1333 | }
1334 | ],
1335 | "source": [
1336 | "from utils import create_random_database\n",
1337 | "create_random_database()"
1338 | ]
1339 | },
1340 | {
1341 | "cell_type": "code",
1342 | "execution_count": 10,
1343 | "id": "2c24db79-d9bd-4850-861b-b246938e45a6",
1344 | "metadata": {
1345 | "height": 30
1346 | },
1347 | "outputs": [],
1348 | "source": [
1349 | "question = \"What is the most expensive item we currently sell?\""
1350 | ]
1351 | },
1352 | {
1353 | "cell_type": "code",
1354 | "execution_count": 11,
1355 | "id": "f0b9d650-daba-4374-a6d1-5d8f0a382a8f",
1356 | "metadata": {
1357 | "height": 455
1358 | },
1359 | "outputs": [
1360 | {
1361 | "name": "stdout",
1362 | "output_type": "stream",
1363 | "text": [
1364 | "LLM's function call: execute_sql(sql_code='SELECT name, price FROM toys ORDER BY price DESC LIMIT 1')\n"
1365 | ]
1366 | }
1367 | ],
1368 | "source": [
1369 | "from utils import execute_sql, query_raven\n",
1370 | "\n",
1371 | "schema = \\\n",
1372 | "\"\"\"\n",
1373 | "CREATE TABLE IF NOT EXISTS toys (\n",
1374 | " id INTEGER PRIMARY KEY,\n",
1375 | " name TEXT,\n",
1376 | " price REAL\n",
1377 | ");\n",
1378 | "\"\"\"\n",
1379 | "\n",
1380 | "raven_prompt = \\\n",
1381 | "f'''\n",
1382 | "Function:\n",
1383 | "def execute_sql(sql_code : str):\n",
1384 | " \"\"\"\n",
1385 | " Runs sql code for a company internal database\n",
1386 | " \"\"\"\n",
1387 | "\n",
1388 | "Schema: {schema}\n",
1389 | "User Query: {question}\n",
1390 | "'''\n",
1391 | "\n",
1392 | "output = query_raven(raven_prompt)\n",
1393 | "print (f\"LLM's function call: {output}\")\n",
1394 | "database_result = eval(output)"
1395 | ]
1396 | },
1397 | {
1398 | "cell_type": "code",
1399 | "execution_count": 12,
1400 | "id": "34109001-b30e-485a-a917-8639f5c6f241",
1401 | "metadata": {
1402 | "height": 217
1403 | },
1404 | "outputs": [
1405 | {
1406 | "name": "stdout",
1407 | "output_type": "stream",
1408 | "text": [
1409 | "The most expensive item we currently sell is the Crazy Dragon, which costs 19.96.\n"
1410 | ]
1411 | }
1412 | ],
1413 | "source": [
1414 | "full_prompt = \\\n",
1415 | "f\"\"\"\n",
1416 | " [INST]\n",
1417 | "{database_result}\n",
1418 | "\n",
1419 | "Use the information above to answer the following question concisely.\n",
1420 | "\n",
1421 | "Question:\n",
1422 | "{question} [/INST]\n",
1423 | "\"\"\"\n",
1424 | "grounded_response = query_raven(full_prompt)\n",
1425 | "print (grounded_response)"
1426 | ]
1427 | },
1428 | {
1429 | "cell_type": "markdown",
1430 | "id": "7ace25e8-4526-4b10-97e4-4829e6a561fa",
1431 | "metadata": {},
1432 | "source": [
1433 | "### Safer Interactions With Databases\n"
1434 | ]
1435 | },
1436 | {
1437 | "cell_type": "code",
1438 | "execution_count": 13,
1439 | "id": "554765e6-dcf4-4c79-b23e-3f78f0a2cf41",
1440 | "metadata": {
1441 | "height": 166
1442 | },
1443 | "outputs": [],
1444 | "source": [
1445 | "import sqlite3\n",
1446 | "import random\n",
1447 | "\n",
1448 | "# Internal database name setting\n",
1449 | "DB_NAME = 'toy_database.db'\n",
1450 | "\n",
1451 | "# Connect to the database\n",
1452 | "def connect_db():\n",
1453 | " return sqlite3.connect(DB_NAME)"
1454 | ]
1455 | },
1456 | {
1457 | "cell_type": "code",
1458 | "execution_count": 14,
1459 | "id": "58cfcc25-6324-46b4-9b69-dcce24106f66",
1460 | "metadata": {
1461 | "height": 115
1462 | },
1463 | "outputs": [],
1464 | "source": [
1465 | "# List all toys\n",
1466 | "def list_all_toys():\n",
1467 | " with connect_db() as conn:\n",
1468 | " cursor = conn.execute('SELECT * FROM toys')\n",
1469 | " return cursor.fetchall()\n"
1470 | ]
1471 | },
1472 | {
1473 | "cell_type": "code",
1474 | "execution_count": 15,
1475 | "id": "a0772168-ef5e-41bb-9181-0c38f896055d",
1476 | "metadata": {
1477 | "height": 132
1478 | },
1479 | "outputs": [],
1480 | "source": [
1481 | "# Find toy by name prefix\n",
1482 | "def find_toy_by_prefix(prefix):\n",
1483 | " with connect_db() as conn:\n",
1484 | " query = 'SELECT * FROM toys WHERE name LIKE ?'\n",
1485 | " cursor = conn.execute(query, (prefix + '%',))\n",
1486 | " return cursor.fetchall()\n"
1487 | ]
1488 | },
1489 | {
1490 | "cell_type": "code",
1491 | "execution_count": 16,
1492 | "id": "7cf610e1-6384-405c-a81c-00f1f8443008",
1493 | "metadata": {
1494 | "height": 115
1495 | },
1496 | "outputs": [],
1497 | "source": [
1498 | "# Find toys in a price range\n",
1499 | "def find_toys_in_price_range(low_price, high_price):\n",
1500 | " with connect_db() as conn:\n",
1501 | " query = 'SELECT * FROM toys WHERE price BETWEEN ? AND ?'\n",
1502 | " cursor = conn.execute(query, (low_price, high_price))\n",
1503 | " return cursor.fetchall()"
1504 | ]
1505 | },
1506 | {
1507 | "cell_type": "code",
1508 | "execution_count": 17,
1509 | "id": "76e38d51-88c1-45b3-aa92-99df03fa7b49",
1510 | "metadata": {
1511 | "height": 115
1512 | },
1513 | "outputs": [],
1514 | "source": [
1515 | "# Get a random selection of toys\n",
1516 | "def get_random_toys(count=5):\n",
1517 | " with connect_db() as conn:\n",
1518 | " cursor = conn.execute('SELECT * FROM toys')\n",
1519 | " all_toys = cursor.fetchall()\n",
1520 | " return random.sample(all_toys, min(count, len(all_toys)))"
1521 | ]
1522 | },
1523 | {
1524 | "cell_type": "code",
1525 | "execution_count": 18,
1526 | "id": "92a358df-c160-45ca-9b3e-e7c4602648c4",
1527 | "metadata": {
1528 | "height": 115
1529 | },
1530 | "outputs": [],
1531 | "source": [
1532 | "# Function to get the most expensive toy\n",
1533 | "def get_most_expensive_toy(count=1):\n",
1534 | " with connect_db() as conn:\n",
1535 | " cursor = conn.execute(f'SELECT * FROM toys ORDER BY price DESC LIMIT {count}')\n",
1536 | " return cursor.fetchone()\n"
1537 | ]
1538 | },
1539 | {
1540 | "cell_type": "code",
1541 | "execution_count": 19,
1542 | "id": "a625c123-0bb6-423d-b690-4851f6f70a80",
1543 | "metadata": {
1544 | "height": 98
1545 | },
1546 | "outputs": [],
1547 | "source": [
1548 | "# Function to get the cheapest toy\n",
1549 | "def get_cheapest_toy(count=1):\n",
1550 | " with connect_db() as conn:\n",
1551 | " cursor = conn.execute('SELECT * FROM toys ORDER BY price ASC LIMIT {count}')\n",
1552 | " return cursor.fetchone()"
1553 | ]
1554 | },
1555 | {
1556 | "cell_type": "code",
1557 | "execution_count": 20,
1558 | "id": "b507eb02-6779-4742-b0b2-48fb2fcaba1a",
1559 | "metadata": {
1560 | "height": 1050
1561 | },
1562 | "outputs": [
1563 | {
1564 | "name": "stdout",
1565 | "output_type": "stream",
1566 | "text": [
1567 | "get_most_expensive_toy(count=1)\n"
1568 | ]
1569 | }
1570 | ],
1571 | "source": [
1572 | "raven_prompt = \\\n",
1573 | "f'''\n",
1574 | "Function:\n",
1575 | "def list_all_toys():\n",
1576 | " \"\"\"\n",
1577 | " Retrieves a list of all toys from the database. This function does not take any parameters.\n",
1578 | " Returns: A list of tuples, where each tuple represents a toy with all its attributes (id, name, price).\n",
1579 | " \"\"\"\n",
1580 | "\n",
1581 | "Function:\n",
1582 | "def find_toy_by_prefix(prefix):\n",
1583 | " \"\"\"\n",
1584 | " Searches for and retrieves toys whose names start with a specified prefix.\n",
1585 | " Parameters:\n",
1586 | " - prefix (str): The prefix to search for in toy names.\n",
1587 | " Returns: A list of tuples, where each tuple represents a toy that matches the prefix criteria.\n",
1588 | " \"\"\"\n",
1589 | "\n",
1590 | "Function:\n",
1591 | "def find_toys_in_price_range(low_price, high_price):\n",
1592 | " \"\"\"\n",
1593 | " Finds and returns toys within a specified price range.\n",
1594 | " Parameters:\n",
1595 | " - low_price (float): The lower bound of the price range.\n",
1596 | " - high_price (float): The upper bound of the price range.\n",
1597 | " Returns: A list of tuples, each representing a toy whose price falls within the specified range.\n",
1598 | " \"\"\"\n",
1599 | "\n",
1600 | "Function:\n",
1601 | "def get_random_toys():\n",
1602 | " \"\"\"\n",
1603 | " Selects and returns a random set of toys from the database, simulating a \"featured toys\" list.\n",
1604 | "\n",
1605 | " Returns: A list of tuples, each representing a randomly selected toy. The number of toys returned is up to the specified count.\n",
1606 | " \"\"\"\n",
1607 | "\n",
1608 | "Function:\n",
1609 | "def get_most_expensive_toy(count : int):\n",
1610 | " \"\"\"\n",
1611 | " Retrieves the most expensive toy from the database.\n",
1612 | " This function does not take any parameters.\n",
1613 | "\n",
1614 | " Returns: A tuple representing the most expensive toy, including its id, name, and price.\n",
1615 | " \"\"\"\n",
1616 | "\n",
1617 | "Function:\n",
1618 | "def get_cheapest_toy(count : int):\n",
1619 | " \"\"\"\n",
1620 | " Finds and retrieves the cheapest toy in the database.\n",
1621 | " This function does not take any parameters.\n",
1622 | "\n",
1623 | " Returns: A tuple representing the cheapest toy, including its id, name, and price.\n",
1624 | " \"\"\"\n",
1625 | "\n",
1626 | "User Query: {question}\n",
1627 | "\n",
1628 | "'''\n",
1629 | "\n",
1630 | "output = query_raven(raven_prompt)\n",
1631 | "print (output)\n",
1632 | "results = eval(output)"
1633 | ]
1634 | },
1635 | {
1636 | "cell_type": "code",
1637 | "execution_count": 21,
1638 | "id": "4cda6a9e-454e-47af-9f01-cbd872ce1815",
1639 | "metadata": {
1640 | "height": 217
1641 | },
1642 | "outputs": [
1643 | {
1644 | "name": "stdout",
1645 | "output_type": "stream",
1646 | "text": [
1647 | "The most expensive item we currently sell is the Crazy Dragon, which costs 19.96.\n"
1648 | ]
1649 | }
1650 | ],
1651 | "source": [
1652 | "full_prompt = \\\n",
1653 | "f\"\"\"\n",
1654 | " [INST]\n",
1655 | "{database_result}\n",
1656 | "\n",
1657 | "Use the information above to answer the following question in a single sentence.\n",
1658 | "\n",
1659 | "Question:\n",
1660 | "{question} [/INST]\n",
1661 | "\"\"\"\n",
1662 | "grounded_response = query_raven(full_prompt)\n",
1663 | "print (grounded_response)"
1664 | ]
1665 | },
1666 | {
1667 | "cell_type": "code",
1668 | "execution_count": null,
1669 | "id": "1267ca30-e928-4655-af6b-66aabcf9e639",
1670 | "metadata": {
1671 | "height": 30
1672 | },
1673 | "outputs": [],
1674 | "source": []
1675 | }
1676 | ],
1677 | "metadata": {
1678 | "kernelspec": {
1679 | "display_name": "Python 3 (ipykernel)",
1680 | "language": "python",
1681 | "name": "python3"
1682 | },
1683 | "language_info": {
1684 | "codemirror_mode": {
1685 | "name": "ipython",
1686 | "version": 3
1687 | },
1688 | "file_extension": ".py",
1689 | "mimetype": "text/x-python",
1690 | "name": "python",
1691 | "nbconvert_exporter": "python",
1692 | "pygments_lexer": "ipython3",
1693 | "version": "3.11.9"
1694 | }
1695 | },
1696 | "nbformat": 4,
1697 | "nbformat_minor": 5
1698 | }
1699 |
--------------------------------------------------------------------------------
/Lesson_2_Student.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "19dda391-ef5b-4d6b-b4ba-0c0233c37c88",
6 | "metadata": {
7 | "id": "YSPItBwWZQgO"
8 | },
9 | "source": [
10 | "# Function Calling"
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "id": "5f209c88-7648-43ae-a298-7547dc5e7a63",
16 | "metadata": {},
17 | "source": [
18 | "### Housekeeping"
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": 1,
24 | "id": "a621b684-4812-4a8b-b094-42821858feae",
25 | "metadata": {
26 | "height": 166
27 | },
28 | "outputs": [],
29 | "source": [
30 | "def afunction(arg1:int = 0, arg2:str = \"hello\", **kwargs)->int:\n",
31 | " ''' this is a function definition\n",
32 | " arg1 (int): an exemplary yet modest argument\n",
33 | " arg2 (str): another nice argument\n",
34 | " **kwargs : the rest of the rabble \n",
35 | "\n",
36 | " returns arg1 incremented by one\n",
37 | " '''\n",
38 | " return(arg + 1)"
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": 2,
44 | "id": "6367f5be-bbe9-49c8-95c5-b891cf0b0b53",
45 | "metadata": {
46 | "height": 47
47 | },
48 | "outputs": [
49 | {
50 | "name": "stdout",
51 | "output_type": "stream",
52 | "text": [
53 | "afunction\n",
54 | " this is a function definition\n",
55 | " arg1 (int): an exemplary yet modest argument\n",
56 | " arg2 (str): another nice argument\n",
57 | " **kwargs : the rest of the rabble \n",
58 | "\n",
59 | " returns arg1 incremented by one\n",
60 | " \n"
61 | ]
62 | }
63 | ],
64 | "source": [
65 | "print(afunction.__name__)\n",
66 | "print(afunction.__doc__)"
67 | ]
68 | },
69 | {
70 | "cell_type": "code",
71 | "execution_count": 3,
72 | "id": "0a8a45a6-fc1e-414d-90e0-d9475e8e5130",
73 | "metadata": {
74 | "height": 47
75 | },
76 | "outputs": [
77 | {
78 | "name": "stdout",
79 | "output_type": "stream",
80 | "text": [
81 | "(arg1: int = 0, arg2: str = 'hello', **kwargs) -> int\n"
82 | ]
83 | }
84 | ],
85 | "source": [
86 | "import inspect\n",
87 | "print(inspect.signature(afunction))"
88 | ]
89 | },
90 | {
91 | "cell_type": "markdown",
92 | "id": "aa1a1ee7-90fa-4816-bf99-606e34e9dd8d",
93 | "metadata": {},
94 | "source": [
95 | "##### Building User Query\n",
96 | "> Note, the video shows how to access utils.py in Jupyter Notebook V7. \n",
97 | "> You may be in Jupyter Notebook V6. To access it in this version, on the menu, choose File->Open. "
98 | ]
99 | },
100 | {
101 | "cell_type": "code",
102 | "execution_count": 4,
103 | "id": "f819feaf-1f55-4550-8089-bb9e677ab68b",
104 | "metadata": {
105 | "height": 353
106 | },
107 | "outputs": [],
108 | "source": [
109 | "import inspect\n",
110 | "def build_raven_prompt(function_list, user_query):\n",
111 | " raven_prompt = \"\"\n",
112 | " for function in function_list:\n",
113 | " signature = inspect.signature(function)\n",
114 | " docstring = function.__doc__\n",
115 | " prompt = \\\n",
116 | "f'''\n",
117 | "Function:\n",
118 | "def {function.__name__}{signature}\n",
119 | " \"\"\"\n",
120 | " {docstring.strip()}\n",
121 | " \"\"\"\n",
122 | " \n",
123 | "'''\n",
124 | " raven_prompt += prompt\n",
125 | " \n",
126 | " raven_prompt += f\"User Query: {user_query}\"\n",
127 | " return raven_prompt\n"
128 | ]
129 | },
130 | {
131 | "cell_type": "code",
132 | "execution_count": 5,
133 | "id": "158f8a7e-d20f-464f-b3f0-e95c5fae5765",
134 | "metadata": {
135 | "height": 30
136 | },
137 | "outputs": [
138 | {
139 | "name": "stdout",
140 | "output_type": "stream",
141 | "text": [
142 | "\n",
143 | "Function:\n",
144 | "def afunction(arg1: int = 0, arg2: str = 'hello', **kwargs) -> int\n",
145 | " \"\"\"\n",
146 | " this is a function definition\n",
147 | " arg1 (int): an exemplary yet modest argument\n",
148 | " arg2 (str): another nice argument\n",
149 | " **kwargs : the rest of the rabble \n",
150 | "\n",
151 | " returns arg1 incremented by one\n",
152 | " \"\"\"\n",
153 | " \n",
154 | "User Query: a query\n"
155 | ]
156 | }
157 | ],
158 | "source": [
159 | "print( build_raven_prompt([afunction], \"a query\"))"
160 | ]
161 | },
162 | {
163 | "cell_type": "markdown",
164 | "id": "a0a64ddc-9c06-421e-935b-483985625692",
165 | "metadata": {
166 | "id": "6mX9gi3Ofj5r"
167 | },
168 | "source": [
169 | "### Concrete Example For Parallel Calls"
170 | ]
171 | },
172 | {
173 | "cell_type": "code",
174 | "execution_count": 6,
175 | "id": "86a648f7-0733-4156-8e8b-5642cda45bf1",
176 | "metadata": {
177 | "height": 132
178 | },
179 | "outputs": [],
180 | "source": [
181 | "from utils import draw_clown_face\n",
182 | "\n",
183 | "raven_msg = \"Hey, can you build me two clowns.\" \\\n",
184 | "\"The first clown should be red faced, with a blue nose\" \\\n",
185 | "\"and a mouth from 0 to 180 degrees. The mouth should be black.\" \\\n",
186 | "\"The second clown should have a blue face and a green nose\" \\\n",
187 | "\"and a red mouth that's 180 to 360 degrees.\""
188 | ]
189 | },
190 | {
191 | "cell_type": "markdown",
192 | "id": "9f5dbc18-dac3-43aa-af6e-286121405872",
193 | "metadata": {},
194 | "source": [
195 | "#### Building Raven Prompt"
196 | ]
197 | },
198 | {
199 | "cell_type": "code",
200 | "execution_count": 7,
201 | "id": "5630ea1c-7d71-46ff-9e88-59602ca4941d",
202 | "metadata": {
203 | "colab": {
204 | "base_uri": "https://localhost:8080/"
205 | },
206 | "height": 64,
207 | "id": "IThyr1tRfmey",
208 | "outputId": "79bc063a-3aef-4776-c71e-302e7e638121"
209 | },
210 | "outputs": [
211 | {
212 | "name": "stdout",
213 | "output_type": "stream",
214 | "text": [
215 | "\n",
216 | "Function:\n",
217 | "def draw_clown_face(face_color='yellow', eye_color='black', nose_color='red', eye_size=0.05, mouth_size=(0.3, 0.1), mouth_color='black', eye_offset=(0.15, 0.15), mouth_theta=(200, 340))\n",
218 | " \"\"\"\n",
219 | " Draws a customizable, simplified clown face using matplotlib.\n",
220 | "\n",
221 | " Parameters:\n",
222 | " - face_color (str): Color of the clown's face. Default is 'yellow'.\n",
223 | " - eye_color (str): Color of the clown's eyes. Default is 'black'.\n",
224 | " - nose_color (str): Color of the clown's nose. Default is 'red'.\n",
225 | " - eye_size (float): Radius of the clown's eyes. Default is 0.05.\n",
226 | " - mouth_size (tuple): Width and height of the clown's mouth arc. Default is (0.3, 0.1).\n",
227 | " - eye_offset (tuple): Horizontal and vertical offset for the eyes from the center. Default is (0.15, 0.15).\n",
228 | " - mouth_theta (tuple): Starting and ending angles (in degrees) of the mouth arc. Default is (200, 340).\n",
229 | "\n",
230 | " This function creates a plot displaying a simplified clown face, where essential facial features' size, position, and color can be customized. \n",
231 | "\n",
232 | " Example usage:\n",
233 | " draw_clown_face(face_color='lightblue', eye_color='green', nose_color='orange', \n",
234 | " eye_size=0.07, mouth_size=(0.4, 0.25), \n",
235 | " eye_offset=(0.2, 0.2), mouth_theta=(0, 180))\n",
236 | "\n",
237 | " # This will draw a simplified clown face with a light blue face, green eyes, an orange nose, and a smiling mouth.\n",
238 | " \"\"\"\n",
239 | " \n",
240 | "User Query: Hey, can you build me two clowns.The first clown should be red faced, with a blue noseand a mouth from 0 to 180 degrees. The mouth should be black.The second clown should have a blue face and a green noseand a red mouth that's 180 to 360 degrees.\n"
241 | ]
242 | }
243 | ],
244 | "source": [
245 | "raven_prompt = build_raven_prompt([draw_clown_face], raven_msg)\n",
246 | "\n",
247 | "print (raven_prompt)"
248 | ]
249 | },
250 | {
251 | "cell_type": "code",
252 | "execution_count": 8,
253 | "id": "1e3e2db9-0696-4978-a42b-7e6038e00733",
254 | "metadata": {
255 | "height": 81
256 | },
257 | "outputs": [
258 | {
259 | "name": "stdout",
260 | "output_type": "stream",
261 | "text": [
262 | "draw_clown_face(face_color='red', nose_color='blue', mouth_color='black', mouth_theta=(0, 180)); draw_clown_face(face_color='blue', nose_color='green', mouth_color='red', mouth_theta=(180, 360));\n"
263 | ]
264 | },
265 | {
266 | "data": {
267 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAReUlEQVR4nO2de5BU1Z3HP923G8OjVkTA4jGQBVMgDJAIUdSZMVvlAosKoQJSpgrQ5Z9FdrMYzOOPbNZsNIIkkV1BUpWgKxhHHi6LY8YhJmVwyIBQg8DAiKkdauW54sBoCkGmH2f/+HUv7ewMTD/uOffcOZ+qW9MD0/f3O/d8+9e/e87vnhNRSikcDsuImnbA4SgEJ1yHlTjhOqzECddhJU64DitxwnVYiROuw0qccB1W4oTrsBInXIeVOOE6rMQJ12ElTrgOK3HCdViJE67DSpxwHVbihOuwEidch5U44TqsxAnXYSVOuA4rccJ1WIkTrsNKYqYdCAXJJHz4IZw+DRcuyO/JpPxfLCZHv34wdCjcdJP87igKdwW7SyIBzc3Q2Aj790NLC5w4AWfOQFsbdHddlUgEbrgBhgyBsjIYPRpuvRWmTIFx45you0nErWTTBW1tUFcHu3bBO+9AUxO0t8v/xeMi5FKQe65evWDCBLj9dqiogBkzROSO/4cTbi4tLVBTA9u2iWDTaYmA2a99XWRtRqMi4DlzYNYsGDVKrx8Bxgn37FlYvx5efBHef1++yqH7X/1+E42KL0rBmDGwaBEsXgyDB5v2zCg9U7hKQUMDrF0LW7ZIZE2nTXvVPaJROR54AJYuhTvuuPJh60H0LOG2t8OGDbB6NRw5YiYNKBVZ38ePh2XLYOFCyZF7CD1DuOk0bNoE3/8+HD8uESoszc62ZeRIeOopmD9fInLICbdwlYIdO+A734HDh6VDbUkJ8iXbtvJyWLUKpk8PdQoRXuE2NUkOWF8PngeplGm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QvyePvMmW6GLR+yM2K1tYEep70WdqUKHRk3Dvbvh8pK677qjBCJSO1BY6PVogXbhQsyJfnmm/DEE1IIErBikECQvS5PPCEFMwGdxs0Hu1OFjhw+DAsWwMGDMvbrkCg7aZLU0wasNLEY7I+4uZSXw9698OMfS4TxArFYkRk870qU3bcvVKKFsEXcXA4flpmg+nrpxJ5y85Zta2Wl7HIUMsFmCVfEzaW8XB6jrqu7ciNi0QB73mTbNm6ctHnnztCKFsIsXJD8bvp0yXmrq69sSR+mEYhsW8rKpI0HDkibw9TGTghvqtAZ7e2wYQOsXi1PE8di9k5eZH0fPx6WLZMtCuLxa74tLPQs4WZRSlbOWbsWNm+WNcxs2ZMiGpVj/nypmJs6NfTRtTN6pnBzOXsW1q+XSHz06JVcMShCzvVn7FiJrIsXw6BBZv0yjBNuLseOQU0NbNsmoxHptHz9JvLfIb0osjY9T3ZsnDNHngbRvCVTkHHC7Yq2Nrk7/+Mf4Z13ZMn49swmUKUUc+65evWCiRNlF/KKCpgxA/r3L42dkOGE212SSSnqaWyU49gxOHECzpyRx+m7exkjEZlyHTJERgJGjYLJk2X5qVtucVPW3cQJtxQkk5Irnz4NFy7I79koGo+LGPv1g6FDZT8wJ86iccJ1WEm4JyAcocUJ12ElTrgOK3HCdViJE67DSpxwHVbihOuwEidch5U44TqsxAnXYSVOuA4rccJ1WIkTrsNKnHAdVuKE67ASJ1yHlTjhOqzECddhJU64DitxwnVYiROuw0qccB1W4oTrsJL/BXz+aIho9u1OAAAAAElFTkSuQmCC",
268 | "text/plain": [
269 | ""
270 | ]
271 | },
272 | "metadata": {},
273 | "output_type": "display_data"
274 | },
275 | {
276 | "data": {
277 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAARrElE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pkzRiqVy8ZY+1qkruchQ1wWaJVI/bkspK2LgRamubL0RsGmDPl+yxDRokx7xxY3RFCxEWLkh8N2aMxLzLlzffkj5KIxDZY+nXT45x1y455igdY1tENlRoi6YmWLYMFi6EffskBrQ1eZH1ffBgqXw5fbrZWl66KSnhZlEKtmyR/PzKlVLDzJbie74v2+TJMmNu1Kjo965tUZLCbcnJk7B0qfTEBw40x4phEXJLfwYOlJ710Ufhy18265dpSl64LWlokOVCq1fLaEQ6LT+/iYReP7I2g0Du2FhdLatBdN+SKcw44bbDmTNydf6HP8C2bVIyvimzuLeQYm65r7IyGDpU7kI+ejSMHQs33VQYO1HDCTdHkkmZ1LNjh2wNDXDkCBw/Lsvpcz2Lnicp1169ZCSgvBzuuQdGjJBhO5eyzg0n3AKQTEqsfOwYnD0rz7O9aDwuYuzWDXr3llsrOXF2Hidch5VEOgHhiC5OuA4rccJ1WIkTrsNKnHAdVuKE67ASJ1yHlTjhOqzECddhJU64DitxwnVYiROuw0qccB1W4oTrsBInXIeVOOE6rMQJ12ElTrgOK3HCdViJE67DSpxwHVbihOuwEidch5X8P/e8Kn/fpMMoAAAAAElFTkSuQmCC",
278 | "text/plain": [
279 | ""
280 | ]
281 | },
282 | "metadata": {},
283 | "output_type": "display_data"
284 | }
285 | ],
286 | "source": [
287 | "from utils import query_raven\n",
288 | "raven_call = query_raven(raven_prompt)\n",
289 | "print (raven_call)\n",
290 | "exec(raven_call)"
291 | ]
292 | },
293 | {
294 | "cell_type": "markdown",
295 | "id": "f8461ad6-82b1-4b1b-bec4-f17f684b85f5",
296 | "metadata": {},
297 | "source": [
298 | "### Using Multiple Functions!"
299 | ]
300 | },
301 | {
302 | "cell_type": "markdown",
303 | "id": "bbc15476-312c-423a-b62b-136855f7985c",
304 | "metadata": {},
305 | "source": [
306 | "#### Building The Prompt"
307 | ]
308 | },
309 | {
310 | "cell_type": "code",
311 | "execution_count": 9,
312 | "id": "3068564c-d53a-43d8-91d5-5dba9ed17632",
313 | "metadata": {
314 | "height": 81,
315 | "tags": []
316 | },
317 | "outputs": [],
318 | "source": [
319 | "from utils import draw_clown_face, draw_tie\n",
320 | "raven_msg = \"Hey draw a tie?\"\n",
321 | "raven_prompt = build_raven_prompt\\\n",
322 | " ([draw_clown_face, draw_tie], raven_msg)"
323 | ]
324 | },
325 | {
326 | "cell_type": "code",
327 | "execution_count": 10,
328 | "id": "e5bcc88e-5ad3-48a6-b933-fd7f75fd972a",
329 | "metadata": {
330 | "height": 30
331 | },
332 | "outputs": [
333 | {
334 | "name": "stdout",
335 | "output_type": "stream",
336 | "text": [
337 | "\n",
338 | "Function:\n",
339 | "def draw_clown_face(face_color='yellow', eye_color='black', nose_color='red', eye_size=0.05, mouth_size=(0.3, 0.1), mouth_color='black', eye_offset=(0.15, 0.15), mouth_theta=(200, 340))\n",
340 | " \"\"\"\n",
341 | " Draws a customizable, simplified clown face using matplotlib.\n",
342 | "\n",
343 | " Parameters:\n",
344 | " - face_color (str): Color of the clown's face. Default is 'yellow'.\n",
345 | " - eye_color (str): Color of the clown's eyes. Default is 'black'.\n",
346 | " - nose_color (str): Color of the clown's nose. Default is 'red'.\n",
347 | " - eye_size (float): Radius of the clown's eyes. Default is 0.05.\n",
348 | " - mouth_size (tuple): Width and height of the clown's mouth arc. Default is (0.3, 0.1).\n",
349 | " - eye_offset (tuple): Horizontal and vertical offset for the eyes from the center. Default is (0.15, 0.15).\n",
350 | " - mouth_theta (tuple): Starting and ending angles (in degrees) of the mouth arc. Default is (200, 340).\n",
351 | "\n",
352 | " This function creates a plot displaying a simplified clown face, where essential facial features' size, position, and color can be customized. \n",
353 | "\n",
354 | " Example usage:\n",
355 | " draw_clown_face(face_color='lightblue', eye_color='green', nose_color='orange', \n",
356 | " eye_size=0.07, mouth_size=(0.4, 0.25), \n",
357 | " eye_offset=(0.2, 0.2), mouth_theta=(0, 180))\n",
358 | "\n",
359 | " # This will draw a simplified clown face with a light blue face, green eyes, an orange nose, and a smiling mouth.\n",
360 | " \"\"\"\n",
361 | " \n",
362 | "\n",
363 | "Function:\n",
364 | "def draw_tie()\n",
365 | " \"\"\"\n",
366 | " Draws a tie\n",
367 | " \"\"\"\n",
368 | " \n",
369 | "User Query: Hey draw a tie?\n"
370 | ]
371 | }
372 | ],
373 | "source": [
374 | "print(raven_prompt)"
375 | ]
376 | },
377 | {
378 | "cell_type": "markdown",
379 | "id": "4c424524-99d0-4c95-823f-d67298d2a42a",
380 | "metadata": {},
381 | "source": [
382 | "#### Getting The Call"
383 | ]
384 | },
385 | {
386 | "cell_type": "code",
387 | "execution_count": 11,
388 | "id": "b1416f63-e4e2-4018-b9b5-02d997754fde",
389 | "metadata": {
390 | "height": 47,
391 | "tags": []
392 | },
393 | "outputs": [
394 | {
395 | "name": "stdout",
396 | "output_type": "stream",
397 | "text": [
398 | "draw_tie()\n"
399 | ]
400 | }
401 | ],
402 | "source": [
403 | "raven_call = query_raven(raven_prompt)\n",
404 | "print (raven_call)"
405 | ]
406 | },
407 | {
408 | "cell_type": "code",
409 | "execution_count": 12,
410 | "id": "049e2d91-ec3c-4554-ac5b-6bdaf54a00cc",
411 | "metadata": {
412 | "height": 30,
413 | "tags": []
414 | },
415 | "outputs": [
416 | {
417 | "data": {
418 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGEAAACuCAYAAAAmuGPCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAFlUlEQVR4nO3dXU5bTRCE4TGyWIIjVgjrsHfjhcBSEF4E9V18KpGIv3Nmuqerz+mSUG58McqbfhRFChwAoNVCdxf9gFpFkFhFEFhFEFhFEFhFEFhFEFhFEFhFENhx6QcPh4PnOza5pf8YsfgSzudz92P2uMvlsvzDWLHz+YzWWn398nW5XNb8tmJVhAphH6ArQoWwDdAdoULYBRiKUCFsAgxHqBDjAUwiAPsNYREAMIoA7C+EVQDA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VCJoq4mSS5c5SRIm4WSe6XkJEibhZJ7hEyUsTNIsmVo8wUcTNIcr2EzBRxM0hyjZCZIm4GSW4cbYEizpskt0vYAkWcN0luEbZAEedNkgtHW6KI8yTJ5RK2RBHnSZJLhC1RxHmSZM7RFinivEgyv4QtUsR5kWQeYYsUcV4kmXK0ZYo4D5JML2HLFHEeJJlG2DJFnAdJZhztgSLOmiSzS9gDRZw1SWYR9kARZ02SCUd7ooizJMnkEvZEEWdJkkmEPVHEWZI0zNEeKeKsSBq+hD1SxFmRNBxhjxRxViQNcbRnijgLkoYuYc8UcRYkDUXYM0WcBUndHBVFHxslqfsSiqKPjZLUHaEo+tgoSV0cFUWfN0JS1yUURZ83QlJXhKLo80ZIWs1RUfT9eklafQlF0ffrJWl1hKLo+/WStIqjouj39ZC06hKKot/XQ9KqCEXR7+shaTFHRdHyrSVp8SUURcu3lqTFEYqi5VtL0mKO/vz5U5ewYqfTqb29vS367OIIh8Nh6FF73NK//Yf/YKNaa4uRF/jpkJtdXYLAKoLAKoLAKoLAKoLAKoLAKoLAKoLAKoLA/gMILoRVibsfewAAAABJRU5ErkJggg==",
419 | "text/plain": [
420 | ""
421 | ]
422 | },
423 | "metadata": {},
424 | "output_type": "display_data"
425 | }
426 | ],
427 | "source": [
428 | "exec(raven_call)"
429 | ]
430 | },
431 | {
432 | "cell_type": "markdown",
433 | "id": "b3378221-d823-4e30-891b-85d203ec7632",
434 | "metadata": {},
435 | "source": [
436 | "### Multiple Parallel Function Calling"
437 | ]
438 | },
439 | {
440 | "cell_type": "markdown",
441 | "id": "588f02da-cdc5-4962-8347-b49af45ccc7d",
442 | "metadata": {},
443 | "source": [
444 | "#### Build The Prompt"
445 | ]
446 | },
447 | {
448 | "cell_type": "code",
449 | "execution_count": 13,
450 | "id": "2b2a110d-f609-42ee-b429-9a5393816f84",
451 | "metadata": {
452 | "height": 30,
453 | "tags": []
454 | },
455 | "outputs": [],
456 | "source": [
457 | "raven_msg = \"Draw a clown and a tie?\""
458 | ]
459 | },
460 | {
461 | "cell_type": "code",
462 | "execution_count": 14,
463 | "id": "4a36415a-f8e4-42d6-9e5d-03e462a103ef",
464 | "metadata": {
465 | "height": 47,
466 | "tags": []
467 | },
468 | "outputs": [],
469 | "source": [
470 | "raven_prompt = build_raven_prompt([draw_tie, draw_clown_face], raven_msg)\n",
471 | "raven_call = query_raven(raven_prompt)"
472 | ]
473 | },
474 | {
475 | "cell_type": "code",
476 | "execution_count": 15,
477 | "id": "48dc87c0-1e26-4ed0-b03a-16e03f6022ad",
478 | "metadata": {
479 | "height": 30,
480 | "tags": []
481 | },
482 | "outputs": [
483 | {
484 | "name": "stdout",
485 | "output_type": "stream",
486 | "text": [
487 | "draw_clown_face(face_color='yellow', eye_color='black', nose_color='red', eye_size=0.05, mouth_size=(0.3, 0.1), mouth_color='black', eye_offset=(0.15, 0.15), mouth_theta=(200, 340)); draw_tie()\n"
488 | ]
489 | }
490 | ],
491 | "source": [
492 | "print (raven_call)"
493 | ]
494 | },
495 | {
496 | "cell_type": "code",
497 | "execution_count": 16,
498 | "id": "d67c74b1-38b4-4703-8f59-d0a96703b278",
499 | "metadata": {
500 | "height": 30,
501 | "tags": []
502 | },
503 | "outputs": [
504 | {
505 | "data": {
506 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAPL0lEQVR4nO2da4xV1RXHf/cxM4jEIFIMDI+IJSIwYgUftYIl0WqoQkhFwwfFxKTRqlRrX180bWqLYluJgjZGbFWi+MIASkE/gNL6LMKIg7QGJshLkIchiDgz9+5+WPd6h2FmvK+zH+euX3LCY+aevfbZ/7vuunutvXfCGGNQlMBIujZAUcpBhasEiQpXCRIVrhIkKlwlSFS4SpCocJUgUeEqQaLCVYJEhasEiQpXCRIV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QsXJI/+OnAvUgjiVzGIH+Sfy71IwYx/tQelEnio0JWPkONwmtE0cZ4EspL6aXwrTayEGHjczoxDThD5A+JhnJZXOSZFwcu+T5xEC7HzuJ35CMkErUMGsVa+vOX7Ogk55Shegs0TM4/bmXHIMupVFL6IxLi73/RtDNLnN4iraCHeI4nEd1cgMe+zFI6kj9MMRL4vw5A+bkT6HKc+nkiMQ4XuaAOeAuYjq4nThJu8yNs+Ftn5cjYu9/KyTY0JN49Bds5ZCDyP7GEWyuZ7+XNVr0Mq5i4i7t61O2pUuJ3ZByxCPPEWCtGTL0LubM9oxLPeBHzHmUU+oMI9jm3IcqGXkdmILPLx227ZjnybKeTExhnIahC7RzL5jAq3Rw4h387/DbyLbBnflvtZNcXc+V71wDnIKeSXAFcSo+PVq4oKt2g6kKKe9blrG3JM+h5kOX2xjzGBpFwHIzMBI4EJyPZTZ6Mp6+JQ4VaFDiRW3g0cyf0770XrEDH2A4YgRyupOCtFhasEScwTEEpcUeEqQaLCVYJEhasEiQpXCRIVrhIkKlwlSFS4SpCocJUgUeEqQaLCVYJEhasEiQpXCRIVrhIkKlwlSFS4SpCocJUgUeEqQaLCVYJEhasEiQpXCRIVrhIkKlwlSP4PnjIlsiSt2vUAAAAASUVORK5CYII=",
507 | "text/plain": [
508 | ""
509 | ]
510 | },
511 | "metadata": {},
512 | "output_type": "display_data"
513 | },
514 | {
515 | "data": {
516 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGEAAACuCAYAAAAmuGPCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAFlUlEQVR4nO3dXU5bTRCE4TGyWIIjVgjrsHfjhcBSEF4E9V18KpGIv3Nmuqerz+mSUG58McqbfhRFChwAoNVCdxf9gFpFkFhFEFhFEFhFEFhFEFhFEFhFEFhFENhx6QcPh4PnOza5pf8Ysf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JihRxUSRNj6BIERdF0lSOlCniIkiaegnKFHERJE2NoEwRF0HSNI4yUMTNJmnaJWSgiJtN0rQIGSjiZpM0haNMFHEzSZpyCZko4maSNCVCJoq4mSS5c5SRIm4WSe6XkJEibhZJ7hEyUsTNIsmVo8wUcTNIcr2EzBRxM0hyjZCZIm4GSW4cbYEizpskt0vYAkWcN0luEbZAEedNkgtHW6KI8yTJ5RK2RBHnSZJLhC1RxHmSZM7RFinivEgyv4QtUsR5kWQeYYsUcV4kmXK0ZYo4D5JML2HLFHEeJJlG2DJFnAdJZhztgSLOmiSzS9gDRZw1SWYR9kARZ02SCUd7ooizJMnkEvZEEWdJkkmEPVHEWZI0zNEeKeKsSBq+hD1SxFmRNBxhjxRxViQNcbRnijgLkoYuYc8UcRYkDUXYM0WcBUndHBVFHxslqfsSiqKPjZLUHaEo+tgoSV0cFUWfN0JS1yUURZ83QlJXhKLo80ZIWs1RUfT9eklafQlF0ffrJWl1hKLo+/WStIqjouj39ZC06hKKot/XQ9KqCEXR7+shaTFHRdHyrSVp8SUURcu3lqTFEYqi5VtL0mKO/vz5U5ewYqfTqb29vS367OIIh8Nh6FF73NK//Yf/YKNaa4uRF/jpkJtdXYLAKoLAKoLAKoLAKoLAKoLAKoLAKoLAKoLA/gMILoRVibsfewAAAABJRU5ErkJggg==",
517 | "text/plain": [
518 | ""
519 | ]
520 | },
521 | "metadata": {},
522 | "output_type": "display_data"
523 | }
524 | ],
525 | "source": [
526 | "exec(raven_call)"
527 | ]
528 | },
529 | {
530 | "cell_type": "markdown",
531 | "id": "633894d1-9733-40e9-8d64-29f63db29b6c",
532 | "metadata": {},
533 | "source": [
534 | "### What is the significance of the docstrings?"
535 | ]
536 | },
537 | {
538 | "cell_type": "code",
539 | "execution_count": 17,
540 | "id": "abdfd941-d837-4f4e-8a66-f95b52f0e500",
541 | "metadata": {
542 | "height": 98,
543 | "tags": []
544 | },
545 | "outputs": [
546 | {
547 | "name": "stdout",
548 | "output_type": "stream",
549 | "text": [
550 | "draw_clown_face(face_color='green')\n"
551 | ]
552 | },
553 | {
554 | "data": {
555 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAATNElEQVR4nO2deXBUVb6Av3O7O2NYDZLwWBIcUMMeZZEwBpdRQaOIgMLw5iHOs8Y3CK/EQZB5VVPFVOmw1SiWLI4WNSPoUwJPnsahgkv52AaQRQNJBBUEAmSSSDJh6zHdfe/746Y1Zgik033PvadzvqqusKTv73f7fn3612e7wrIsC41GMQy3E9BoWoMWV6MkWlyNkmhxNUqixdUoiRZXoyRaXI2SaHE1SqLF1SiJFlejJFpcjZJocTVKosXVKIkWV6MkWlyNkmhxNUqixdUoiRZXoyRaXI2SaHE1SqLF1SiJFlejJFpcjZL43U4gGQibYSrPV3L63GnO158nbIYJm2EA/IYfv+GnQ0oHenTsQbcO3fAb+mWPF/0KtpBQJERZdRn7Kvaxv2I/R2qPUF5XTsX5CmqDtVi0bF8VgSAtNY3uHbqT2TmTvml9Gdp9KMN7DGdA+gAtdQsReiebS1MbrKXoqyK2n9jO7lO7OVh1kPpIPQABI0DIDCUkTuNjpfhSGJwxmJE9R5KXlcc9191DWmpaQuIkG1rcRhypOULhF4VsPLSR7Se2Y1omfsP/3ce+LKIxDWGQl5XHhH4TeCD7Afqk9ZGah5dp8+JWXahi9f7VvFb8GofPHEYgAFr80e80hjCwLAsLi+xrspmeM53Hhj5GRvsMt1NzlTYprmVZ/LX8r6zYs4L1ZesxLRPTMt1Oq0UYwsAQBpMHTmbmiJmM6jUKIYTbaUmnTYlbH6lnTfEalu1aRml1qStlQKKI5j4wfSCzc2fzSM4jpPhS3E5LGm1CXNMyWVeyjvkfzedE3QkEwjOlQLxEz6V3594svHMhUwZNwRDJ3z2f1OJalsXm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QbWtwWEjbDlFWXse/0PvZV7ONo7VHKz5ZTca6CmmBNi3spBIIuqV3o3rE7mZ0y6ZPWh2HdhzG8x3D6p/dPuoECp9DiJoCwGabqQhWnz53mfP15wmaYUMRuRQO+AH7DT4eUDvTo2IOM9hlazgSgxdUoSfL3VGuSEi2uRkm0uBol0eJqlESLq1ESLa5GSbS4GiXR4mqURIurURItrkZJtLgaJdHiapREi6tREi2uRkm0uBol0eJqlESLq1ESLa5GSbS4GiXR4mqURIurURItrkZJtLgaJfl/GU744Lc/a04AAAAASUVORK5CYII=",
556 | "text/plain": [
557 | ""
558 | ]
559 | },
560 | "metadata": {},
561 | "output_type": "display_data"
562 | }
563 | ],
564 | "source": [
565 | "raven_msg = \"Draw me a sad one with green head\"\n",
566 | "raven_prompt = build_raven_prompt([draw_clown_face], raven_msg)\n",
567 | "raven_call = query_raven(raven_prompt)\n",
568 | "print (raven_call)\n",
569 | "exec(raven_call)"
570 | ]
571 | },
572 | {
573 | "cell_type": "markdown",
574 | "id": "f05aa8d4-573f-4656-867b-b0cc0464e879",
575 | "metadata": {},
576 | "source": [
577 | "#### Fixing The Function Docstring"
578 | ]
579 | },
580 | {
581 | "cell_type": "code",
582 | "execution_count": 18,
583 | "id": "5eeadbcd-d63c-4a05-a442-7c616458be14",
584 | "metadata": {
585 | "height": 30,
586 | "tags": []
587 | },
588 | "outputs": [
589 | {
590 | "name": "stdout",
591 | "output_type": "stream",
592 | "text": [
593 | "\n",
594 | "Function:\n",
595 | "def draw_clown_face(face_color='yellow', eye_color='black', nose_color='red', eye_size=0.05, mouth_size=(0.3, 0.1), mouth_color='black', eye_offset=(0.15, 0.15), mouth_theta=(200, 340))\n",
596 | " \"\"\"\n",
597 | " Draws a customizable, simplified clown face using matplotlib.\n",
598 | "\n",
599 | " Parameters:\n",
600 | " - face_color (str): Color of the clown's face. Default is 'yellow'.\n",
601 | " - eye_color (str): Color of the clown's eyes. Default is 'black'.\n",
602 | " - nose_color (str): Color of the clown's nose. Default is 'red'.\n",
603 | " - eye_size (float): Radius of the clown's eyes. Default is 0.05.\n",
604 | " - mouth_size (tuple): Width and height of the clown's mouth arc. Default is (0.3, 0.1).\n",
605 | " - eye_offset (tuple): Horizontal and vertical offset for the eyes from the center. Default is (0.15, 0.15).\n",
606 | " - mouth_theta (tuple): Starting and ending angles (in degrees) of the mouth arc. Default is (200, 340).\n",
607 | "\n",
608 | " This function creates a plot displaying a simplified clown face, where essential facial features' size, position, and color can be customized. \n",
609 | "\n",
610 | " Example usage:\n",
611 | " draw_clown_face(face_color='lightblue', eye_color='green', nose_color='orange', \n",
612 | " eye_size=0.07, mouth_size=(0.4, 0.25), \n",
613 | " eye_offset=(0.2, 0.2), mouth_theta=(0, 180))\n",
614 | "\n",
615 | " # This will draw a simplified clown face with a light blue face, green eyes, an orange nose, and a smiling mouth.\n",
616 | " \"\"\"\n",
617 | " \n",
618 | "User Query: Draw me a sad one with green head\n"
619 | ]
620 | }
621 | ],
622 | "source": [
623 | "print (raven_prompt)"
624 | ]
625 | },
626 | {
627 | "cell_type": "code",
628 | "execution_count": 19,
629 | "id": "b62f8395-1b44-4ed2-856e-bc3b804bd951",
630 | "metadata": {
631 | "height": 489
632 | },
633 | "outputs": [],
634 | "source": [
635 | "raven_prompt_targeted = \\\n",
636 | "'''\n",
637 | "Function:\n",
638 | "def draw_clown_face(face_color='yellow', eye_color='black', nose_color='red', eye_size=0.05, mouth_size=(0.3, 0.1), mouth_color='black', eye_offset=(0.15, 0.15), mouth_theta=(200, 340))\n",
639 | " \"\"\"\n",
640 | " Draws a customizable, simplified clown face using matplotlib.\n",
641 | "\n",
642 | " Parameters:\n",
643 | " - face_color (str): Color of the clown's face. Default is 'yellow'.\n",
644 | " - eye_color (str): Color of the clown's eyes. Default is 'black'.\n",
645 | " - nose_color (str): Color of the clown's nose. Default is 'red'.\n",
646 | " - eye_size (float): Radius of the clown's eyes. Default is 0.05.\n",
647 | " - mouth_size (tuple): Width and height of the clown's mouth arc. Default is (0.3, 0.1).\n",
648 | " - eye_offset (tuple): Horizontal and vertical offset for the eyes from the center. Default is (0.15, 0.15).\n",
649 | " - mouth_theta (tuple): Controls the emotions of the clown. Starting and ending angles (in degrees) of the mouth arc. Default is (200, 340).\n",
650 | "\n",
651 | " This function creates a plot displaying a simplified clown face, where essential facial features' size, position, and color can be customized. \n",
652 | "\n",
653 | " Example usage:\n",
654 | " draw_clown_face(face_color='lightblue', eye_color='green', nose_color='orange', \n",
655 | " eye_size=0.07, mouth_size=(0.4, 0.25), \n",
656 | " eye_offset=(0.2, 0.2), mouth_theta=(0, 180))\n",
657 | "\n",
658 | " # This will draw a simplified clown face with a light blue face, green eyes, an orange nose, and a smiling mouth.\n",
659 | " \"\"\"\n",
660 | " \n",
661 | "User Query: Draw me a sad one with green head\n",
662 | "'''"
663 | ]
664 | },
665 | {
666 | "cell_type": "code",
667 | "execution_count": 20,
668 | "id": "93c61030-f3f0-48f5-99a8-d96a95edc039",
669 | "metadata": {
670 | "height": 64
671 | },
672 | "outputs": [
673 | {
674 | "name": "stdout",
675 | "output_type": "stream",
676 | "text": [
677 | "draw_clown_face(face_color='green', mouth_theta=[0, 180])\n"
678 | ]
679 | },
680 | {
681 | "data": {
682 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAUAUlEQVR4nO2de3BV1b2Av7XPSTQ8TSThAiZ4QQyvgCIISEStVTSKFFGo9SK2Tm2V3pHWF71/0RktCNNqpzxaO9zWUK8SvOW2USZoO94ICIiggSQFeRQIEEkkueGVmnPO3vePlSNpSkjOY6+198n6ZjIEQvbvt8/+ztq/s15bOI7jYDD4DEt3AgZDPBhxDb7EiGvwJUZcgy8x4hp8iRHX4EuMuAZfYsQ1+BIjrsGXGHENvsSIa/AlRlyD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r8CVGXIMvMeIafIkR1+BLjLgGX2LENfgSI67BlxhxDb7EiGvwJUZcgy8x4hp8iRHX4EuMuAZfYsQ1+JL/B7GjIcxfTD+PAAAAAElFTkSuQmCC",
683 | "text/plain": [
684 | ""
685 | ]
686 | },
687 | "metadata": {},
688 | "output_type": "display_data"
689 | }
690 | ],
691 | "source": [
692 | "raven_call = query_raven(raven_prompt_targeted)\n",
693 | "print (raven_call)\n",
694 | "exec(raven_call)"
695 | ]
696 | },
697 | {
698 | "cell_type": "markdown",
699 | "id": "578ec52e-57dc-405f-9d9d-e5880367bdb7",
700 | "metadata": {
701 | "id": "yIK9qpfSacEE"
702 | },
703 | "source": [
704 | "### Concrete Example For Nested APIs"
705 | ]
706 | },
707 | {
708 | "cell_type": "code",
709 | "execution_count": 21,
710 | "id": "975a5c18-2766-4380-a6b9-1b34f6799790",
711 | "metadata": {
712 | "height": 81,
713 | "tags": []
714 | },
715 | "outputs": [],
716 | "source": [
717 | "raven_msg_nested = \"Hey draw me a clown with \"\\\n",
718 | " \"a red face, blue eyes, green nose, \"\\\n",
719 | " \"and a black mouth open from 0 to 360 \"\\\n",
720 | " \"degrees?\""
721 | ]
722 | },
723 | {
724 | "cell_type": "code",
725 | "execution_count": 22,
726 | "id": "b4a79fc5-b63c-43c4-976e-f3c4ff835e07",
727 | "metadata": {
728 | "height": 183,
729 | "id": "kcGq73hRYlwX"
730 | },
731 | "outputs": [],
732 | "source": [
733 | "from utils import draw_head, draw_eyes, \\\n",
734 | " draw_nose, draw_mouth, \\\n",
735 | " draw_clown_face_parts\n",
736 | "raven_function_nested = build_raven_prompt([draw_head, \\\n",
737 | " draw_eyes, \\\n",
738 | " draw_nose, \\\n",
739 | " draw_mouth, \\\n",
740 | " draw_clown_face_parts],\\\n",
741 | " raven_msg_nested)\n",
742 | "raven_call = query_raven(raven_function_nested)"
743 | ]
744 | },
745 | {
746 | "cell_type": "code",
747 | "execution_count": 23,
748 | "id": "9385d37d-61c3-4eaf-811f-ee2ea3290fe9",
749 | "metadata": {
750 | "colab": {
751 | "base_uri": "https://localhost:8080/"
752 | },
753 | "height": 30,
754 | "id": "AeAzs29PeHAl",
755 | "outputId": "26ea8920-96e5-4f16-905f-a7203c42be9a"
756 | },
757 | "outputs": [
758 | {
759 | "name": "stdout",
760 | "output_type": "stream",
761 | "text": [
762 | "draw_clown_face_parts(head=draw_head(face_color='red'), eyes=draw_eyes(eye_color='blue'), nose=draw_nose(nose_color='green'), mouth=draw_mouth(mouth_color='black', mouth_theta1=0, mouth_theta2=360))\n"
763 | ]
764 | }
765 | ],
766 | "source": [
767 | "print (raven_call)"
768 | ]
769 | },
770 | {
771 | "cell_type": "code",
772 | "execution_count": 24,
773 | "id": "ffa9cffb-f2ed-4ae4-b6fc-0a61f39f2242",
774 | "metadata": {
775 | "height": 30,
776 | "tags": []
777 | },
778 | "outputs": [
779 | {
780 | "data": {
781 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAK4AAACuCAYAAACvDDbuAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAA9hAAAPYQGoP6dpAAATCUlEQVR4nO2de5RUxZ3HP7cfIIgElEd4DOwBz2EcXooYMPLwj42wqJBZV5CcgK6c44agCYY8XDfu0Y1G0CQSHSDHHFCJMohuOIjBIf7hIgkPzYAwMMIfwy4MwwgiGIUBph+1f/y6mRFmYHqmb9WtO/U5557unum+v9+99e3qX1X9qspTSikcDsuImHbA4WgNTrgOK3HCdViJE67DSpxwHVbihOuwEidch5U44TqsxAnXYSVOuA4rccJ1WIkTrsNKnHAdVuKE67ASJ1yHlTjhOqzECddhJU64DitxwnVYiROuw0qccB1W4oTrsBInXIeVxEw7EAqSSTh6FI4cgVOn5HUyKf+LxeTo0gX69oXeveW1o024O9hSEgmorITyctixA6qqoLoaamvh5Elo6boqngfdu0OfPlBQAIMHw6hRMHo0FBU5UbcQz61k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aCFuN25g9e2QkaPNmKcT20njLXuv48bLLUcgEmyVcNW5jhg2DTZugrKyhIWJRB3vOZK+tqEiuedOm0IoWwixckPhu0iSJeUtLG7akD1MPRPZaCgrkGj/6SK45TNfYBOENFZqivh5WroTFi2HvXokBbR28yPo+dCjMny9bFMTjl/1YWGhfws2iFGzdKuPza9bIGma27EkRicgxY4ZkzI0dG/ratSnap3Abc+wYLF8uNfG+fQ2xYlCE3NifwkKpWefMgZ49zfplGCfcxhw4INOF1q6V3oh0Wn5+E5q3h8zajEZlXbXiYpkNonlLpiDjhNscJ09K6/yvf4Xt22XJ+PrMFMh8irnxuTp0gBEjZBfyceNg8mTo1i0/dkKGE25LSSYlqae8XI4DB6C6GmprZTp9S2+j58mQa58+0hMwaBDceCOMHi3ddm7IukU44eaDZFJi5SNH4NQpeZ2tReNxEWOXLtC3r+wH5sTZZpxwHVYS7gEIR2hxwnVYiROuw0qccB1W4oTrsBInXIeVOOE6rMQJ12ElTrgOK3HCdViJE67DSpxwHVbihOuwEidch5U44TqsxAnXYSVOuA4rccJ1WIkTrsNKnHAdVuKE67ASJ1yHlTjhOqzk/wFOALCUKT5h/gAAAABJRU5ErkJggg==",
782 | "text/plain": [
783 | ""
784 | ]
785 | },
786 | "metadata": {},
787 | "output_type": "display_data"
788 | }
789 | ],
790 | "source": [
791 | "exec(raven_call)"
792 | ]
793 | },
794 | {
795 | "cell_type": "code",
796 | "execution_count": null,
797 | "id": "9b82a427-18bd-4c73-af08-b0932fe33596",
798 | "metadata": {
799 | "height": 30
800 | },
801 | "outputs": [],
802 | "source": []
803 | }
804 | ],
805 | "metadata": {
806 | "kernelspec": {
807 | "display_name": "Python 3 (ipykernel)",
808 | "language": "python",
809 | "name": "python3"
810 | },
811 | "language_info": {
812 | "codemirror_mode": {
813 | "name": "ipython",
814 | "version": 3
815 | },
816 | "file_extension": ".py",
817 | "mimetype": "text/x-python",
818 | "name": "python",
819 | "nbconvert_exporter": "python",
820 | "pygments_lexer": "ipython3",
821 | "version": "3.11.9"
822 | }
823 | },
824 | "nbformat": 4,
825 | "nbformat_minor": 5
826 | }
827 |
--------------------------------------------------------------------------------