Skip to content

Commit f5f3a94

Browse files
committed
Update get_weather function to return a formatted string instead of Weather object
1 parent af0a5e6 commit f5f3a94

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

samples-v2/openai_agents/function_app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,12 @@ class Weather:
138138
conditions: str
139139

140140
@app.activity_trigger(input_name="city")
141-
async def get_weather(city: str) -> Weather:
141+
async def get_weather(city: str) -> str:
142142
"""
143143
Get the weather for a given city.
144144
"""
145-
return Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")
145+
weather = Weather(city=city, temperature_range="14-20C", conditions="Sunny with wind.")
146+
return f"Weather in {weather.city}: {weather.temperature_range}, {weather.conditions}"
146147

147148

148149
#region Implementation details

0 commit comments

Comments
 (0)