mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 19:38:46 -05:00
[GH-ISSUE #12053] issue: When adding a tool I get "set_config_context" error #31981
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 @kevensen on GitHub (Mar 25, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12053
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.5.20
Ollama Version (if applicable)
No response
Operating System
macOS
Browser (if applicable)
Chrome 134.0.6998.118
Confirmation
README.md.Expected Behavior
When adding the example "tool" I expect to be able to save without error.
Actual Behavior
When attempting to save, the code formats correctly, then a Python name import error occurs and the tool does not get saved.
Steps to Reproduce
Logs & Screenshots
2025-03-25 09:17:10 2025-03-25 16:17:10.669 | INFO | open_webui.utils.plugin:install_frontmatter_requirements:180 - No requirements found in frontmatter. - {}
2025-03-25 09:17:10 2025-03-25 16:17:10.671 | INFO | open_webui.utils.plugin:load_tools_module_by_id:103 - Loaded module: tool_basic - {}
2025-03-25 09:17:10 2025-03-25 16:17:10.675 | ERROR | open_webui.routers.tools:create_new_tools:119 - Failed to load the tool by id basic: cannot import name 'set_config_context' from 'langchain_core.runnables.config' (/usr/local/lib/python3.11/site-packages/langchain_core/runnables/config.py) - {}
2025-03-25 09:17:10 Traceback (most recent call last):
2025-03-25 09:17:10
2025-03-25 09:17:10 File "/usr/local/bin/uvicorn", line 10, in
2025-03-25 09:17:10 sys.exit(main())
2025-03-25 09:17:10 │ │ └
2025-03-25 09:17:10 │ └
2025-03-25 09:17:10 └ <module 'sys' (built-in)>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in call
2025-03-25 09:17:10 return self.main(args, **kwargs)
2025-03-25 09:17:10 │ │ │ └ {}
2025-03-25 09:17:10 │ │ └ ()
2025-03-25 09:17:10 │ └ <function BaseCommand.main at 0xffff83d1f740>
2025-03-25 09:17:10 └
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
2025-03-25 09:17:10 rv = self.invoke(ctx)
2025-03-25 09:17:10 │ │ └ <click.core.Context object at 0xffff84d10490>
2025-03-25 09:17:10 │ └ <function Command.invoke at 0xffff83d38360>
2025-03-25 09:17:10 └
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
2025-03-25 09:17:10 return ctx.invoke(self.callback, **ctx.params)
2025-03-25 09:17:10 │ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'app': 'open_webui.main:app', 'uds': None, 'fd': None, 'reload'...
2025-03-25 09:17:10 │ │ │ │ └ <click.core.Context object at 0xffff84d10490>
2025-03-25 09:17:10 │ │ │ └ <function main at 0xffff839a4e00>
2025-03-25 09:17:10 │ │ └
2025-03-25 09:17:10 │ └ <function Context.invoke at 0xffff83d1eca0>
2025-03-25 09:17:10 └ <click.core.Context object at 0xffff84d10490>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
2025-03-25 09:17:10 return __callback(args, **kwargs)
2025-03-25 09:17:10 │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '', 'app': 'open_webui.main:app', 'uds': None, 'fd': None, 'reload'...
2025-03-25 09:17:10 └ ()
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 412, in main
2025-03-25 09:17:10 run(
2025-03-25 09:17:10 └ <function run at 0xffff83d6ad40>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
2025-03-25 09:17:10 server.run()
2025-03-25 09:17:10 │ └ <function Server.run at 0xffff83b34220>
2025-03-25 09:17:10 └ <uvicorn.server.Server object at 0xffff83d63910>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
2025-03-25 09:17:10 return asyncio.run(self.serve(sockets=sockets))
2025-03-25 09:17:10 │ │ │ │ └ None
2025-03-25 09:17:10 │ │ │ └ <function Server.serve at 0xffff83b342c0>
2025-03-25 09:17:10 │ │ └ <uvicorn.server.Server object at 0xffff83d63910>
2025-03-25 09:17:10 │ └ <function run at 0xffff841acae0>
2025-03-25 09:17:10 └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/init.py'>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
2025-03-25 09:17:10 return runner.run(main)
2025-03-25 09:17:10 │ │ └ <coroutine object Server.serve at 0xffff839657b0>
2025-03-25 09:17:10 │ └ <function Runner.run at 0xffff83ff0680>
2025-03-25 09:17:10 └ <asyncio.runners.Runner object at 0xffff839af850>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
2025-03-25 09:17:10 return self._loop.run_until_complete(task)
2025-03-25 09:17:10 │ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:70> wai...
2025-03-25 09:17:10 │ │ └ <cyfunction Loop.run_until_complete at 0xffff839e2330>
2025-03-25 09:17:10 │ └ <uvloop.Loop running=True closed=False debug=False>
2025-03-25 09:17:10 └ <asyncio.runners.Runner object at 0xffff839af850>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 141, in coro
2025-03-25 09:17:10 await self.app(scope, receive_or_disconnect, send_no_error)
2025-03-25 09:17:10 │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0xffff080914e0>
2025-03-25 09:17:10 │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffff0950ddd0>
2025-03-25 09:17:10 └ <open_webui.main.RedirectMiddleware object at 0xffff08dd6e10>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in call
2025-03-25 09:17:10 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2025-03-25 09:17:10 │ │ │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..send_no_error at 0xffff080914e0>
2025-03-25 09:17:10 │ │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ │ │ └ <starlette.requests.Request object at 0xffff08901f10>
2025-03-25 09:17:10 │ │ └ <fastapi.routing.APIRouter object at 0xffff3dd12490>
2025-03-25 09:17:10 │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffff0950ddd0>
2025-03-25 09:17:10 └ <function wrap_app_handling_exceptions at 0xffff80a68220>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2025-03-25 09:17:10 await app(scope, receive, sender)
2025-03-25 09:17:10 │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff0888c720>
2025-03-25 09:17:10 │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 └ <fastapi.routing.APIRouter object at 0xffff3dd12490>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in call
2025-03-25 09:17:10 await self.middleware_stack(scope, receive, send)
2025-03-25 09:17:10 │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff0888c720>
2025-03-25 09:17:10 │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0xffff3dd12490>>
2025-03-25 09:17:10 └ <fastapi.routing.APIRouter object at 0xffff3dd12490>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
2025-03-25 09:17:10 await route.handle(scope, receive, send)
2025-03-25 09:17:10 │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff0888c720>
2025-03-25 09:17:10 │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ └ <function Route.handle at 0xffff80a69800>
2025-03-25 09:17:10 └ APIRoute(path='/api/v1/tools/create', name='create_new_tools', methods=['POST'])
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
2025-03-25 09:17:10 await self.app(scope, receive, send)
2025-03-25 09:17:10 │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff0888c720>
2025-03-25 09:17:10 │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ └ <function request_response..app at 0xffff08c4d4e0>
2025-03-25 09:17:10 └ APIRoute(path='/api/v1/tools/create', name='create_new_tools', methods=['POST'])
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
2025-03-25 09:17:10 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2025-03-25 09:17:10 │ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff0888c720>
2025-03-25 09:17:10 │ │ │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 │ │ └ <starlette.requests.Request object at 0xffff089009d0>
2025-03-25 09:17:10 │ └ <function request_response..app..app at 0xffff0888d620>
2025-03-25 09:17:10 └ <function wrap_app_handling_exceptions at 0xffff80a68220>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2025-03-25 09:17:10 await app(scope, receive, sender)
2025-03-25 09:17:10 │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff080c25c0>
2025-03-25 09:17:10 │ │ └ <function BaseHTTPMiddleware.call..call_next..receive_or_disconnect at 0xffff08839da0>
2025-03-25 09:17:10 │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.20.0.6', 8080), 'c...
2025-03-25 09:17:10 └ <function request_response..app..app at 0xffff0888d620>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
2025-03-25 09:17:10 response = await f(request)
2025-03-25 09:17:10 │ └ <starlette.requests.Request object at 0xffff089009d0>
2025-03-25 09:17:10 └ <function get_request_handler..app at 0xffff08c4d6c0>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
2025-03-25 09:17:10 raw_response = await run_endpoint_function(
2025-03-25 09:17:10 └ <function run_endpoint_function at 0xffff80a6b600>
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
2025-03-25 09:17:10 return await dependant.call(**values)
2025-03-25 09:17:10 │ │ └ {'user': UserModel(id='130b5d8b-c21a-48b4-ae30-ef92e0470aa4', name='Kenneth Evensen', email='kenneth.evensen@disney.com', rol...
2025-03-25 09:17:10 │ └ <function create_new_tools at 0xffff3f033420>
2025-03-25 09:17:10 └ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
2025-03-25 09:17:10
2025-03-25 09:17:10 > File "/app/backend/open_webui/routers/tools.py", line 105, in create_new_tools
2025-03-25 09:17:10 specs = get_tools_specs(TOOLS[form_data.id])
2025-03-25 09:17:10 │ │ │ └ 'basic'
2025-03-25 09:17:10 │ │ └ ToolForm(id='basic', name='basic', content='import os\nimport requests\nfrom datetime import datetime\n\n\nclass Tools:\n ...
2025-03-25 09:17:10 │ └ {'string_inverse': <tool_string_inverse.Tools object at 0xffff0805cfd0>, 'basic_tools': <tool_basic_tools.Tools object at 0xf...
2025-03-25 09:17:10 └ <function get_tools_specs at 0xffff3f49e340>
2025-03-25 09:17:10
2025-03-25 09:17:10 File "/app/backend/open_webui/utils/tools.py", line 215, in get_tools_specs
2025-03-25 09:17:10 return [convert_to_openai_function(tool) for tool in models]
2025-03-25 09:17:10 │ └ <map object at 0xffff089e6b60>
2025-03-25 09:17:10 └ <function convert_to_openai_function at 0xffff4462c0e0>
2025-03-25 09:17:10
2025-03-25 09:17:10 File "/app/backend/open_webui/utils/tools.py", line 215, in
2025-03-25 09:17:10 return [convert_to_openai_function(tool) for tool in models]
2025-03-25 09:17:10 │ │ └ <class 'open_webui.utils.tools.calculator'>
2025-03-25 09:17:10 │ └ <class 'open_webui.utils.tools.calculator'>
2025-03-25 09:17:10 └ <function convert_to_openai_function at 0xffff4462c0e0>
2025-03-25 09:17:10
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/langchain_core/utils/function_calling.py", line 419, in convert_to_openai_function
2025-03-25 09:17:10 from langchain_core.tools import BaseTool
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/langchain_core/tools/init.py", line 22, in
2025-03-25 09:17:10 from langchain_core.tools.base import (
2025-03-25 09:17:10 File "/usr/local/lib/python3.11/site-packages/langchain_core/tools/base.py", line 54, in
2025-03-25 09:17:10 from langchain_core.runnables.config import set_config_context
2025-03-25 09:17:10
2025-03-25 09:17:10 ImportError: cannot import name 'set_config_context' from 'langchain_core.runnables.config' (/usr/local/lib/python3.11/site-packages/langchain_core/runnables/config.py)
Additional Information
I am still learning the UI. I am well open to the possibility it is user error.