Spaces:
Sleeping
Sleeping
Modify function doc string to allow more accurate response on location
Browse files
app.py
CHANGED
|
@@ -11,14 +11,14 @@ from Gradio_UI import GradioUI
|
|
| 11 |
search_tool = DuckDuckGoSearchTool()
|
| 12 |
|
| 13 |
@tool
|
| 14 |
-
def
|
| 15 |
cuisine: str = None,
|
| 16 |
rating: float = None,
|
| 17 |
timezone: str = None
|
| 18 |
)-> str:
|
| 19 |
"""A tool that searches for restaurants according to location, cuisine, rating and local time.
|
| 20 |
Args:
|
| 21 |
-
location: A string representing the location area to search for open restaurants.
|
| 22 |
cuisine: An optional string representing the cuisine type (e.g. Asian, Indian, Italian, breakfast, lunch, etc.)
|
| 23 |
rating: An optional float representing the average customer rating of the restaurant from Google, TripAdvisor, or Yelp.
|
| 24 |
timezone: An optional string representing a valid timezone (e.g., 'America/New_York').
|
|
@@ -32,7 +32,7 @@ def find_restaurants_by_location(location: str,
|
|
| 32 |
local_time = datetime.datetime.now(tz).strftime("%H:%M")
|
| 33 |
|
| 34 |
# Build query dynamically based on provided inputs
|
| 35 |
-
query_parts = [f
|
| 36 |
if cuisine:
|
| 37 |
query_parts.append(f"serving {cuisine} cuisine")
|
| 38 |
if rating:
|
|
@@ -89,7 +89,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 89 |
|
| 90 |
agent = CodeAgent(
|
| 91 |
model=model,
|
| 92 |
-
tools=[final_answer, get_current_time_in_timezone,
|
| 93 |
max_steps=6,
|
| 94 |
verbosity_level=1,
|
| 95 |
grammar=None,
|
|
|
|
| 11 |
search_tool = DuckDuckGoSearchTool()
|
| 12 |
|
| 13 |
@tool
|
| 14 |
+
def find_open_restaurants_by_location(location: str,
|
| 15 |
cuisine: str = None,
|
| 16 |
rating: float = None,
|
| 17 |
timezone: str = None
|
| 18 |
)-> str:
|
| 19 |
"""A tool that searches for restaurants according to location, cuisine, rating and local time.
|
| 20 |
Args:
|
| 21 |
+
location: A string representing the location area with the optional inclusion of a zip code to search for open restaurants (e.g. Paris, Paris 75005, London, London NW1 4RY).
|
| 22 |
cuisine: An optional string representing the cuisine type (e.g. Asian, Indian, Italian, breakfast, lunch, etc.)
|
| 23 |
rating: An optional float representing the average customer rating of the restaurant from Google, TripAdvisor, or Yelp.
|
| 24 |
timezone: An optional string representing a valid timezone (e.g., 'America/New_York').
|
|
|
|
| 32 |
local_time = datetime.datetime.now(tz).strftime("%H:%M")
|
| 33 |
|
| 34 |
# Build query dynamically based on provided inputs
|
| 35 |
+
query_parts = [f'restaurants open in "{location}"']
|
| 36 |
if cuisine:
|
| 37 |
query_parts.append(f"serving {cuisine} cuisine")
|
| 38 |
if rating:
|
|
|
|
| 89 |
|
| 90 |
agent = CodeAgent(
|
| 91 |
model=model,
|
| 92 |
+
tools=[final_answer, get_current_time_in_timezone, find_open_restaurants_by_location], ## add your tools here (don't remove final answer)
|
| 93 |
max_steps=6,
|
| 94 |
verbosity_level=1,
|
| 95 |
grammar=None,
|