[PR #13626] feat: allow enforced tool calling #14300

Open
opened 2026-04-13 00:50:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13626
Author: @baptistejamin
Created: 1/5/2026
Status: 🔄 Open

Base: mainHead: force_tool_call


📝 Commits (2)

📊 Changes

9 files changed (+1623 additions, -11 deletions)

View changed files

📝 api/types.go (+88 -0)
📝 api/types_test.go (+167 -0)
📝 docs/api.md (+34 -0)
📝 docs/api/openai-compatibility.mdx (+89 -1)
📝 middleware/openai.go (+65 -8)
📝 openai/openai.go (+305 -1)
📝 openai/openai_test.go (+477 -0)
📝 server/routes.go (+174 -1)
📝 server/routes_test.go (+224 -0)

📄 Description

Hey there

This PR allows support for constrained tool_calling on both the Ollama server and the OpenAI server.

It is super helpful because it can make smaller models much better at tool-calling.

Since you are building a built-in AI Agent in Ollama, this feature can be very useful as well. For instance, to enforce search, or an MCP server.


🔄 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/13626 **Author:** [@baptistejamin](https://github.com/baptistejamin) **Created:** 1/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `force_tool_call` --- ### 📝 Commits (2) - [`a565013`](https://github.com/ollama/ollama/commit/a56501316535beb01b4a5fad66c43f3cd219288f) feat: allow enforced tool calling - [`a9a62a0`](https://github.com/ollama/ollama/commit/a9a62a07d6419904291bc8f399bb858d45494efa) Fix tests ### 📊 Changes **9 files changed** (+1623 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+88 -0) 📝 `api/types_test.go` (+167 -0) 📝 `docs/api.md` (+34 -0) 📝 `docs/api/openai-compatibility.mdx` (+89 -1) 📝 `middleware/openai.go` (+65 -8) 📝 `openai/openai.go` (+305 -1) 📝 `openai/openai_test.go` (+477 -0) 📝 `server/routes.go` (+174 -1) 📝 `server/routes_test.go` (+224 -0) </details> ### 📄 Description Hey there This PR allows support for constrained tool_calling on both the Ollama server and the OpenAI server. It is super helpful because it can make smaller models much better at tool-calling. Since you are building a built-in AI Agent in Ollama, this feature can be very useful as well. For instance, to enforce search, or an MCP server. --- <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-13 00:50:23 -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#14300