Skip to content

Commit 66b3be0

Browse files
fixed type absence case
1 parent a272dde commit 66b3be0

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

l2p/domain_builder.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,32 +289,28 @@ def extract_pddl_action(
289289
llm_response, syntax_validator.unsupported_keywords
290290
)
291291
)
292-
elif e == "invalid_param_types":
292+
elif e == "invalid_param_types" and types:
293293
validation_info = syntax_validator.validate_params(
294294
action["params"], types
295295
)
296-
elif e == "invalid_predicate_name":
296+
elif e == "invalid_predicate_name" and types:
297297
validation_info = (
298298
syntax_validator.validate_types_predicates(
299299
new_predicates, types
300300
)
301301
)
302-
elif e == "invalid_predicate_format":
302+
elif e == "invalid_predicate_format" and types:
303303
validation_info = (
304304
syntax_validator.validate_format_predicates(
305305
predicates, types
306306
)
307307
)
308-
elif e == "invalid_predicate_usage":
308+
elif e == "invalid_predicate_usage" and types:
309309
validation_info = (
310310
syntax_validator.validate_usage_predicates(
311311
llm_response, predicates, types
312312
)
313313
)
314-
else:
315-
raise NotImplementedError(
316-
f"Validation type '{e}' is not implemented."
317-
)
318314

319315
if not validation_info[0]:
320316
return action, new_predicates, llm_response, validation_info

l2p/utils/pddl_validator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ def validate_params(
4646
# If no types are defined, inform the user and check for parameter types
4747
if not types:
4848
for param_name, param_type in parameters.items():
49-
if param_type is not None:
49+
if param_type is not None and param_type != "":
5050
feedback_msg = (
5151
f'The parameter `{param_name}` has an object type `{param_type}` '
5252
'while no types are defined. Please remove the object type from this parameter.'
5353
)
5454
return False, feedback_msg
55+
56+
# if all parameter names do not contain a type
57+
return True, "PASS: All parameters are valid."
5558

5659
# Otherwise, check that parameter types are valid in the given types
5760
for param_name, param_type in parameters.items():

0 commit comments

Comments
 (0)