Spaces:
Running
Running
Ankush Rana
commited on
Commit
·
d2fd83d
1
Parent(s):
60b45c8
add more tools
Browse files
tools.py
CHANGED
@@ -100,7 +100,7 @@ def tool_register(cls: BaseModel):
|
|
100 |
oitools.append(oaitool)
|
101 |
tools[oaitool["function"]["name"]] = cls
|
102 |
|
103 |
-
|
104 |
class hotel_description(ToolBase):
|
105 |
"""Retrieves basic information about the hotel, such as its name, address, contact details, and overall description."""
|
106 |
|
@@ -133,26 +133,26 @@ class restaurants_details(ToolBase):
|
|
133 |
return json_data["restaurants"]
|
134 |
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
|
157 |
|
158 |
@tool_register
|
@@ -165,7 +165,7 @@ class rooms_information(ToolBase):
|
|
165 |
return json_data["room_types"]
|
166 |
|
167 |
|
168 |
-
|
169 |
class check_room_availability(ToolBase):
|
170 |
"""
|
171 |
Checks if a specified room type is available between the provided check-in and check-out dates for a given number of guests.
|
|
|
100 |
oitools.append(oaitool)
|
101 |
tools[oaitool["function"]["name"]] = cls
|
102 |
|
103 |
+
@tool_register
|
104 |
class hotel_description(ToolBase):
|
105 |
"""Retrieves basic information about the hotel, such as its name, address, contact details, and overall description."""
|
106 |
|
|
|
133 |
return json_data["restaurants"]
|
134 |
|
135 |
|
136 |
+
@tool_register
|
137 |
+
class restaurant_details(ToolBase):
|
138 |
+
"""Retrieves detailed information about a specific restaurant in the hotel, including its menu, ambiance, operating hours, and special features."""
|
139 |
|
140 |
+
name: str = Field(default=[res["name"] for res in json_data["restaurants"]], description="Name of the resaturant")
|
141 |
|
142 |
+
@classmethod
|
143 |
+
def invoke(cls, input: Dict) -> str:
|
144 |
+
"""
|
145 |
+
Play a playlist by its name, starting with the first or a random song.
|
146 |
+
"""
|
147 |
|
148 |
+
instance = cls(**input)
|
149 |
+
name = instance.name
|
150 |
|
151 |
+
restaurante = [res for res in json_data["restaurants"] if res["name"] == name]
|
152 |
+
if restaurante:
|
153 |
+
return restaurante
|
154 |
+
else:
|
155 |
+
return f"We don't have any restaurante with the name: {name}"
|
156 |
|
157 |
|
158 |
@tool_register
|
|
|
165 |
return json_data["room_types"]
|
166 |
|
167 |
|
168 |
+
@tool_register
|
169 |
class check_room_availability(ToolBase):
|
170 |
"""
|
171 |
Checks if a specified room type is available between the provided check-in and check-out dates for a given number of guests.
|