[GH-ISSUE #11792] issue: System Prompt Does Not Trigger Function Calls (Function Calling Issue) #55025

Closed
opened 2026-05-05 17:02:50 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @rifkisarici on GitHub (Mar 17, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/11792

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.5.20

Ollama Version (if applicable)

No response

Operating System

Windows 11

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

When the system prompt contains the instruction:
The model must call the "check_system_status()" function when the user requests it.

Then the model should:

  1. Detect "check_system_status" in the user message.
  2. Call check_system_status() and return its output.
  3. The final response should be:
    [SYSTEM PROMPT TEST] System status: Active

Instead of just:
[SYSTEM PROMPT TEST] check_system_status()

Actual Behavior

  • The model generates a static response instead of calling the function.
  • It only returns [SYSTEM PROMPT TEST] check_system_status(), but does not actually execute check_system_status().-
  • We can only manually trigger function calling inside outlet() using if "check_system_status" in user_message:.

Steps to Reproduce

  1. Set the system prompt with the instruction:
    The model must call the check_system_status() function when the user requests it.
  2. Run Open WebUI and send the following message:
    check_system_status
  3. Observe the response:
    [SYSTEM PROMPT TEST] check_system_status()
  4. The function check_system_status() is never actually executed.
  5. However, adding manual handling inside outlet() like this works:
if "check_system_status" in user_message:
    function_result = self.check_system_status()
    body["messages"].append({"role": "assistant", "content": function_result})

Logs & Screenshots

📌 Code Example

To better illustrate the problem, here is the full code:

from pydantic import BaseModel, Field
from typing import Optional

class Filter:
    class Valves(BaseModel):
        priority: int = Field(
            default=0, description="Priority level for the filter operations."
        )
        max_turns: int = Field(
            default=8, description="Maximum allowable conversation turns for a user."
        )
        pass

    class UserValves(BaseModel):
        max_turns: int = Field(
            default=4, description="Maximum allowable conversation turns for a user."
        )
        pass

    def __init__(self):
        self.valves = self.Valves()
        print("📢 System prompt is running!")
        pass

    def check_system_status(self) -> str:
        """
        A simple test function. It should be executed when called by the system prompt.
        """
        print("✅ check_system_status() function executed!")
        return "System status: Active"

    def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
        print("📢 outlet is running!")

        messages = body.get("messages", [])
        user_message = messages[-2].get("content", "") if len(messages) > 1 else ""

        if "check_system_status" in user_message:
            function_result = self.check_system_status()
            print(f"✅ Function Result: {function_result}")
            body["messages"].append({"role": "assistant", "content": function_result})

        return body


Relevant Logs:

📢 outlet is running!
💡 Assistant Message: [SYSTEM PROMPT TEST] check_system_status()
💡 User Message: check_system_status
✅ System prompt is running!
❌ Function was not executed!
✅ check_system_status() function should have been called, but it wasn't.

Additional Information

  • We were able to modify system prompt responses (e.g., adding [SYSTEM PROMPT TEST] at the beginning).
  • However, function calling does not work unless manually triggered inside outlet().
  • If Open WebUI does not support function calling, are there plans to implement this feature?
Originally created by @rifkisarici on GitHub (Mar 17, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/11792 ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.5.20 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior When the system prompt contains the instruction: `The model must call the "check_system_status()" function when the user requests it.` Then the model should: 1. Detect `"check_system_status"` in the user message. 2. Call `check_system_status() `and return its output. 3. The final response should be: `[SYSTEM PROMPT TEST] System status: Active` Instead of just: `[SYSTEM PROMPT TEST] check_system_status()` ### Actual Behavior - The model **generates a static response instead of calling the function.** - It only returns `[SYSTEM PROMPT TEST] check_system_status()`, but does not actually execute `check_system_status()`.- - **We can only manually trigger function calling inside `outlet()` using `if "check_system_status" in user_message:`.** ### Steps to Reproduce 1. Set the system prompt with the instruction: **The model must call the `check_system_status()` function when the user requests it.** 2. Run Open WebUI and send the following message: `check_system_status` 3. Observe the response: `[SYSTEM PROMPT TEST] check_system_status()` 4. The function `check_system_status()` is never actually executed. 5. However, adding manual handling inside `outlet()` like this works: ``` if "check_system_status" in user_message: function_result = self.check_system_status() body["messages"].append({"role": "assistant", "content": function_result}) ``` ### Logs & Screenshots ## 📌 Code Example To better illustrate the problem, here is the full code: ```python from pydantic import BaseModel, Field from typing import Optional class Filter: class Valves(BaseModel): priority: int = Field( default=0, description="Priority level for the filter operations." ) max_turns: int = Field( default=8, description="Maximum allowable conversation turns for a user." ) pass class UserValves(BaseModel): max_turns: int = Field( default=4, description="Maximum allowable conversation turns for a user." ) pass def __init__(self): self.valves = self.Valves() print("📢 System prompt is running!") pass def check_system_status(self) -> str: """ A simple test function. It should be executed when called by the system prompt. """ print("✅ check_system_status() function executed!") return "System status: Active" def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict: print("📢 outlet is running!") messages = body.get("messages", []) user_message = messages[-2].get("content", "") if len(messages) > 1 else "" if "check_system_status" in user_message: function_result = self.check_system_status() print(f"✅ Function Result: {function_result}") body["messages"].append({"role": "assistant", "content": function_result}) return body ``` **Relevant Logs:** ``` 📢 outlet is running! 💡 Assistant Message: [SYSTEM PROMPT TEST] check_system_status() 💡 User Message: check_system_status ✅ System prompt is running! ❌ Function was not executed! ✅ check_system_status() function should have been called, but it wasn't. ``` ### Additional Information - **We were able to modify system prompt responses (e.g., adding `[SYSTEM PROMPT TEST] `at the beginning).** - **However, function calling does not work unless manually triggered inside `outlet()`.** - **If Open WebUI does not support function calling, are there plans to implement this feature?**
GiteaMirror added the bug label 2026-05-05 17:02:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#55025