[PR #5284] [MERGED] tools #17001

Closed
opened 2026-04-16 05:50:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/5284
Author: @mxyng
Created: 6/25/2024
Status: Merged
Merged: 7/16/2024
Merged by: @mxyng

Base: mainHead: mxyng/tools


📝 Commits (2)

📊 Changes

16 files changed (+621 additions, -52 deletions)

View changed files

📝 api/types.go (+36 -3)
📝 server/images.go (+9 -2)
📝 server/model.go (+105 -0)
📝 server/model_test.go (+122 -0)
📝 server/prompt.go (+3 -3)
📝 server/prompt_test.go (+1 -1)
📝 server/routes.go (+19 -5)
server/testdata/tools/command-r-plus.gotmpl (+67 -0)
server/testdata/tools/command-r-plus.out (+39 -0)
server/testdata/tools/firefunction.gotmpl (+31 -0)
server/testdata/tools/firefunction.out (+17 -0)
server/testdata/tools/messages.json (+39 -0)
server/testdata/tools/mistral.gotmpl (+15 -0)
server/testdata/tools/mistral.out (+3 -0)
server/testdata/tools/tools.json (+30 -0)
📝 template/template.go (+85 -38)

📄 Description

curl -s 127.0.0.1:11434/api/chat -d '{
  "model": "mike/mistral",
  "messages": [
    {
      "role": "user",
      "content": "What's the weather like today in Paris?"
    },
    {
      "role": "assistant",
      "tool_calls": [
        {
          "id": "89a1e453-0bce-4de3-a456-c54bed09c520",
          "type": "function",
          "function": {
            "name": "get_current_weather",
            "arguments": {
              "location": "Paris, France",
              "format": "celsius"
            }
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "89a1e453-0bce-4de3-a456-c54bed09c520",
      "content": "22"
    },
    {
      "role": "assistant",
      "content": "The weather in Paris is 22 degrees celsius."
    },
    {
      "role": "user",
      "content": "What's the weather like today in San Francisco and Toronto?"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g. San Francisco, CA"
            },
            "format": {
              "type": "string",
              "enum": [
                "celsius",
                "fahrenheit"
              ],
              "description": "The temperature unit to use. Infer this from the users location."
            }
          },
          "required": [
            "location",
            "format"
          ]
        }
      }
    }
  ],
  "stream": false,
  "options": {
    "temperature": 0
  }
}'

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/5284 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 6/25/2024 **Status:** ✅ Merged **Merged:** 7/16/2024 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `mxyng/tools` --- ### 📝 Commits (2) - [`d02bbeb`](https://github.com/ollama/ollama/commit/d02bbebb11c2e9c391ee3af30ba3437e67d1b7a8) tools - [`ef5136a`](https://github.com/ollama/ollama/commit/ef5136a745138896d080bf5bcac13377f7672b77) tools test ### 📊 Changes **16 files changed** (+621 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+36 -3) 📝 `server/images.go` (+9 -2) 📝 `server/model.go` (+105 -0) 📝 `server/model_test.go` (+122 -0) 📝 `server/prompt.go` (+3 -3) 📝 `server/prompt_test.go` (+1 -1) 📝 `server/routes.go` (+19 -5) ➕ `server/testdata/tools/command-r-plus.gotmpl` (+67 -0) ➕ `server/testdata/tools/command-r-plus.out` (+39 -0) ➕ `server/testdata/tools/firefunction.gotmpl` (+31 -0) ➕ `server/testdata/tools/firefunction.out` (+17 -0) ➕ `server/testdata/tools/messages.json` (+39 -0) ➕ `server/testdata/tools/mistral.gotmpl` (+15 -0) ➕ `server/testdata/tools/mistral.out` (+3 -0) ➕ `server/testdata/tools/tools.json` (+30 -0) 📝 `template/template.go` (+85 -38) </details> ### 📄 Description ``` curl -s 127.0.0.1:11434/api/chat -d '{ "model": "mike/mistral", "messages": [ { "role": "user", "content": "What's the weather like today in Paris?" }, { "role": "assistant", "tool_calls": [ { "id": "89a1e453-0bce-4de3-a456-c54bed09c520", "type": "function", "function": { "name": "get_current_weather", "arguments": { "location": "Paris, France", "format": "celsius" } } } ] }, { "role": "tool", "tool_call_id": "89a1e453-0bce-4de3-a456-c54bed09c520", "content": "22" }, { "role": "assistant", "content": "The weather in Paris is 22 degrees celsius." }, { "role": "user", "content": "What's the weather like today in San Francisco and Toronto?" } ], "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" }, "format": { "type": "string", "enum": [ "celsius", "fahrenheit" ], "description": "The temperature unit to use. Infer this from the users location." } }, "required": [ "location", "format" ] } } } ], "stream": false, "options": { "temperature": 0 } }' ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 05:50:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#17001