fix annotation numbering in context management

Fix inconsistent numbering between code and explanatory annotations in
the context management documentation.
This commit is contained in:
Han Hwang Lim 2025-03-21 21:10:30 +00:00
parent 211ffb28c5
commit d56047be51

View file

@ -41,14 +41,14 @@ async def fetch_user_age(wrapper: RunContextWrapper[UserInfo]) -> str: # (2)!
return f"User {wrapper.context.name} is 47 years old" return f"User {wrapper.context.name} is 47 years old"
async def main(): async def main():
user_info = UserInfo(name="John", uid=123) # (3)! user_info = UserInfo(name="John", uid=123)
agent = Agent[UserInfo]( # (4)! agent = Agent[UserInfo]( # (3)!
name="Assistant", name="Assistant",
tools=[fetch_user_age], tools=[fetch_user_age],
) )
result = await Runner.run( result = await Runner.run( # (4)!
starting_agent=agent, starting_agent=agent,
input="What is the age of the user?", input="What is the age of the user?",
context=user_info, context=user_info,