Skip to content

Commit 7727dac

Browse files
ZackAkilkoverholt
andauthored
added interactive conversation within notebook (#241)
Co-authored-by: Kristopher Overholt <[email protected]>
1 parent 6d8d499 commit 7727dac

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

examples/python/notebooks/adk_tutorial.ipynb

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@
400400
"\n",
401401
"**5\\. Run the Conversation**\n",
402402
"\n",
403-
"Finally, let's test our setup by sending a few queries to the agent. We wrap our `async` calls in a main `async` function and run it using `await`.\n",
403+
"Let's test our setup by sending a few queries to the agent. We wrap our `async` calls in a main `async` function and run it using `await`.\n",
404404
"\n",
405405
"Watch the output:\n",
406406
"\n",
@@ -440,6 +440,37 @@
440440
"await run_conversation()"
441441
]
442442
},
443+
{
444+
"cell_type": "markdown",
445+
"metadata": {},
446+
"source": [
447+
"---\n",
448+
"**6\\. Interactive Conversation**\n",
449+
"\n",
450+
"Now, let's make this interactive so you can ask your own questions! Run the cell below. It will prompt you to enter your queries directly."
451+
]
452+
},
453+
{
454+
"cell_type": "code",
455+
"execution_count": null,
456+
"metadata": {},
457+
"outputs": [],
458+
"source": [
459+
"async def run_interactive_conversation():\n",
460+
" while True:\n",
461+
" user_query = input(\"Ask me something (or type 'exit' to quit): \")\n",
462+
" if user_query.lower() == 'exit':\n",
463+
" break\n",
464+
" response = await call_agent_async(user_query,\n",
465+
" runner=runner,\n",
466+
" user_id=USER_ID,\n",
467+
" session_id=SESSION_ID)\n",
468+
" print(f\"Response: {response}\")\n",
469+
"\n",
470+
"# Execute the interactive conversation\n",
471+
"await run_interactive_conversation()"
472+
]
473+
},
443474
{
444475
"cell_type": "markdown",
445476
"metadata": {

0 commit comments

Comments
 (0)