Skip to content

Commit ad7c337

Browse files
committed
fix language_specific_pre_processing
1 parent 7b230df commit ad7c337

File tree

1 file changed

+19
-18
lines changed
  • berkeley-function-call-leaderboard/model_handler

1 file changed

+19
-18
lines changed

berkeley-function-call-leaderboard/model_handler/utils.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,13 @@ def augment_prompt_by_languge(prompt, test_category):
335335
if test_category == "java":
336336
prompt = prompt + "\n Note that the provided function is in Java 8 SDK syntax."
337337
elif test_category == "javascript":
338-
prompt = prompt + "\n Note that the provided function is in JavaScript."
338+
prompt = prompt + "\n Note that the provided function is in JavaScript syntax."
339339
else:
340-
prompt = prompt + "\n Note that the provided function is in Python."
340+
prompt = prompt + "\n Note that the provided function is in Python 3 syntax."
341341
return prompt
342342

343343

344-
def language_specific_pre_processing(function, test_category, string_param):
344+
def language_specific_pre_processing(function, test_category):
345345
if type(function) is dict:
346346
function = [function]
347347
if len(function) == 0:
@@ -350,27 +350,28 @@ def language_specific_pre_processing(function, test_category, string_param):
350350
properties = item["parameters"]["properties"]
351351
if test_category == "java":
352352
for key, value in properties.items():
353-
if value["type"] == "Any" or value["type"] == "any":
354-
properties[key][
355-
"description"
356-
] += "This parameter can be of any type of Java object."
353+
if value["type"] == "any":
357354
properties[key]["description"] += (
358-
"This is Java" + value["type"] + " in string representation."
355+
" This parameter can be of any type of Java object in string representation."
359356
)
357+
else:
358+
value["description"] += (
359+
" This is Java " + value["type"] + " in string representation."
360+
)
361+
value["type"] = "string"
362+
360363
elif test_category == "javascript":
361364
for key, value in properties.items():
362-
if value["type"] == "Any" or value["type"] == "any":
363-
properties[key][
364-
"description"
365-
] += "This parameter can be of any type of Javascript object."
366-
else:
367-
if "description" not in properties[key]:
368-
properties[key]["description"] = ""
365+
if value["type"] == "any":
369366
properties[key]["description"] += (
370-
"This is Javascript "
371-
+ value["type"]
372-
+ " in string representation."
367+
" This parameter can be of any type of JavaScript object."
368+
)
369+
else:
370+
value["description"] += (
371+
" This is JavaScript " + value["type"] + " in string representation."
373372
)
373+
value["type"] = "string"
374+
374375
return function
375376

376377

0 commit comments

Comments
 (0)