Skip to content

Commit 4291e15

Browse files
authored
Fix tool spec, this spec is kinda.... (LostRuins#1458)
1 parent c0adaab commit 4291e15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

koboldcpp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,7 @@ def transform_genparams(genparams, api_format):
19641964
# tools handling
19651965
tools_array = genparams.get('tools', [])
19661966
chosen_tool = genparams.get('tool_choice', "auto")
1967-
tool_json_formatting_instruction = " Use this style of JSON object formatting to give your answer if you think the user is asking you to perform an action: " + json.dumps([{"id": "insert an id for the response", "type": "function", "function": {"name": "insert the name of the function you want to call", "arguments": {"first property key": "first property value", "second property key": "second property value"}}}], indent=0)
1967+
tool_json_formatting_instruction = " Use this style of JSON object formatting to give your answer if you think the user is asking you to perform an action: " + json.dumps([{"id": "insert an id for the response", "type": "function", "function": {"name": "insert the name of the function you want to call", "arguments": "{\"first property key\": \"first property value\", \"second property key\": \"second property value\"}"}}], indent=0)
19681968
if tools_array and len(tools_array) > 0 and chosen_tool is not None:
19691969
try:
19701970
specified_function = ""
@@ -1981,7 +1981,7 @@ def transform_genparams(genparams, api_format):
19811981
if located_tooljson:
19821982
tools_array = []
19831983
tools_array.append(located_tooljson)
1984-
tool_json_formatting_instruction = f"The user is asking you to use the style of this JSON object formatting to complete the parameters for the specific function named {specified_function} in the following format: " + json.dumps([{"id": "insert an id for the response", "type": "function", "function": {"name": f"{specified_function}", "arguments": {"first property key": "first property value", "second property key": "second property value"}}}], indent=0)
1984+
tool_json_formatting_instruction = f"The user is asking you to use the style of this JSON object formatting to complete the parameters for the specific function named {specified_function} in the following format: " + json.dumps([{"id": "insert an id for the response", "type": "function", "function": {"name": f"{specified_function}", "arguments": "{\"first property key\": \"first property value\", \"second property key\": \"second property value\"}"}}], indent=0)
19851985
except Exception:
19861986
# In case of any issues, just revert back to no specified function
19871987
pass

0 commit comments

Comments
 (0)