mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-11 00:04:08 -05:00
bug: Tools aren't working in version 0.4.3 #2784
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Simi5599 on GitHub (Nov 22, 2024).
Bug Report
Installation Method
Docker
Environment
Confirmation:
Expected Behavior:
When asking something to the model that requires a tool, the tool should activate
Actual Behavior:
The tool never activates, even if enabled for the chat. I have downgraded to 0.4.2 and tools are working again.
Description
Reproduction Details
Steps to Reproduce:
0) Be sure that you have a tool that worked in version 0.4.2 (For example: "Run Code" by EtiennePerrot
Ask the lmm something
The LMM won't activate the tool
Additional Information
Definitely can confirm that this is introduced in the 0.4.3 version.
@tjbck commented on GitHub (Nov 22, 2024):
Definitely works on my end, we might need more details here.
@Simi5599 commented on GitHub (Nov 22, 2024):
This is strange. Will update with a comment soon when I am in front of my laptop by attaching logs
@Simi5599 commented on GitHub (Nov 22, 2024):
So i have updates, the "Run code" tools works fine it was just a coincidence.
But the web search tool (not the one included by default in Open WebUI) does not work in any case. (in fact i did notice this issue by using the web search)
By reading the Docker logs i see that the error is related to the event_emitter.
Maybe this is a deprecation from Open WebUI?
Browser Console Logs:
Nothing relevant
Docker Container Logs:
I have got this error:
@tjbck commented on GitHub (Nov 22, 2024):
Logs above aren't related. Perhaps @michaelpoluektov could chime in.
@Simi5599 commented on GitHub (Nov 22, 2024):
Could we do something like this?
This looks like a Pydantic restriction with the fields name
@tjbck commented on GitHub (Nov 22, 2024):
reserved params should NOT be added to the function spec, dropping reserved params is intended here.
@Simi5599 commented on GitHub (Nov 22, 2024):
So basically we could do something like this
And the Pydantic model should be created (?)
@Simi5599 commented on GitHub (Nov 22, 2024):
Can confirm this works on my side and does not break tools.
If a simple PR is welcome i can do this without any issues :)
@michaelpoluektov commented on GitHub (Nov 22, 2024):
I'm pretty sure everything works as intended here (apart from maybe the fact that it's not failing fast enough, but that's a separate issue)
You should not be using reserved params (params starting with "__") in your tool definitions, unless they're part of OWUI (like
__event_emitter__,__event_call__etc.)If this isn't what's happening, feel free to attach your toolkit (or a dummy with the same type spec) and I'll look into it.
@Simi5599 commented on GitHub (Nov 22, 2024):
I am not, the only part of my code where i am using this kind of parameter is the following
async def search_web(self, query: str, __event_emitter__: Callable[[dict], Any] = None)Anyways i think that the simple IF that i wrote should do the trick.
Maybe we can refine it, but on my end, the problem was solved
@michaelpoluektov commented on GitHub (Nov 22, 2024):
It works for me, could you include your tool? Here's my type signature:
@Simi5599 commented on GitHub (Nov 22, 2024):
Deleted my previous comment, i was able to get the code by my cloud resource using my phone (sorry if the code is not formatted very well)
Importing libs
import os
import requests
from datetime import datetime
import json
from requests import get
from bs4 import BeautifulSoup
import concurrent.futures
from html.parser import HTMLParser
from urllib.parse import urlparse, urljoin
import re
import unicodedata
from pydantic import BaseModel, Field
import asyncio
from typing import Callable, Any
class HelpFunctions:
"""Funzioni di supporto per il sistema di ricerca."""
class EventEmitter:
"""Interfaccia di comunicazione con il front-end."""
class Tools:
class Valves(BaseModel):
"""Variabili del sistema di ricerca."""
@michaelpoluektov commented on GitHub (Nov 22, 2024):
Oh I think I understand now: you've got
__event_emitter__in your docstring@Simi5599 commented on GitHub (Nov 22, 2024):
Oh 😂 that's unexpected.
Couldn't we just filter out these kinds of parameters via the simple if?
@michaelpoluektov commented on GitHub (Nov 22, 2024):
So simple fix for now, just remove:
from your docstring.
Otherwise I put up a PR: can you check that it works?
https://github.com/open-webui/open-webui/pull/7263
@Simi5599 commented on GitHub (Nov 22, 2024):
Can't check this at the moment, but I saw your PR, and it should work.
@tjbck commented on GitHub (Nov 23, 2024):
0.4.4 will be released shortly!
@Simi5599 commented on GitHub (Nov 23, 2024):
Can confirm this was resolved with 0.4.4 !