File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,15 @@ The most common properties of an agent you'll configure are:
13
13
``` python
14
14
from agents import Agent, ModelSettings, function_tool
15
15
16
+ @function_tool
16
17
def get_weather (city : str ) -> str :
17
18
return f " The weather in { city} is sunny "
18
19
19
20
agent = Agent(
20
21
name = " Haiku agent" ,
21
22
instructions = " Always respond in haiku form" ,
22
23
model = " o3-mini" ,
23
- tools = [function_tool( get_weather) ],
24
+ tools = [get_weather],
24
25
)
25
26
```
26
27
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class UserInfo: # (1)!
36
36
name: str
37
37
uid: int
38
38
39
+ @function_tool
39
40
async def fetch_user_age (wrapper : RunContextWrapper[UserInfo]) -> str : # (2)!
40
41
return f " User { wrapper.context.name} is 47 years old "
41
42
@@ -44,7 +45,7 @@ async def main():
44
45
45
46
agent = Agent[UserInfo]( # (4)!
46
47
name = " Assistant" ,
47
- tools = [function_tool( fetch_user_age) ],
48
+ tools = [fetch_user_age],
48
49
)
49
50
50
51
result = await Runner.run(
You can’t perform that action at this time.
0 commit comments