[PR #6066] [CLOSED] Patch for Tool Stream Compatibility #58703

Closed
opened 2026-04-29 13:36:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/6066
Author: @royjhan
Created: 7/30/2024
Status: Closed

Base: mainHead: royh/stream-tools


📝 Commits (4)

📊 Changes

2 files changed (+32 additions, -8 deletions)

View changed files

📝 openai/openai.go (+11 -7)
📝 server/routes.go (+21 -1)

📄 Description

!! not real streaming, but pretty much dumps stream of objects at complete time

{"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"celsius","location":"Paris, France"}}}]},"done":false}
{"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"celsius","location":"Tokyo, Japan"}}}]},"done":false}
{"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"fahrenheit","location":"Boston, MA"}}}]},"done":false}
{"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":""},"done_reason":"tool_calls","done":true,"total_duration":3788799791,"load_duration":1521528291,"prompt_eval_count":138,"prompt_eval_duration":224863000,"eval_count":130,"eval_duration":2038857000}
curl http://localhost:11434/api/chat -d '{
  "model": "mistral",
  "messages": [
    {
      "role": "user",
      "content": "What is the weather today in Paris, Tokyo, and Boston?"
    }
  ],
  "stream": true,
  "options": {
    "temperature": 0
  },
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather for a location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The location to get the weather for, e.g. San Francisco, CA"
            },
            "format": {
              "type": "string",
              "description": "The format to return the weather in, e.g. 'celsius' or 'fahrenheit'",
              "enum": ["celsius", "fahrenheit"]
            }
          },
          "required": ["location", "format"]
        }
      }
    }
  ]
}'

#5915
#5993
#5989
#5796


🔄 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/6066 **Author:** [@royjhan](https://github.com/royjhan) **Created:** 7/30/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `royh/stream-tools` --- ### 📝 Commits (4) - [`d2b25c1`](https://github.com/ollama/ollama/commit/d2b25c1bfb4fe9a2877a2e3fde24c0e46545a6ee) draft - [`7950053`](https://github.com/ollama/ollama/commit/795005397210f701726f6b5066f8ee5f0a81858b) rm comments - [`23ff673`](https://github.com/ollama/ollama/commit/23ff673bdcadc3c77f3e1cc5f873427d8a19cfb0) correct output - [`f16b3db`](https://github.com/ollama/ollama/commit/f16b3db70c075b2db13e1947652a6496237ff788) oai compat ### 📊 Changes **2 files changed** (+32 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `openai/openai.go` (+11 -7) 📝 `server/routes.go` (+21 -1) </details> ### 📄 Description !! not real streaming, but pretty much dumps stream of objects at complete time ``` {"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"celsius","location":"Paris, France"}}}]},"done":false} {"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"celsius","location":"Tokyo, Japan"}}}]},"done":false} {"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":"","tool_calls":[{"function":{"name":"get_current_weather","arguments":{"format":"fahrenheit","location":"Boston, MA"}}}]},"done":false} {"model":"mistral","created_at":"2024-07-30T00:11:33.125585Z","message":{"role":"assistant","content":""},"done_reason":"tool_calls","done":true,"total_duration":3788799791,"load_duration":1521528291,"prompt_eval_count":138,"prompt_eval_duration":224863000,"eval_count":130,"eval_duration":2038857000} ``` ``` curl http://localhost:11434/api/chat -d '{ "model": "mistral", "messages": [ { "role": "user", "content": "What is the weather today in Paris, Tokyo, and Boston?" } ], "stream": true, "options": { "temperature": 0 }, "tools": [ { "type": "function", "function": { "name": "get_current_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The location to get the weather for, e.g. San Francisco, CA" }, "format": { "type": "string", "description": "The format to return the weather in, e.g. 'celsius' or 'fahrenheit'", "enum": ["celsius", "fahrenheit"] } }, "required": ["location", "format"] } } } ] }' ``` #5915 #5993 #5989 #5796 --- <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-29 13:36:02 -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#58703