Skip to content

Commit 89d460a

Browse files
Added DeleteConversation to HTTP notebook (#2389)
1 parent e6624bd commit 89d460a

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

agents/gemini_data_analytics/intro_gemini_data_analytics_http.ipynb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"1. Authenticate to Google Cloud\n",
6868
"2. Add data\n",
6969
"3. Perform agent operations (create, list, get, delete)\n",
70-
"4. Manage conversations (create, list, get)\n",
70+
"4. Manage conversations (create, list, get, delete)\n",
7171
"5. Ask questions with your agent\n"
7272
]
7373
},
@@ -744,6 +744,33 @@
744744
" print(conversation_response.text)"
745745
]
746746
},
747+
{
748+
"cell_type": "code",
749+
"execution_count": null,
750+
"metadata": {
751+
"id": "3TASe-HCxtss"
752+
},
753+
"outputs": [],
754+
"source": [
755+
"# @title Delete Conversation\n",
756+
"\n",
757+
"# fmt: off\n",
758+
"conversation_id = \"conversation_1\" # @param {type:\"string\"}\n",
759+
"# fmt: on\n",
760+
"\n",
761+
"conversation_url = f\"{base_url}/{api_version}/projects/{billing_project}/locations/{location}/conversations/{conversation_id}\"\n",
762+
"\n",
763+
"conversation_response = requests.delete(conversation_url, headers=headers)\n",
764+
"\n",
765+
"# Handle the response\n",
766+
"if conversation_response.status_code == 200:\n",
767+
" print(\"Conversation deleted successfully!\")\n",
768+
" print(json.dumps(conversation_response.json(), indent=2))\n",
769+
"else:\n",
770+
" print(f\"Error while deleting conversation: {conversation_response.status_code}\")\n",
771+
" print(conversation_response.text)"
772+
]
773+
},
747774
{
748775
"cell_type": "code",
749776
"execution_count": null,

0 commit comments

Comments
 (0)