Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0475450

Browse files
ccmienchenchaomin
andauthored
replace .py file with .ipynb for Jupyter example (openai#262)
Co-authored-by: chenchaomin <[email protected]>
1 parent 816b770 commit 0475450

File tree

3 files changed

+46
-12
lines changed

3 files changed

+46
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ print(result.final_output)
5757

5858
(_If running this, ensure you set the `OPENAI_API_KEY` environment variable_)
5959

60-
(_For Jupyter notebook users, see [hello_world_jupyter.py](examples/basic/hello_world_jupyter.py)_)
60+
(_For Jupyter notebook users, see [hello_world_jupyter.ipynb](examples/basic/hello_world_jupyter.ipynb)_)
6161

6262
## Handoffs example
6363

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "8a77ee2e-22f2-409c-837d-b994978b0aa2",
7+
"metadata": {},
8+
"outputs": [
9+
{
10+
"name": "stdout",
11+
"output_type": "stream",
12+
"text": [
13+
"A function calls self, \n",
14+
"Unraveling layers deep, \n",
15+
"Base case ends the quest. \n",
16+
"\n",
17+
"Infinite loops lurk, \n",
18+
"Mind the base condition well, \n",
19+
"Or it will not work. \n",
20+
"\n",
21+
"Trees and lists unfold, \n",
22+
"Elegant solutions bloom, \n",
23+
"Recursion's art told.\n"
24+
]
25+
}
26+
],
27+
"source": [
28+
"from agents import Agent, Runner\n",
29+
"\n",
30+
"agent = Agent(name=\"Assistant\", instructions=\"You are a helpful assistant\")\n",
31+
"\n",
32+
"# Intended for Jupyter notebooks where there's an existing event loop\n",
33+
"result = await Runner.run(agent, \"Write a haiku about recursion in programming.\") # type: ignore[top-level-await] # noqa: F704\n",
34+
"print(result.final_output)"
35+
]
36+
}
37+
],
38+
"metadata": {
39+
"language_info": {
40+
"name": "python"
41+
}
42+
},
43+
"nbformat": 4,
44+
"nbformat_minor": 5
45+
}

examples/basic/hello_world_jupyter.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)