@@ -40,7 +40,7 @@ agent = Agent(
40
40
41
41
42
42
@agent.tool_plain # (3)!
43
- def roll_die () -> str :
43
+ def roll_dice () -> str :
44
44
""" Roll a six-sided die and return the result."""
45
45
return str (random.randint(1 , 6 ))
46
46
@@ -87,7 +87,7 @@ print(dice_result.all_messages())
87
87
ModelResponse(
88
88
parts=[
89
89
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'
91
91
)
92
92
],
93
93
usage=Usage(requests=1, request_tokens=90, response_tokens=2, total_tokens=92),
@@ -97,7 +97,7 @@ print(dice_result.all_messages())
97
97
ModelRequest(
98
98
parts=[
99
99
ToolReturnPart(
100
- tool_name='roll_die ',
100
+ tool_name='roll_dice ',
101
101
content='4',
102
102
tool_call_id='pyd_ai_tool_call_id',
103
103
timestamp=datetime.datetime(...),
@@ -152,7 +152,7 @@ sequenceDiagram
152
152
activate LLM
153
153
Note over LLM: LLM decides to use<br>a tool
154
154
155
- LLM ->> Agent: Call tool<br>roll_die ()
155
+ LLM ->> Agent: Call tool<br>roll_dice ()
156
156
deactivate LLM
157
157
activate Agent
158
158
Note over Agent: Rolls a six-sided die
@@ -192,7 +192,7 @@ Use the player's name in the response.
192
192
"""
193
193
194
194
195
- def roll_die () -> str :
195
+ def roll_dice () -> str :
196
196
""" Roll a six-sided die and return the result."""
197
197
return str (random.randint(1 , 6 ))
198
198
@@ -205,14 +205,14 @@ def get_player_name(ctx: RunContext[str]) -> str:
205
205
agent_a = Agent(
206
206
' google-gla:gemini-1.5-flash' ,
207
207
deps_type = str ,
208
- tools = [roll_die , get_player_name], # (1)!
208
+ tools = [roll_dice , get_player_name], # (1)!
209
209
system_prompt = system_prompt,
210
210
)
211
211
agent_b = Agent(
212
212
' google-gla:gemini-1.5-flash' ,
213
213
deps_type = str ,
214
214
tools = [ # (2)!
215
- Tool(roll_die , takes_ctx = False ),
215
+ Tool(roll_dice , takes_ctx = False ),
216
216
Tool(get_player_name, takes_ctx = True ),
217
217
],
218
218
system_prompt = system_prompt,
0 commit comments