|
4 | 4 | author_url: https://github.com/owndev/ |
5 | 5 | project_url: https://github.com/owndev/Open-WebUI-Functions |
6 | 6 | funding_url: https://github.com/sponsors/owndev |
7 | | -version: 1.6.0 |
| 7 | +version: 1.6.1 |
8 | 8 | license: Apache License 2.0 |
9 | 9 | description: Highly optimized Google Gemini pipeline with advanced image generation capabilities, intelligent compression, and streamlined processing workflows. |
10 | 10 | features: |
|
30 | 30 | - Optimized payload creation for image generation models |
31 | 31 | - Configurable image processing parameters (size, quality, compression) |
32 | 32 | - Flexible upload fallback options and optimization controls |
33 | | - - Ability to forward User Headers and change gemini base url |
34 | 33 | """ |
35 | 34 |
|
36 | 35 | import os |
@@ -159,10 +158,9 @@ class Valves(BaseModel): |
159 | 158 | default=os.getenv("GOOGLE_API_KEY", ""), |
160 | 159 | description="API key for Google Generative AI (used if USE_VERTEX_AI is false).", |
161 | 160 | ) |
162 | | - ENABLE_FORWARD_USER_INFO_HEADERS: bool = Field( |
163 | | - default=os.getenv("ENABLE_FORWARD_USER_INFO_HEADERS", "false").lower() |
164 | | - == "true", |
165 | | - description="Whether to forward user information headers.", |
| 161 | + API_VERSION: str = Field( |
| 162 | + default=os.getenv("GOOGLE_API_VERSION", "v1alpha"), |
| 163 | + description="API version to use for Google Generative AI (e.g., v1alpha, v1beta, v1).", |
166 | 164 | ) |
167 | 165 | USE_VERTEX_AI: bool = Field( |
168 | 166 | default=os.getenv("GOOGLE_GENAI_USE_VERTEXAI", "false").lower() == "true", |
@@ -479,20 +477,8 @@ def _get_client(self) -> genai.Client: |
479 | 477 | ) |
480 | 478 | else: |
481 | 479 | self.log.debug("Initializing Google Generative AI client with API Key") |
482 | | - headers = {} |
483 | | - if ( |
484 | | - self.valves.ENABLE_FORWARD_USER_INFO_HEADERS |
485 | | - and hasattr(self, "user") |
486 | | - and self.user |
487 | | - ): |
488 | | - headers = { |
489 | | - "X-OpenWebUI-User-Name": self.user.name, |
490 | | - "X-OpenWebUI-User-Id": self.user.id, |
491 | | - "X-OpenWebUI-User-Email": self.user.email, |
492 | | - "X-OpenWebUI-User-Role": self.user.role, |
493 | | - } |
494 | 480 | options = types.HttpOptions( |
495 | | - api_version="v1alpha", base_url=self.valves.BASE_URL, headers=headers |
| 481 | + api_version=self.valves.API_VERSION, base_url=self.valves.BASE_URL |
496 | 482 | ) |
497 | 483 | return genai.Client( |
498 | 484 | api_key=self.valves.GOOGLE_API_KEY.get_decrypted(), http_options=options |
|
0 commit comments