Spaces:
Running
Running
Ankush Rana
commited on
Commit
·
52d666b
1
Parent(s):
4df1795
change parms
Browse files- .gitignore +2 -1
- managed_context/metadata.json +1 -0
- test_suite_analysis/metadata.json +1 -0
- tools.py +31 -31
.gitignore
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
venv/
|
2 |
.env
|
3 |
-
__pycache__
|
|
|
|
1 |
venv/
|
2 |
.env
|
3 |
+
__pycache__
|
4 |
+
.qodo
|
managed_context/metadata.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"current_schema_version":"0.0.1"}
|
test_suite_analysis/metadata.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"current_schema_version":"0.0.1"}
|
tools.py
CHANGED
@@ -171,25 +171,25 @@ class check_room_availability(ToolBase):
|
|
171 |
Checks if a specified room type is available between the provided check-in and check-out dates for a given number of guests.
|
172 |
"""
|
173 |
room_type: str = Field(default=list(json_data["room_types"].keys()), description="The type of room the user is interested in")
|
174 |
-
|
175 |
-
|
176 |
guests: int = Field(description="The number of guests that will occupy the room.")
|
177 |
|
178 |
@classmethod
|
179 |
def invoke(cls, input: Dict) -> str:
|
180 |
|
181 |
room_type = input.get("room_type", None)
|
182 |
-
|
183 |
-
|
184 |
guests = input.get("guests", None)
|
185 |
|
186 |
missing = []
|
187 |
if not room_type:
|
188 |
missing.append("room_type")
|
189 |
-
if not
|
190 |
-
missing.append("
|
191 |
-
if not
|
192 |
-
missing.append("
|
193 |
if not guests:
|
194 |
missing.append("guests")
|
195 |
|
@@ -199,8 +199,8 @@ class check_room_availability(ToolBase):
|
|
199 |
|
200 |
instance = cls(**input)
|
201 |
room_type = instance.room_type
|
202 |
-
|
203 |
-
|
204 |
guests = instance.guests
|
205 |
|
206 |
rooms = [room for room in json_data["accomodations"]["rooms"] if room_type in room["type"]]
|
@@ -223,26 +223,26 @@ class make_reservation(ToolBase):
|
|
223 |
|
224 |
user_name: str = Field(description="The name of user who is doing the reservation.")
|
225 |
room_type: str = Field(default=list(json_data["room_types"].keys()), description="The type of room being reserved.")
|
226 |
-
|
227 |
-
|
228 |
-
guests: int = Field(description="The number of guests for the reservation.")
|
229 |
|
230 |
@classmethod
|
231 |
def invoke(cls, input: Dict) -> str:
|
232 |
|
233 |
room_type = input.get("room_type", None)
|
234 |
-
|
235 |
-
|
236 |
guests = input.get("guests", None)
|
237 |
user_name = input.get("user_name", None)
|
238 |
|
239 |
missing = []
|
240 |
if not room_type:
|
241 |
missing.append("room_type")
|
242 |
-
if not
|
243 |
-
missing.append("
|
244 |
-
if not
|
245 |
-
missing.append("
|
246 |
if not guests:
|
247 |
missing.append("guests")
|
248 |
if not user_name:
|
@@ -255,8 +255,8 @@ class make_reservation(ToolBase):
|
|
255 |
|
256 |
instance = cls(**input)
|
257 |
room_type = instance.room_type
|
258 |
-
|
259 |
-
|
260 |
guests = instance.guests
|
261 |
user_name = instance.user_name.lower()
|
262 |
|
@@ -279,8 +279,8 @@ class make_reservation(ToolBase):
|
|
279 |
"status": "Reserved",
|
280 |
"room_number": room["room_number"],
|
281 |
"room_type": room_type,
|
282 |
-
"
|
283 |
-
"
|
284 |
"guests": guests,
|
285 |
"reservation_id": rand,
|
286 |
"user_name": user_name,
|
@@ -328,8 +328,8 @@ class modify_reservation(ToolBase):
|
|
328 |
|
329 |
|
330 |
new_room_type: str | None = Field(default=list(json_data["room_types"].keys()), description=f"The type of new room to be modified, if {None} same room will be modified.")
|
331 |
-
|
332 |
-
|
333 |
guests: int = Field(default=None, description="New number of guests for the reservation.")
|
334 |
reservation_id: int = Field(description="The unique identifier of the reservation to be modified.")
|
335 |
|
@@ -344,8 +344,8 @@ class modify_reservation(ToolBase):
|
|
344 |
|
345 |
instance = cls(**input)
|
346 |
new_room_type = instance.new_room_type
|
347 |
-
|
348 |
-
|
349 |
guests = instance.guests
|
350 |
reservation_id = instance.reservation_id
|
351 |
|
@@ -353,8 +353,8 @@ class modify_reservation(ToolBase):
|
|
353 |
value = ", ".join(missing)
|
354 |
return f"Unable to modify the reservation. The following required arguments are missing:{value}."
|
355 |
|
356 |
-
if not (new_room_type or
|
357 |
-
return "Unable to modify the reservation. One of the following arguments must be passed: new_room_type,
|
358 |
|
359 |
|
360 |
if reservation_id not in reservations:
|
@@ -377,8 +377,8 @@ class modify_reservation(ToolBase):
|
|
377 |
|
378 |
|
379 |
reservations[reservation_id]["guests"] = guests if guests else reservations[reservation_id]["guests"]
|
380 |
-
reservations[reservation_id]["
|
381 |
-
reservations[reservation_id]["
|
382 |
reservations[reservation_id]["room_type"] = new_room_type if new_room_type else reservations[reservation_id]["room_type"]
|
383 |
reservations[reservation_id]["room_number"] = room_number
|
384 |
tmp_data = reservations[reservation_id]
|
|
|
171 |
Checks if a specified room type is available between the provided check-in and check-out dates for a given number of guests.
|
172 |
"""
|
173 |
room_type: str = Field(default=list(json_data["room_types"].keys()), description="The type of room the user is interested in")
|
174 |
+
reservation_start_date: str = Field(description="The check-in date for the reservation, formatted as 'YYYY-MM-DD' (e.g., '2025-04-01')")
|
175 |
+
reservation_end_date: str = Field(description="The check-out date for the reservation, formatted as 'YYYY-MM-DD' (e.g., '2025-04-05')")
|
176 |
guests: int = Field(description="The number of guests that will occupy the room.")
|
177 |
|
178 |
@classmethod
|
179 |
def invoke(cls, input: Dict) -> str:
|
180 |
|
181 |
room_type = input.get("room_type", None)
|
182 |
+
reservation_start_date = input.get("reservation_start_date", None)
|
183 |
+
reservation_end_date = input.get("reservation_end_date", None)
|
184 |
guests = input.get("guests", None)
|
185 |
|
186 |
missing = []
|
187 |
if not room_type:
|
188 |
missing.append("room_type")
|
189 |
+
if not reservation_start_date:
|
190 |
+
missing.append("reservation_start_date")
|
191 |
+
if not reservation_end_date:
|
192 |
+
missing.append("reservation_end_date")
|
193 |
if not guests:
|
194 |
missing.append("guests")
|
195 |
|
|
|
199 |
|
200 |
instance = cls(**input)
|
201 |
room_type = instance.room_type
|
202 |
+
reservation_start_date = instance.reservation_start_date
|
203 |
+
reservation_end_date = instance.reservation_end_date
|
204 |
guests = instance.guests
|
205 |
|
206 |
rooms = [room for room in json_data["accomodations"]["rooms"] if room_type in room["type"]]
|
|
|
223 |
|
224 |
user_name: str = Field(description="The name of user who is doing the reservation.")
|
225 |
room_type: str = Field(default=list(json_data["room_types"].keys()), description="The type of room being reserved.")
|
226 |
+
reservation_start_date: str = Field(description="The check-in date for the reservation, formatted as 'YYYY-MM-DD' (e.g., '2025-04-01')")
|
227 |
+
reservation_end_date: str = Field(description="The check-out date for the reservation, formatted as 'YYYY-MM-DD' (e.g., '2025-04-05')")
|
228 |
+
guests: int = Field(description="The total number of guests for the reservation. Must be a positive integer.")
|
229 |
|
230 |
@classmethod
|
231 |
def invoke(cls, input: Dict) -> str:
|
232 |
|
233 |
room_type = input.get("room_type", None)
|
234 |
+
reservation_start_date = input.get("reservation_start_date", None)
|
235 |
+
reservation_end_date = input.get("reservation_end_date", None)
|
236 |
guests = input.get("guests", None)
|
237 |
user_name = input.get("user_name", None)
|
238 |
|
239 |
missing = []
|
240 |
if not room_type:
|
241 |
missing.append("room_type")
|
242 |
+
if not reservation_start_date:
|
243 |
+
missing.append("reservation_start_date")
|
244 |
+
if not reservation_end_date:
|
245 |
+
missing.append("reservation_end_date")
|
246 |
if not guests:
|
247 |
missing.append("guests")
|
248 |
if not user_name:
|
|
|
255 |
|
256 |
instance = cls(**input)
|
257 |
room_type = instance.room_type
|
258 |
+
reservation_start_date = instance.reservation_start_date
|
259 |
+
reservation_end_date = instance.reservation_end_date
|
260 |
guests = instance.guests
|
261 |
user_name = instance.user_name.lower()
|
262 |
|
|
|
279 |
"status": "Reserved",
|
280 |
"room_number": room["room_number"],
|
281 |
"room_type": room_type,
|
282 |
+
"reservation_start_date": reservation_start_date,
|
283 |
+
"reservation_end_date": reservation_end_date,
|
284 |
"guests": guests,
|
285 |
"reservation_id": rand,
|
286 |
"user_name": user_name,
|
|
|
328 |
|
329 |
|
330 |
new_room_type: str | None = Field(default=list(json_data["room_types"].keys()), description=f"The type of new room to be modified, if {None} same room will be modified.")
|
331 |
+
new_reservation_start_date: str = Field(default=None, description="New check out date in format DD/MM/YYYY")
|
332 |
+
new_reservation_end_date: str = Field(default=None, description="New check out date in format DD/MM/YYYY")
|
333 |
guests: int = Field(default=None, description="New number of guests for the reservation.")
|
334 |
reservation_id: int = Field(description="The unique identifier of the reservation to be modified.")
|
335 |
|
|
|
344 |
|
345 |
instance = cls(**input)
|
346 |
new_room_type = instance.new_room_type
|
347 |
+
new_reservation_start_date = instance.new_reservation_start_date
|
348 |
+
new_reservation_end_date = instance.new_reservation_end_date
|
349 |
guests = instance.guests
|
350 |
reservation_id = instance.reservation_id
|
351 |
|
|
|
353 |
value = ", ".join(missing)
|
354 |
return f"Unable to modify the reservation. The following required arguments are missing:{value}."
|
355 |
|
356 |
+
if not (new_room_type or new_reservation_start_date or new_reservation_end_date or guests):
|
357 |
+
return "Unable to modify the reservation. One of the following arguments must be passed: new_room_type, new_reservation_start_date, new_reservation_end_date, guests."
|
358 |
|
359 |
|
360 |
if reservation_id not in reservations:
|
|
|
377 |
|
378 |
|
379 |
reservations[reservation_id]["guests"] = guests if guests else reservations[reservation_id]["guests"]
|
380 |
+
reservations[reservation_id]["reservation_start_date"] = new_reservation_start_date if new_reservation_start_date else reservations[reservation_id]["reservation_start_date"]
|
381 |
+
reservations[reservation_id]["reservation_end_date"] = new_reservation_end_date if new_reservation_end_date else reservations[reservation_id]["reservation_end_date"]
|
382 |
reservations[reservation_id]["room_type"] = new_room_type if new_room_type else reservations[reservation_id]["room_type"]
|
383 |
reservations[reservation_id]["room_number"] = room_number
|
384 |
tmp_data = reservations[reservation_id]
|