diff --git a/examples/prompting/Basic_Code_Generation.ipynb b/examples/prompting/Basic_Code_Generation.ipynb index 216a03b3a..0762008fc 100644 --- a/examples/prompting/Basic_Code_Generation.ipynb +++ b/examples/prompting/Basic_Code_Generation.ipynb @@ -11,15 +11,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD "execution_count": null, -======= - "execution_count": 1, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": null, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) "metadata": { "cellView": "form", "id": "vQoUR__bUlfj" @@ -74,15 +66,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 1, -======= - "execution_count": 2, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 1, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "Ne-3gnXqR0hI" }, @@ -93,15 +77,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 2, -======= - "execution_count": 3, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 2, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "EconMHePQHGw" }, @@ -125,15 +101,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 3, -======= - "execution_count": 4, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 3, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "v-JZzORUpVR2" }, @@ -165,60 +133,11 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 4, -======= - "execution_count": 5, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 4, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "kVF8ZQ38Vs1P" }, "outputs": [], -<<<<<<< HEAD - "source": [ - "error_handling_system_prompt =f\"\"\"\n", - "Your task is to explain exactly why this error occurred and how to fix it.\n", - "\"\"\"\n", - "error_handling_model = genai.GenerativeModel(model_name='gemini-1.5-flash-latest', generation_config={\"temperature\": 0},\n", - " system_instruction=error_handling_system_prompt)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "id": "CHTdAVE0pIFf" - }, - "outputs": [ - { - "data": { - "text/markdown": "The error message \"IndexError: list index out of range\" means you're trying to access an element in a list using an index that doesn't exist.\n\n**Explanation:**\n\n* **List Indexing:** In Python, lists are zero-indexed. This means the first element has an index of 0, the second element has an index of 1, and so on.\n* **Your Code:** In your code, `my_list = [1, 2, 3]` has three elements. The valid indices for this list are 0, 1, and 2.\n* **The Error:** You're trying to access `my_list[3]`. Since the list only has three elements, there is no element at index 3. This causes the \"IndexError: list index out of range\" error.\n\n**How to Fix It:**\n\n1. **Check the Index:** Ensure the index you're using is within the valid range of the list. In this case, you should use an index between 0 and 2.\n2. **Adjust the Code:** To access the last element of the list, use `my_list[2]`.\n\n**Corrected Code:**\n\n```python\nmy_list = [1, 2, 3]\nprint(my_list[2]) # This will print 3\n```\n\n**Important Note:** Always be mindful of the size of your lists and the indices you use to avoid this common error. \n", - "text/plain": [ - "" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "error_message = \"\"\"\n", - " 1 my_list = [1,2,3]\n", - "----> 2 print(my_list[3])\n", - "\n", - "IndexError: list index out of range\n", - "\"\"\"\n", - "\n", - "error_prompt = f\"\"\"\n", - "You've encountered the following error message:\n", - "Error Message: {error_message}\"\"\"\n", - "\n", -======= "source": [ "error_handling_system_prompt =f\"\"\"\n", "Your task is to explain exactly why this error occurred and how to fix it.\n", @@ -229,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "id": "CHTdAVE0pIFf" }, @@ -258,7 +177,6 @@ "You've encountered the following error message:\n", "Error Message: {error_message}\"\"\"\n", "\n", ->>>>>>> 757cc02 (Update basic code generation) "Markdown(error_handling_model.generate_content(error_prompt).text)" ] }, @@ -273,15 +191,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 6, -======= - "execution_count": 7, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 6, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "1T1QSzjVVvE_" }, @@ -300,15 +210,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 7, -======= - "execution_count": 8, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 7, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "8KVpzExDqRj2" }, @@ -320,15 +222,7 @@ "" ] }, -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 7, -======= - "execution_count": 8, ->>>>>>> 757cc02 (Update basic code generation) -======= "execution_count": 7, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) "metadata": {}, "output_type": "execute_result" } @@ -350,15 +244,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD -<<<<<<< HEAD - "execution_count": 8, -======= - "execution_count": 9, ->>>>>>> 757cc02 (Update basic code generation) -======= - "execution_count": 8, ->>>>>>> 7c65d32 (Update notebook with shorter prompt) + "execution_count": null, "metadata": { "id": "lOU_abTPSmZu" }, @@ -400,15 +286,7 @@ ], "metadata": { "colab": { -<<<<<<< HEAD -<<<<<<< HEAD - "name": "Basic_code_generation.ipynb", -======= "name": "Basic_Code_Generation.ipynb", ->>>>>>> 757cc02 (Update basic code generation) -======= - "name": "Basic_code_generation.ipynb", ->>>>>>> 7c65d32 (Update notebook with shorter prompt) "toc_visible": true }, "kernelspec": {