Spaces:
Sleeping
Sleeping
getting locations to myagent
Browse files
app.py
CHANGED
|
@@ -80,16 +80,18 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 80 |
class MyAgent(MultiStepAgent): # defining agent flow
|
| 81 |
|
| 82 |
def step(self, memory_step: ActionStep, location: str) -> Union[None, Any]: # Add location parameter
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
| 85 |
currency_info = get_currency_from_timezone(location)
|
| 86 |
time_info = get_current_time_in_timezone(location)
|
| 87 |
|
| 88 |
-
#
|
| 89 |
print(currency_info)
|
| 90 |
print(time_info)
|
| 91 |
|
| 92 |
-
#
|
| 93 |
final_answer = f"Task outcome (short version): The currency in {timezone} is {currency_info}. The current time in {timezone} is {time_info}."
|
| 94 |
return final_answer # Return the final answer
|
| 95 |
|
|
|
|
| 80 |
class MyAgent(MultiStepAgent): # defining agent flow
|
| 81 |
|
| 82 |
def step(self, memory_step: ActionStep, location: str) -> Union[None, Any]: # Add location parameter
|
| 83 |
+
# 1. Access location from kwargs
|
| 84 |
+
location = kwargs.get("location")
|
| 85 |
+
print(f"Location received in step: {location}") # Add print statement
|
| 86 |
+
# 2. Call the tools
|
| 87 |
currency_info = get_currency_from_timezone(location)
|
| 88 |
time_info = get_current_time_in_timezone(location)
|
| 89 |
|
| 90 |
+
# 3. Print the outputs
|
| 91 |
print(currency_info)
|
| 92 |
print(time_info)
|
| 93 |
|
| 94 |
+
# 4. Final answer
|
| 95 |
final_answer = f"Task outcome (short version): The currency in {timezone} is {currency_info}. The current time in {timezone} is {time_info}."
|
| 96 |
return final_answer # Return the final answer
|
| 97 |
|