mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-14 05:02:01 -06:00
[GH-ISSUE #16307] issue: __tools__ in pipe returns owui parameters (__user__, __event_emitter__) in 'callable' when method is async #72462
Reference in New Issue
Block a user
Originally created by @Podden on GitHub (Aug 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16307
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.18
Ollama Version (if applicable)
No response
Operating System
Alpine
Browser (if applicable)
Firefox
Confirmation
README.md.Expected Behavior
I have noticed an inconsistent behaviour when using tools with async methods and using the Optional Arguments of openwebui within a custom pipe:
This is my little mock tool:
This is the __tools___ dict I get when the method in the tool is not async
{ 'get_temperature': { 'tool_id': 'test_mock_tool', 'callable': < function Tools.get_temperature at 0x7f2fbb1ac860 > , 'spec': { 'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': { 'properties': { 'location': { 'default': 'Berlin', 'description': 'City name', 'type': 'string' } }, 'type': 'object' } }, 'metadata': { 'file_handler': False, 'citation': False } } }This is the __tools___ dict I get when the method in the tool is async
{ 'get_temperature': { 'tool_id': 'test_mock_tool', 'callable': functools.partial( < bound method Tools.get_temperature of < tool_test_mock_tool.Tools object at 0x7f2fb9324ad0 >> , __event_emitter__ = < function get_event_emitter. < locals > .__event_emitter__ at 0x7f2fbb1747c0 > , __user__ = { 'id': 'xxxxxxxxxxxxxxxxxxxxxxxxx', 'name': 'xxxxx', 'email': 'xxxxxxxxxxxxxx', 'role': 'admin', 'profile_image_url': 'data:image/jpeg;base64,xxxxxxx................', 'last_active_at': xxxxx, 'updated_at': xxxxx, 'created_at': xxxxx, 'api_key': 'sk-xxxxxxxx', 'settings': { 'ui': { 'version': '0.6.18', 'memory': False, 'models': ['xxxxxxxxxxx'], 'notificationEnabled': True, 'notifications': { 'webhook_url': '' }, 'landingPageMode': '', 'imageCompression': True, 'webSearch': None, 'imageCompressionSize': { 'width': '', 'height': '' }, 'widescreenMode': False, 'detectArtifacts': True, 'largeTextAsFile': False, 'userLocation': False, 'ctrlEnterToSend': False, 'voiceInterruption': True, 'showEmojiInCall': False, 'chatBubble': True, 'richTextInput': True, 'copyFormatted': True, 'collapseCodeBlocks': False, 'expandDetails': False, 'autoFollowUps': False, 'insertPromptAsRichText': True, 'hapticFeedback': True, 'params': {}, 'pinnedModels': ['xxxxxxxxxxxxxxxxxxxx'] }, 'functions': { 'valves': { 'add_to_memories_action_button': { 'show_status': True }, 'auto_memory': { 'show_status': True, 'openai_api_url': None, 'model': None, 'api_key': None, 'use_legacy_mode': False, 'messages_to_consider': 4 } } }, 'tools': { 'valves': { 'email_tools': { 'FROM_EMAIL': 'xxxxxxxxxxxxxx', 'PASSWORD': 'xxxxxxxxxxxxxx' }, 'xxxxxxxxxxx': { .................................................a lot of problematic stuff here! } } } }, 'info': { 'location': 'xxxxx, xxxxx (lat, long)' }, 'oauth_sub': None }), 'spec': { 'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': { 'properties': { 'location': { 'default': 'Berlin', 'description': 'City name', 'type': 'string' } }, 'type': 'object' } }, 'metadata': { 'file_handler': False, 'citation': False } } }Why is the callable so blown up when the method is async? Is this a bug?
Actual Behavior
tools dict in my pipe contains event_emitter and user dict when tool methods use these parameters and method is async
Steps to Reproduce
Create a Pipe, use tools in outlet or inlet and print it out.
Use the Pipe together with a tool which has a async method which uses user
Inspect the log, 'callable' contains functools.partial with the complete content of the user dict!
Logs & Screenshots
With Async:
2025-08-05 21:40:59.677 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.221:0 - "GET / HTTP/1.1" 200 - {}
2025-08-05 21:41:05.107 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "POST /api/v1/chats/new HTTP/1.1" 200 - {}
2025-08-05 21:41:05.190 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-08-05 21:41:05.877 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/folders/ HTTP/1.1" 200 - {}
2025-08-05 21:41:05.893 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "POST /api/v1/chats/e56eb1d3-db34-4cf7-a97d-2e84f737208e HTTP/1.1" 200 - {}
2025-08-05 21:41:05.908 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
tools: {'echo': {'tool_id': 'test_mock_tool', 'callable': <function Tools.echo at 0x7f2fc6ad8180>, 'spec': {'name': 'echo', 'description': '\n Echo back a message.\n\n ', 'parameters': {'properties': {'message': {'description': 'Message to echo', 'type': 'string'}}, 'required': ['message'], 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}, 'get_temperature': {'tool_id': 'test_mock_tool', 'callable': functools.partial(<bound method Tools.get_temperature of <tool_test_mock_tool.Tools object at 0x7f2fc608f4d0>>, event_emitter=<function get_event_emitter..event_emitter at 0x7f2fbaf55e40>), 'spec': {'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': {'properties': {'location': {'default': 'Berlin', 'description': 'City name', 'type': 'string'}}, 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}, 'get_time': {'tool_id': 'test_mock_tool', 'callable': <function Tools.get_time at 0x7f2fbafa76a0>, 'spec': {'name': 'get_time', 'description': '\n Get current time (mock).\n\n ', 'parameters': {'properties': {}, 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}}
body['tools']: [{'type': 'function', 'function': {'name': 'echo', 'description': '\n Echo back a message.\n\n ', 'parameters': {'properties': {'message': {'description': 'Message to echo', 'type': 'string'}}, 'required': ['message'], 'type': 'object'}}}, {'type': 'function', 'function': {'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': {'properties': {'location': {'default': 'Berlin', 'description': 'City name', 'type': 'string'}}, 'type': 'object'}}}, {'type': 'function', 'function': {'name': 'get_time', 'description': '\n Get current time (mock).\n\n ', 'parameters': {'properties': {}, 'type': 'object'}}}]
Without:
2025-08-05 21:42:08.715 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/users/user/settings HTTP/1.1" 200 - {}
2025-08-05 21:42:16.584 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "POST /api/v1/chats/new HTTP/1.1" 200 - {}
2025-08-05 21:42:16.670 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-08-05 21:42:17.379 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/folders/ HTTP/1.1" 200 - {}
2025-08-05 21:42:17.416 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "POST /api/v1/chats/69650e19-d78b-4273-858a-3abd60b28da8 HTTP/1.1" 200 - {}
2025-08-05 21:42:17.432 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-08-05 21:42:18.106 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 192.168.105.123:0 - "GET /api/v1/folders/ HTTP/1.1" 200 - {}
tools: {'echo': {'tool_id': 'test_mock_tool', 'callable': <function Tools.echo at 0x7f2fbbd54860>, 'spec': {'name': 'echo', 'description': '\n Echo back a message.\n\n ', 'parameters': {'properties': {'message': {'description': 'Message to echo', 'type': 'string'}}, 'required': ['message'], 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}, 'get_temperature': {'tool_id': 'test_mock_tool', 'callable': <function Tools.get_temperature at 0x7f2fbbd55d00>, 'spec': {'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': {'properties': {'location': {'default': 'Berlin', 'description': 'City name', 'type': 'string'}}, 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}, 'get_time': {'tool_id': 'test_mock_tool', 'callable': <function Tools.get_time at 0x7f2fbbd565c0>, 'spec': {'name': 'get_time', 'description': '\n Get current time (mock).\n\n ', 'parameters': {'properties': {}, 'type': 'object'}}, 'metadata': {'file_handler': False, 'citation': False}}}
body['tools']: [{'type': 'function', 'function': {'name': 'echo', 'description': '\n Echo back a message.\n\n ', 'parameters': {'properties': {'message': {'description': 'Message to echo', 'type': 'string'}}, 'required': ['message'], 'type': 'object'}}}, {'type': 'function', 'function': {'name': 'get_temperature', 'description': '\n Get current temperature for a location (mock data).\n\n ', 'parameters': {'properties': {'location': {'default': 'Berlin', 'description': 'City name', 'type': 'string'}}, 'type': 'object'}}}, {'type': 'function', 'function': {'name': 'get_time', 'description': '\n Get current time (mock).\n\n ', 'parameters': {'properties': {}, 'type': 'object'}}}]
Additional Information
No response
@tjbck commented on GitHub (Aug 6, 2025):
Intended behaviour, these are just how async and sync functions are displayed in python.
@ctwardy commented on GitHub (Aug 19, 2025):
@tjbck Re-check? According to folded items, the async version (only) returns:
Pasting a part of that:
@Podden commented on GitHub (Sep 10, 2025):
As far as I understood, this is just what the pipe gets and IT has to decide which data is send to a potential llm provider. So you get the complete infos in your pipe and need to do some kind or processing before sending a request to a llm provider (obviously, because openwebui format differs from llm provider tool format of course.