|
|
|
@ -10,7 +10,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 1, |
|
|
|
|
"id": "70e39cd8-ec79-4e3e-9c26-5659d42d0861", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -25,10 +25,20 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 2, |
|
|
|
|
"id": "231605aa-fccb-447e-89cf-8b187444536a", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"outputs": [ |
|
|
|
|
{ |
|
|
|
|
"name": "stdout", |
|
|
|
|
"output_type": "stream", |
|
|
|
|
"text": [ |
|
|
|
|
"OpenAI API Key exists and begins sk-proj-\n", |
|
|
|
|
"Anthropic API Key exists and begins sk-ant-\n", |
|
|
|
|
"Google API Key exists and begins AIzaSyA-\n" |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"source": [ |
|
|
|
|
"# Load environment variables in a file called .env\n", |
|
|
|
|
"# Print the key prefixes to help with any debugging\n", |
|
|
|
@ -56,7 +66,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 3, |
|
|
|
|
"id": "6541d58e-2297-4de1-b1f7-77da1b98b8bb", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -69,7 +79,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 4, |
|
|
|
|
"id": "e16839b5-c03b-4d9d-add6-87a0f6f37575", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -112,7 +122,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 5, |
|
|
|
|
"id": "1eacc8a4-4b48-4358-9e06-ce0020041bc1", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -156,7 +166,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 8, |
|
|
|
|
"id": "1f91b414-8bab-472d-b9c9-3fa51259bdfe", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -170,7 +180,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 9, |
|
|
|
|
"id": "4e5be3ec-c26c-42bc-ac16-c39d369883f6", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -198,7 +208,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 10, |
|
|
|
|
"id": "d75f0ffa-55c8-4152-b451-945021676837", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -219,13 +229,14 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 13, |
|
|
|
|
"id": "0a987a66-1061-46d6-a83a-a30859dc88bf", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
|
"source": [ |
|
|
|
|
"# Fixed a bug in this function brilliantly identified by student Gabor M.!\n", |
|
|
|
|
"# I've also improved the structure of this function\n", |
|
|
|
|
"# Paul Goodwin added \"Buy One get one free offer\" for a bit of fun\n", |
|
|
|
|
"\n", |
|
|
|
|
"def chat(message, history):\n", |
|
|
|
|
"\n", |
|
|
|
@ -253,10 +264,40 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 14, |
|
|
|
|
"id": "20570de2-eaad-42cc-a92c-c779d71b48b6", |
|
|
|
|
"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": 14, |
|
|
|
|
"metadata": {}, |
|
|
|
|
"output_type": "execute_result" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
"source": [ |
|
|
|
|
"gr.ChatInterface(fn=chat, type=\"messages\").launch()" |
|
|
|
|
] |
|
|
|
|