Skip to content

Commit 5db7eb4

Browse files
authored
Merge branch 'main' into fix/native-detection
Signed-off-by: owndev <69784886+owndev@users.noreply.github.com>
2 parents cbeacca + ee847c6 commit 5db7eb4

File tree

1 file changed

+2
-50
lines changed

1 file changed

+2
-50
lines changed

pipelines/google/google_gemini.py

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
author_url: https://github.com/owndev/
55
project_url: https://github.com/owndev/Open-WebUI-Functions
66
funding_url: https://github.com/sponsors/owndev
7-
version: 1.6.6
7+
version: 1.6.7
8+
required_open_webui_version: 0.6.26
89
license: Apache License 2.0
910
description: Highly optimized Google Gemini pipeline with advanced image generation capabilities, intelligent compression, and streamlined processing workflows.
1011
features:
@@ -33,8 +34,6 @@
3334
"""
3435

3536
import os
36-
import inspect
37-
from functools import update_wrapper
3837
import re
3938
import time
4039
import asyncio
@@ -1340,53 +1339,6 @@ def _upload_image(
13401339
# Fallback to data URL if upload fails
13411340
return f"data:{mime_type};base64,{image_data}"
13421341

1343-
@staticmethod
1344-
def _create_tool(tool_def):
1345-
"""OpenwebUI tool is a functools.partial coroutine, which genai does not support directly.
1346-
See https://github.com/googleapis/python-genai/issues/907
1347-
1348-
This function wraps the tool into a callable that can be used with genai.
1349-
In particular, it sets the signature of the function properly,
1350-
removing any frozen keyword arguments (extra_params).
1351-
"""
1352-
bound_callable = tool_def["callable"]
1353-
1354-
# Create a wrapper for bound_callable, which is always async
1355-
async def wrapper(*args, **kwargs):
1356-
return await bound_callable(*args, **kwargs)
1357-
1358-
# Remove 'frozen' keyword arguments (extra_params) from the signature
1359-
original_sig = inspect.signature(bound_callable)
1360-
frozen_kwargs = {
1361-
"__event_emitter__",
1362-
"__event_call__",
1363-
"__user__",
1364-
"__metadata__",
1365-
"__request__",
1366-
"__model__",
1367-
}
1368-
new_parameters = []
1369-
1370-
for name, parameter in original_sig.parameters.items():
1371-
# Exclude keyword arguments that are frozen
1372-
if name in frozen_kwargs and parameter.kind in (
1373-
inspect.Parameter.POSITIONAL_OR_KEYWORD,
1374-
inspect.Parameter.KEYWORD_ONLY,
1375-
):
1376-
continue
1377-
# Keep remaining parameters
1378-
new_parameters.append(parameter)
1379-
1380-
new_sig = inspect.Signature(
1381-
parameters=new_parameters, return_annotation=original_sig.return_annotation
1382-
)
1383-
1384-
# Ensure name, docstring and signature are properly set
1385-
update_wrapper(wrapper, bound_callable)
1386-
wrapper.__signature__ = new_sig
1387-
1388-
return wrapper
1389-
13901342
def _configure_generation(
13911343
self,
13921344
body: Dict[str, Any],

0 commit comments

Comments
 (0)