Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/ollama_functions_example: improve system message for better response #951

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/ollama-functions-example/ollama_functions_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ func systemMessage() string {
log.Fatal(err)
}

return fmt.Sprintf(`You have access to the following tools:
return fmt.Sprintf(`Here are JSON schemas defining the available tools. You MUST ONLY use these specific tools:

%s

To use a tool, respond with a JSON object with the following structure:
To use a tool, respond with a JSON object with the following structure:
{
"tool": <name of the called tool>,
"tool_input": <parameters for the tool matching the above JSON schema>
Expand Down Expand Up @@ -174,11 +174,11 @@ var functions = []llms.FunctionDefinition{
Name: "getCurrentWeather",
Description: "Get the current weather in a given location",
Parameters: json.RawMessage(`{
"type": "object",
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
},
},
"required": ["location", "unit"]
}`),
},
Expand All @@ -188,10 +188,10 @@ var functions = []llms.FunctionDefinition{
Name: "finalResponse",
Description: "Provide the final response to the user query",
Parameters: json.RawMessage(`{
"type": "object",
"type": "object",
"properties": {
"response": {"type": "string", "description": "The final response to the user query"}
},
},
"required": ["response"]
}`),
},
Expand Down
Loading