|
|
@ -12,7 +12,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 11, |
|
|
|
"execution_count": null, |
|
|
|
"id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", |
|
|
|
"id": "8b50bbe2-c0b1-49c3-9a5c-1ba7efa2bcb4", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -28,18 +28,10 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 12, |
|
|
|
"execution_count": null, |
|
|
|
"id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", |
|
|
|
"id": "747e8786-9da8-4342-b6c9-f5f69c2e22ae", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"OpenAI API Key exists and begins sk-proj-\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"# Initialization\n", |
|
|
|
"# Initialization\n", |
|
|
|
"\n", |
|
|
|
"\n", |
|
|
@ -57,7 +49,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 13, |
|
|
|
"execution_count": null, |
|
|
|
"id": "0a521d84-d07c-49ab-a0df-d6451499ed97", |
|
|
|
"id": "0a521d84-d07c-49ab-a0df-d6451499ed97", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -69,40 +61,10 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 14, |
|
|
|
"execution_count": null, |
|
|
|
"id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", |
|
|
|
"id": "61a2a15d-b559-4844-b377-6bd5cb4949f6", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"* Running on local URL: http://127.0.0.1:7861\n", |
|
|
|
|
|
|
|
"\n", |
|
|
|
|
|
|
|
"To create a public link, set `share=True` in `launch()`.\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/html": [ |
|
|
|
|
|
|
|
"<div><iframe src=\"http://127.0.0.1:7861/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>" |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"text/plain": [ |
|
|
|
|
|
|
|
"<IPython.core.display.HTML object>" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "display_data" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/plain": [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"execution_count": 14, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"# This function looks rather simpler than the one from my video, because we're taking advantage of the latest Gradio updates\n", |
|
|
|
"# This function looks rather simpler than the one from my video, because we're taking advantage of the latest Gradio updates\n", |
|
|
|
"\n", |
|
|
|
"\n", |
|
|
@ -132,7 +94,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 15, |
|
|
|
"execution_count": null, |
|
|
|
"id": "0696acb1-0b05-4dc2-80d5-771be04f1fb2", |
|
|
|
"id": "0696acb1-0b05-4dc2-80d5-771be04f1fb2", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -149,35 +111,17 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 16, |
|
|
|
"execution_count": null, |
|
|
|
"id": "80ca4e09-6287-4d3f-997d-fa6afbcf6c85", |
|
|
|
"id": "80ca4e09-6287-4d3f-997d-fa6afbcf6c85", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"Tool get_ticket_price called for Berlin\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/plain": [ |
|
|
|
|
|
|
|
"'$499'" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"execution_count": 16, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"get_ticket_price(\"Berlin\")" |
|
|
|
"get_ticket_price(\"Berlin\")" |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 17, |
|
|
|
"execution_count": null, |
|
|
|
"id": "4afceded-7178-4c05-8fa6-9f2085e6a344", |
|
|
|
"id": "4afceded-7178-4c05-8fa6-9f2085e6a344", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -203,7 +147,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 18, |
|
|
|
"execution_count": null, |
|
|
|
"id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", |
|
|
|
"id": "bdca8679-935f-4e7f-97e6-e71a4d4f228c", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -229,7 +173,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 19, |
|
|
|
"execution_count": null, |
|
|
|
"id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", |
|
|
|
"id": "ce9b0744-9c78-408d-b9df-9f6fd9ed78cf", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -250,7 +194,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 20, |
|
|
|
"execution_count": null, |
|
|
|
"id": "b0992986-ea09-4912-a076-8e5603ee631f", |
|
|
|
"id": "b0992986-ea09-4912-a076-8e5603ee631f", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -272,47 +216,17 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 21, |
|
|
|
"execution_count": null, |
|
|
|
"id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", |
|
|
|
"id": "f4be8a71-b19e-4c2f-80df-f59ff2661f14", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"* Running on local URL: http://127.0.0.1:7862\n", |
|
|
|
|
|
|
|
"\n", |
|
|
|
|
|
|
|
"To create a public link, set `share=True` in `launch()`.\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/html": [ |
|
|
|
|
|
|
|
"<div><iframe src=\"http://127.0.0.1:7862/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>" |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"text/plain": [ |
|
|
|
|
|
|
|
"<IPython.core.display.HTML object>" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "display_data" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/plain": [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"execution_count": 21, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"gr.ChatInterface(fn=chat, type=\"messages\").launch()" |
|
|
|
"gr.ChatInterface(fn=chat, type=\"messages\").launch()" |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 22, |
|
|
|
"execution_count": null, |
|
|
|
"id": "11c9da69-d0cf-4cf2-a49e-e5669deec47b", |
|
|
|
"id": "11c9da69-d0cf-4cf2-a49e-e5669deec47b", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -332,28 +246,10 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 23, |
|
|
|
"execution_count": null, |
|
|
|
"id": "073207fb-a161-49e0-9ca8-60ccf588aa72", |
|
|
|
"id": "073207fb-a161-49e0-9ca8-60ccf588aa72", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"Tool get_flight_booking_status for berlin\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/plain": [ |
|
|
|
|
|
|
|
"'payment issue'" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"execution_count": 23, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"#test the tool \n", |
|
|
|
"#test the tool \n", |
|
|
|
"get_flight_booking_status(\"berlin\")" |
|
|
|
"get_flight_booking_status(\"berlin\")" |
|
|
@ -361,7 +257,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 24, |
|
|
|
"execution_count": null, |
|
|
|
"id": "76bc29f6-1bfc-4c4b-afb0-1b678b5b02d4", |
|
|
|
"id": "76bc29f6-1bfc-4c4b-afb0-1b678b5b02d4", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -387,7 +283,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 25, |
|
|
|
"execution_count": null, |
|
|
|
"id": "221e2406-f19c-4ca6-a384-9876904be1b5", |
|
|
|
"id": "221e2406-f19c-4ca6-a384-9876904be1b5", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -398,7 +294,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 26, |
|
|
|
"execution_count": null, |
|
|
|
"id": "c067cd26-562d-487c-9d32-e2e8cdd17796", |
|
|
|
"id": "c067cd26-562d-487c-9d32-e2e8cdd17796", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -421,7 +317,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 27, |
|
|
|
"execution_count": null, |
|
|
|
"id": "5bb6313b-d84c-4a77-b2f1-efd17554a553", |
|
|
|
"id": "5bb6313b-d84c-4a77-b2f1-efd17554a553", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [], |
|
|
|
"outputs": [], |
|
|
@ -445,48 +341,10 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"cell_type": "code", |
|
|
|
"cell_type": "code", |
|
|
|
"execution_count": 28, |
|
|
|
"execution_count": null, |
|
|
|
"id": "b184d72c-da31-43ad-b7bf-27cf4525b35b", |
|
|
|
"id": "b184d72c-da31-43ad-b7bf-27cf4525b35b", |
|
|
|
"metadata": {}, |
|
|
|
"metadata": {}, |
|
|
|
"outputs": [ |
|
|
|
"outputs": [], |
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"* Running on local URL: http://127.0.0.1:7863\n", |
|
|
|
|
|
|
|
"\n", |
|
|
|
|
|
|
|
"To create a public link, set `share=True` in `launch()`.\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/html": [ |
|
|
|
|
|
|
|
"<div><iframe src=\"http://127.0.0.1:7863/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>" |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"text/plain": [ |
|
|
|
|
|
|
|
"<IPython.core.display.HTML object>" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "display_data" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"data": { |
|
|
|
|
|
|
|
"text/plain": [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"execution_count": 28, |
|
|
|
|
|
|
|
"metadata": {}, |
|
|
|
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"name": "stdout", |
|
|
|
|
|
|
|
"output_type": "stream", |
|
|
|
|
|
|
|
"text": [ |
|
|
|
|
|
|
|
"Tool get_flight_booking_status for London\n", |
|
|
|
|
|
|
|
"Tool get_flight_booking_status for Berlin\n" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
"source": [ |
|
|
|
"source": [ |
|
|
|
"gr.ChatInterface(fn=chat, type=\"messages\").launch()" |
|
|
|
"gr.ChatInterface(fn=chat, type=\"messages\").launch()" |
|
|
|
] |
|
|
|
] |
|
|
|