Skip to content

Commit 6c63723

Browse files
Claudeowndev
andcommitted
Fix: Handle None metadata in Gemini pipeline to prevent AttributeError
When no filters are installed or Open WebUI doesn't provide the __metadata__ parameter, it can be None, causing "'NoneType' object has no attribute 'get'" error. Added defensive check: metadata = __metadata__ or {} This ensures metadata is always a dict, even when __metadata__ is None. Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
1 parent f507714 commit 6c63723

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pipelines/google/google_gemini.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,8 +1925,10 @@ def _configure_generation(
19251925
gen_config_params |= {"safety_settings": safety_settings}
19261926

19271927
# Add various tools to Gemini as required
1928-
features = __metadata__.get("features", {})
1929-
params = __metadata__.get("params", {})
1928+
# Handle case where __metadata__ might be None
1929+
metadata = __metadata__ or {}
1930+
features = metadata.get("features", {})
1931+
params = metadata.get("params", {})
19301932
tools = []
19311933

19321934
if features.get("google_search_tool", False):

0 commit comments

Comments
 (0)