Rename ollama prompt:

- 'Function' word to 'FunctionName'
- 'Tool Call' to `FunctionCall`
- 'Tool Call Result' to 'FunctionCall Result'

_I found that changes make some models better_
This commit is contained in:
corrm 2024-06-25 12:40:07 +03:00
parent e2af13550a
commit b69a092f56

View file

@ -181,9 +181,9 @@ def ollama_pt(
for call in message["tool_calls"]: for call in message["tool_calls"]:
function_name = call["function"]["name"] function_name = call["function"]["name"]
arguments = json.loads(call["function"]["arguments"]) arguments = json.loads(call["function"]["arguments"])
prompt += f"### Tool Call ({call["id"]}):\nName: {function_name}\nArguments: {json.dumps(arguments)}\n\n" prompt += f"### FunctionCall ({call["id"]}):\nFunctionName: {function_name}\nArguments: {json.dumps(arguments)}\n\n"
elif "tool_call_id" in message: elif "tool_call_id" in message:
prompt += f"### Tool Call Result ({message["tool_call_id"]}):\n{message["content"]}\n\n" prompt += f"### FunctionCall Result ({message["tool_call_id"]}):\n{message["content"]}\n\n"
elif content: elif content:
prompt += f"### {role.capitalize()}:\n{content}\n\n" prompt += f"### {role.capitalize()}:\n{content}\n\n"