From e3485d2d88e736a4e3fabc394579fd1ed9951ef7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 18 Nov 2024 10:12:54 -0800 Subject: [PATCH] enh: __metadata__ param for tools & functions Co-Authored-By: DmitriyAlergant-T1A <93501479+dmitriyalergant-t1a@users.noreply.github.com> --- backend/open_webui/apps/webui/main.py | 1 + backend/open_webui/main.py | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/open_webui/apps/webui/main.py b/backend/open_webui/apps/webui/main.py index ae54ab29a..593dcb533 100644 --- a/backend/open_webui/apps/webui/main.py +++ b/backend/open_webui/apps/webui/main.py @@ -406,6 +406,7 @@ async def generate_function_chat_completion(form_data, user, models: dict = {}): "name": user.name, "role": user.role, }, + "__metadata__": metadata, } extra_params["__tools__"] = get_tools( app, diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 9230469d3..6f2c7ac42 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -604,6 +604,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware): "name": user.name, "role": user.role, }, + "__metadata__": metadata, } # Initialize data_items to store additional data to be sent to the client