@@ -40,7 +40,7 @@ agent = Agent(
4040
4141
4242@agent.tool_plain # (3)!
43- def roll_die () -> str :
43+ def roll_dice () -> str :
4444 """ Roll a six-sided die and return the result."""
4545 return str (random.randint(1 , 6 ))
4646
@@ -87,7 +87,7 @@ print(dice_result.all_messages())
8787 ModelResponse(
8888 parts=[
8989 ToolCallPart(
90- tool_name='roll_die ', args={}, tool_call_id='pyd_ai_tool_call_id'
90+ tool_name='roll_dice ', args={}, tool_call_id='pyd_ai_tool_call_id'
9191 )
9292 ],
9393 usage=Usage(requests=1, request_tokens=90, response_tokens=2, total_tokens=92),
@@ -97,7 +97,7 @@ print(dice_result.all_messages())
9797 ModelRequest(
9898 parts=[
9999 ToolReturnPart(
100- tool_name='roll_die ',
100+ tool_name='roll_dice ',
101101 content='4',
102102 tool_call_id='pyd_ai_tool_call_id',
103103 timestamp=datetime.datetime(...),
@@ -152,7 +152,7 @@ sequenceDiagram
152152 activate LLM
153153 Note over LLM: LLM decides to use<br>a tool
154154
155- LLM ->> Agent: Call tool<br>roll_die ()
155+ LLM ->> Agent: Call tool<br>roll_dice ()
156156 deactivate LLM
157157 activate Agent
158158 Note over Agent: Rolls a six-sided die
@@ -192,7 +192,7 @@ Use the player's name in the response.
192192"""
193193
194194
195- def roll_die () -> str :
195+ def roll_dice () -> str :
196196 """ Roll a six-sided die and return the result."""
197197 return str (random.randint(1 , 6 ))
198198
@@ -205,14 +205,14 @@ def get_player_name(ctx: RunContext[str]) -> str:
205205agent_a = Agent(
206206 ' google-gla:gemini-1.5-flash' ,
207207 deps_type = str ,
208- tools = [roll_die , get_player_name], # (1)!
208+ tools = [roll_dice , get_player_name], # (1)!
209209 system_prompt = system_prompt,
210210)
211211agent_b = Agent(
212212 ' google-gla:gemini-1.5-flash' ,
213213 deps_type = str ,
214214 tools = [ # (2)!
215- Tool(roll_die , takes_ctx = False ),
215+ Tool(roll_dice , takes_ctx = False ),
216216 Tool(get_player_name, takes_ctx = True ),
217217 ],
218218 system_prompt = system_prompt,
0 commit comments