Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def main():
instructions="You are a helpful assistant.",
)

result = Runner.run_streamed(agent, input="Please tell me 5 jokes.")
result = await Runner.run_streamed(agent, input="Please tell me 5 jokes.")
async for event in result.stream_events():
if event.type == "raw_response_event" and isinstance(event.data, ResponseTextDeltaEvent):
print(event.data.delta, end="", flush=True)
Expand Down Expand Up @@ -54,7 +54,7 @@ async def main():
tools=[how_many_jokes],
)

result = Runner.run_streamed(
result = await Runner.run_streamed(
agent,
input="Hello",
)
Expand Down
6 changes: 3 additions & 3 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ from agents import RunContextWrapper, FunctionTool



def do_some_work(data: str) -> str:
return "done"
def process_user_data(username: str, age: int) -> str:
return f"{username} is {age} years old ."


class FunctionArgs(BaseModel):
Expand All @@ -202,7 +202,7 @@ class FunctionArgs(BaseModel):

async def run_function(ctx: RunContextWrapper[Any], args: str) -> str:
parsed = FunctionArgs.model_validate_json(args)
return do_some_work(data=f"{parsed.username} is {parsed.age} years old")
return process_user_data(parsed.username , parsed.age)


tool = FunctionTool(
Expand Down