[GH-ISSUE #8166] Tool-calling does not work consistently (compared to ChatGPT Actions) #15025

Closed
opened 2026-04-19 21:18:47 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @mattia-intellilab on GitHub (Dec 28, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8166

Bug Report

Installation Method

We used docker in order to install openwebui on a Kubernetes cluster.

Environment

  • Open WebUI Version: v0.4.6

  • Operating System: Windows 11

  • Browser (if applicable): Google Chrome

Confirmation:

  • [x ] I have read and followed all the instructions provided in the README.md.
  • I am on 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 provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

When activating the chat_to_make Tool.
The Model should use it in order to send the chat-body to a make.com webhook.

image

Actual Behavior:

2/10 times the tool gets executed correctly and the data gets to the webhook.

Example where it worked:
image
image

Now this time, with a bigger chat-context, the tool does not get called and there is now new data received by the webhook.
image

Same here:
image

Description

This would be the tool-code:

`import os
import requests
from typing import Optional, Callable, Awaitable
from pydantic import BaseModel, Field

class Tools:
class Valves(BaseModel):
webhook_url: str = Field(
default="",
description="The URL of the make.com webhook to send chat-data to.",
)

def __init__(self):
    self.valves = self.Valves()
    pass

def send_chat(
    self,
    body: dict,
) -> str:
    """
    Send the chat-history to make.com using a webhook when chat_to_make is prompted.
    :param body: contains all messages from the user and the assistant.
    :return: None
    """
    messages = body.get("messages", [])
    if not messages:
        return "No messages found in the request body."

    user_messages = [
        message["content"] for message in messages if message["role"] == "user"
    ]

    assistant_messages = [
        message["content"] for message in messages if message["role"] == "assistant"
    ]

    webhook = self.valves.webhook_url
    if not webhook:
        return "Let the user know webhook URL was not provided. Please configure the webhook URL."

    payload = {
        "content": f"User Messages: {user_messages} Assistant Messages:{assistant_messages}  - Sent from Open WebUI"
    }
    response = requests.post(webhook, json=payload)

    if response.status_code == 200:
        return "Message successfully sent, Let the user know the message has been sent."
    else:
        return f"Failed to send message. HTTP Status Code: {response.status_code},  Let the user know there were some issues."

`

Reproduction Details

Steps to Reproduce:

  1. Setup a new tool using the code above
  2. Activate the tool in a new chat with gpt4o
  3. Use a sample prompt in order to populate the chat-body
  4. Tell the model to use the tool "chat_to_make" in order to send chat-body to make.com webhook
  5. check make.com webhook to see if the data has arrived

Any ideas how to fix this?

Originally created by @mattia-intellilab on GitHub (Dec 28, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8166 # Bug Report ## Installation Method We used docker in order to install openwebui on a Kubernetes cluster. ## Environment - **Open WebUI Version:** v0.4.6 - **Operating System:** Windows 11 - **Browser (if applicable):** Google Chrome **Confirmation:** - [x ] I have read and followed all the instructions provided in the README.md. - [ ] I am on 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 provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: When activating the chat_to_make Tool. The Model should use it in order to send the chat-body to a make.com webhook. ![image](https://github.com/user-attachments/assets/eb043da7-d216-41bc-bf03-cf6870392865) ## Actual Behavior: 2/10 times the tool gets executed correctly and the data gets to the webhook. Example where it worked: ![image](https://github.com/user-attachments/assets/dd617d5f-205c-4e62-bd5d-f26722ea5ad7) ![image](https://github.com/user-attachments/assets/f0d2912d-369b-4411-9c5e-f9e0c4b1392d) Now this time, with a bigger chat-context, the tool does not get called and there is now new data received by the webhook. ![image](https://github.com/user-attachments/assets/f1b7aa72-dfe9-4700-9107-7cf59ab151c0) Same here: ![image](https://github.com/user-attachments/assets/e60c9f44-93b0-422e-90f9-f1175990efba) ## Description This would be the tool-code: `import os import requests from typing import Optional, Callable, Awaitable from pydantic import BaseModel, Field class Tools: class Valves(BaseModel): webhook_url: str = Field( default="", description="The URL of the make.com webhook to send chat-data to.", ) def __init__(self): self.valves = self.Valves() pass def send_chat( self, body: dict, ) -> str: """ Send the chat-history to make.com using a webhook when chat_to_make is prompted. :param body: contains all messages from the user and the assistant. :return: None """ messages = body.get("messages", []) if not messages: return "No messages found in the request body." user_messages = [ message["content"] for message in messages if message["role"] == "user" ] assistant_messages = [ message["content"] for message in messages if message["role"] == "assistant" ] webhook = self.valves.webhook_url if not webhook: return "Let the user know webhook URL was not provided. Please configure the webhook URL." payload = { "content": f"User Messages: {user_messages} Assistant Messages:{assistant_messages} - Sent from Open WebUI" } response = requests.post(webhook, json=payload) if response.status_code == 200: return "Message successfully sent, Let the user know the message has been sent." else: return f"Failed to send message. HTTP Status Code: {response.status_code}, Let the user know there were some issues." ` ## Reproduction Details **Steps to Reproduce:** 1. Setup a new tool using the code above 2. Activate the tool in a new chat with gpt4o 3. Use a sample prompt in order to populate the chat-body 4. Tell the model to use the tool "chat_to_make" in order to send chat-body to make.com webhook 5. check make.com webhook to see if the data has arrived Any ideas how to fix this?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#15025