Skip to content

Commit 4ddf8d5

Browse files
authored
Added thinking to google_gemini.py
Closes #53
1 parent 004e797 commit 4ddf8d5

3 files changed

Lines changed: 223 additions & 82 deletions

File tree

README.md

Lines changed: 34 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Open-WebUI-Functions
2+
23
![GitHub stars](https://img.shields.io/github/stars/owndev/Open-WebUI-Functions?style=social)
34
![GitHub forks](https://img.shields.io/github/forks/owndev/Open-WebUI-Functions?style=social)
45
![GitHub watchers](https://img.shields.io/github/watchers/owndev/Open-WebUI-Functions?style=social)
56
![GitHub top language](https://img.shields.io/github/languages/top/owndev/Open-WebUI-Functions)
67
![GitHub contributors](https://img.shields.io/github/contributors/owndev/Open-WebUI-Functions)
78
![GitHub License](https://img.shields.io/github/license/owndev/Open-WebUI-Functions)
89

9-
**Open-WebUI-Functions** is a collection of Python-based functions designed to extend the capabilities of [Open WebUI](https://own.dev/github-com-open-webui-open-webui) with additional **pipelines**, **filters**, and **integrations**. These functions allow users to interact with various AI models, process data efficiently, and customize the Open WebUI experience.
10-
11-
<br>
10+
**Open-WebUI-Functions** is a collection of Python-based functions designed to extend the capabilities of [Open WebUI](https://github.com/open-webui/open-webui) with additional **pipelines**, **filters**, and **integrations**. These functions allow users to interact with various AI models, process data efficiently, and customize the Open WebUI experience.
1211

1312
## Features ⭐
1413

@@ -18,28 +17,24 @@
1817

1918
- 🤝 **Azure AI Support**: Seamlessly connect Open WebUI with **Azure OpenAI** and other **Azure AI** models.
2019

21-
- 🤝 **N8N Workflow Integration**: Enable interactions with [N8N](https://own.dev/n8n-io) for automation.
20+
- 🤝 **N8N Workflow Integration**: Enable interactions with [N8N](https://n8n.io/) for automation.
2221

2322
- 📱 **Flexible Configuration**: Use environment variables to adjust function settings dynamically.
2423

2524
- 🚀 **Streaming and Non-Streaming Support**: Handle both real-time and batch processing efficiently.
2625

2726
- 🛡️ **Secure API Key Management**: Automatic encryption of sensitive information like API keys.
2827

29-
<br>
30-
3128
## Prerequisites 🔗
3229

3330
To use these functions, ensure the following:
3431

35-
1. **An Active Open WebUI Instance**: You must have [Open WebUI](https://own.dev/github-com-open-webui-open-webui) installed and running.
32+
1. **An Active Open WebUI Instance**: You must have [Open WebUI](https://github.com/open-webui/open-webui) installed and running.
3633

37-
2. **Required AI Services (if applicable)**: Some pipelines require external AI services, such as [Azure AI](https://own.dev/ai-azure-com).
34+
2. **Required AI Services (if applicable)**: Some pipelines require external AI services, such as [Azure AI](https://ai.azure.com/).
3835

3936
3. **Admin Access**: To install functions in Open WebUI, you must have administrator privileges.
4037

41-
<br>
42-
4338
## Installation 🚀
4439

4540
To install and configure functions in Open WebUI, follow these steps:
@@ -59,13 +54,11 @@ To install and configure functions in Open WebUI, follow these steps:
5954

6055
5. **Set Environment Variables (if required)**:
6156
- Some functions require API keys or specific configurations via environment variables.
62-
- Set [WEBUI_SECRET_KEY](https://own.dev/docs-openwebui-com-getting-started-env-configuration-webui-secret-key) for secure encryption of sensitive API keys.
57+
- Set [WEBUI_SECRET_KEY](https://docs.openwebui.com/getting-started/env-configuration/#webui_secret_key) for secure encryption of sensitive API keys.
6358

6459
6. **Save and Activate**:
6560
- Save the function, and it will be available for use within Open WebUI.
6661

67-
<br>
68-
6962
## Security Features 🛡️
7063

7164
### API Key Encryption
@@ -75,22 +68,20 @@ The functions include a built-in encryption mechanism for sensitive information:
7568
- **Automatic Encryption**: API keys and other sensitive data are automatically encrypted when stored.
7669
- **Encrypted Storage**: Values are stored with an "encrypted:" prefix followed by the encrypted data.
7770
- **Transparent Usage**: The encryption/decryption happens automatically when values are accessed.
78-
- **No Configuration Required**: Works out-of-the-box when [WEBUI_SECRET_KEY](https://own.dev/docs-openwebui-com-getting-started-env-configuration-webui-secret-key) is set.
79-
71+
- **No Configuration Required**: Works out-of-the-box when [WEBUI_SECRET_KEY](https://docs.openwebui.com/getting-started/env-configuration/#webui_secret_key) is set.
8072

8173
**To enable encryption:**
74+
8275
```bash
8376
# Set this in your Open WebUI environment or .env file
8477
WEBUI_SECRET_KEY="your-secure-random-string"
8578
```
8679

87-
<br>
88-
8980
## Pipelines 🧩
9081

9182
Pipelines are processing functions that extend Open WebUI with **custom AI models**, **external integrations**, and **data manipulation logic**.
9283

93-
### **1. [Azure AI Foundry Pipeline](https://own.dev/github-owndev-open-webui-functions-azure-ai-foundry)**
84+
### **1. [Azure AI Foundry Pipeline](./pipelines/azure/azure_ai_foundry.py)**
9485

9586
- Enables interaction with **Azure OpenAI** and other **Azure AI** models.
9687
- Supports multiple Azure AI models selection via the `AZURE_AI_MODEL` environment variable (e.g. `gpt-4o;gpt-4o-mini`).
@@ -100,112 +91,95 @@ Pipelines are processing functions that extend Open WebUI with **custom AI model
10091
- Predefined models for easy access.
10192
- Supports encryption of sensitive information like API keys.
10293

103-
🔗 [Azure AI Pipeline in Open WebUI](https://own.dev/openwebui-com-f-owndev-azure-ai)
94+
🔗 [Azure AI Pipeline in Open WebUI](https://openwebui.com/f/owndev/azure_ai)
10495

105-
🔗 [Learn More About Azure AI](https://own.dev/azure-microsoft-com-en-us-solutions-ai)
96+
🔗 [Learn More About Azure AI](https://azure.microsoft.com/en-us/solutions/ai)
10697

107-
<br>
108-
109-
### **2. [N8N Pipeline](https://own.dev/github-owndev-open-webui-functions-n8n-pipeline)**
98+
### **2. [N8N Pipeline](./pipelines/n8n/n8n.py)**
11099

111100
- Integrates **Open WebUI** with **N8N**, an automation and workflow platform.
112101
- Sends messages from Open WebUI to an **N8N webhook**.
113102
- Supports real-time message processing with dynamic field handling.
114103
- Enables automation of AI-generated responses within an **N8N workflow**.
115104
- Supports encryption of sensitive information like API keys.
116-
- Here is an example [N8N workflow](https://own.dev/github-owndev-open-webui-functions-open-webui-test-agent) for [N8N Pipeline](https://own.dev/github-owndev-open-webui-functions-n8n-pipeline)
117-
118-
🔗 [N8N Pipeline in Open WebUI](https://own.dev/openwebui-com-f-owndev-n8n-pipeline)
105+
- Here is an example [N8N workflow](./pipelines/n8n/Open_WebUI_Test_Agent.json) for [N8N Pipeline](./pipelines/n8n/n8n.py)
119106

120-
🔗 [Learn More About N8N](https://own.dev/n8n-io)
107+
🔗 [N8N Pipeline in Open WebUI](https://openwebui.com/f/owndev/n8n_pipeline)
121108

122-
<br>
109+
🔗 [Learn More About N8N](https://n8n.io/)
123110

124-
### **3. [Infomaniak](https://own.dev/github-owndev-open-webui-functions-infomaniak)**
111+
### **3. [Infomaniak](./pipelines/infomaniak/infomaniak.py)**
125112

126113
- Integrates **Open WebUI** with **Infomaniak**, a Swiss web hosting and cloud services provider.
127114
- Sends messages from Open WebUI to an **Infomaniak AI Tool**.
128115
- Supports encryption of sensitive information like API keys.
129116

130-
🔗 [Infomaniak Pipeline in Open WebUI](https://own.dev/openwebui-com-f-owndev-infomaniak-ai-tools)
117+
🔗 [Infomaniak Pipeline in Open WebUI](https://openwebui.com/f/owndev/infomaniak_ai_tools)
131118

132-
🔗 [Learn More About Infomaniak](https://own.dev/infomaniak-com-en-hosting-ai-tools)
119+
🔗 [Learn More About Infomaniak](https://www.infomaniak.com/en/hosting/ai-tools)
133120

134-
<br>
135-
136-
### **4. [Google Gemini](https://own.dev/github-owndev-open-webui-functions-google-gemini)**
121+
### **4. [Google Gemini](./pipelines/google/google_gemini.py)**
137122

138123
- Integrates **Open WebUI** with **Google Gemini**, a generative AI model by Google.
139124
- Integration with Google Generative AI or Vertex AI API for content generation.
140125
- Sends messages from Open WebUI to **Google Gemini**.
141126
- Supports encryption of sensitive information like API keys.
142127
- Supports both streaming and non-streaming responses.
128+
- Supports thinking and reasoning capabilities.
143129
- Provides configurable error handling and timeouts.
144130
- Grounding with Google search with [google_search_tool.py filter](./filters/google_search_tool.py)
145131
- Native tool calling support
146132

147-
🔗 [Google Gemini Pipeline in Open WebUI](https://own.dev/openwebui-com-f-owndev-google-gemini)
148-
149-
🔗 [Learn More About Google Gemini](https://own.dev/ai-google-dev-gemini-api-docs)
133+
🔗 [Google Gemini Pipeline in Open WebUI](https://openwebui.com/f/owndev/google_gemini)
150134

151-
<br>
135+
🔗 [Learn More About Google Gemini](https://ai.google.dev/gemini-api/docs?hl=de)
152136

153137
## Filters 🔍
154138

155139
Filters allow for **preprocessing and postprocessing** of data within Open WebUI.
156140

157-
### **1. [Time Token Tracker](https://own.dev/github-owndev-open-webui-functions-time-token-tracker)**
141+
### **1. [Time Token Tracker](./filters/time_token_tracker.py)**
158142

159143
- Measures **response time** and **token usage** for AI interactions.
160144
- Supports tracking of **total token usage** and **per-message token counts**.
161145
- Can calculate token usage for all messages or only a subset.
162146
- Uses OpenAI's `tiktoken` library for token counting (only accurate for OpenAI models).
163-
- Optional: Can send logs to [Azure Log Analytics Workspace](https://own.dev/learn-microsoft-com-en-us-azure-azure-monitor-logs-log-analytics-workspace-overview).
164-
165-
🔗 [Time Token Tracker in Open WebUI](https://own.dev/openwebui-com-f-owndev-time-token-tracker)
147+
- Optional: Can send logs to [Azure Log Analytics Workspace](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/log-analytics-workspace-overview).
166148

167-
🔗 [How to Setup Azure Log Analytics](https://own.dev/github-owndev-open-webui-functions-setup-azure-log-analytics)
149+
🔗 [Time Token Tracker in Open WebUI](https://openwebui.com/f/owndev/time_token_tracker)
168150

169-
<br>
151+
🔗 [How to Setup Azure Log Analytics](./docs/setup-azure-log-analytics.md)
170152

171153
## Integrations 🤝
172154

173155
### Azure AI
174156

175-
Look here for [Azure AI Integration](https://own.dev/github-owndev-open-webui-functions-azure-ai-integration-md).
176-
157+
Look here for [Azure AI Integration](./docs/azure-ai-integration.md).
177158

178159
### N8N
179160

180-
Look here for [N8N Integration](https://own.dev/github-owndev-open-webui-functions-n8n-integration-md).
181-
161+
Look here for [N8N Integration](./docs/n8n-integration.md).
182162

183163
### Infomaniak
184164

185-
Look here for [Infomaniak Integration](https://own.dev/github-owndev-open-webui-functions-infomaniak-integration-md).
186-
165+
Look here for [Infomaniak Integration](./docs/infomaniak-integration.md).
187166

188167
### Google
189168

190-
Look here for [Google Gemini Integration](https://own.dev/github-owndev-open-webui-functions-google-gemini-integration-md).
191-
192-
<br>
169+
Look here for [Google Gemini Integration](./docs/google-gemini-integration.md).
193170

194171
## Contribute 💪
195172

196-
We accept different types of contributions, including some that don't require you to write a single line of code.
173+
We accept different types of contributions, including some that don't require you to write a single line of code.
197174
For detailed instructions on how to get started with our project, see [about contributing to Open-WebUI-Functions](https://own.dev/github-owndev-open-webui-functions-contributing).
198175

199-
200176
## License 📜
201177

202-
This project is licensed under the [Apache License 2.0](https://own.dev/github-owndev-open-webui-functions-license) - see the [LICENSE](https://own.dev/github-owndev-open-webui-functions-license) file for details. 📄
203-
178+
This project is licensed under the [Apache License 2.0](./LICENSE) - see the [LICENSE](./LICENSE) file for details. 📄
204179

205180
## Support 💬
206181

207-
If you have any questions, suggestions, or need assistance, please open an [issue](https://own.dev/github-owndev-open-webui-functions-issues-new) to connect with us! 🤝
208-
182+
If you have any questions, suggestions, or need assistance, please open an [issue](../../issues/new/choose) to connect with us! 🤝
209183

210184
## Star History 💫
211185

@@ -219,4 +193,4 @@ If you have any questions, suggestions, or need assistance, please open an [issu
219193

220194
---
221195

222-
Created by [owndev](https://own.dev/github) - Let's make Open WebUI even more amazing together! 💪
196+
Created by [owndev](https://own.dev/github) - Let's make Open WebUI even more amazing together! 💪

docs/google-gemini-integration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ This integration enables **Open WebUI** to interact with **Google Gemini** model
2222
- **Streaming Response Support**
2323
Handles token-by-token responses with built-in safety enforcement.
2424

25+
- **Thinking Support**
26+
Support reasoning and thinking steps, allowing models to break down complex tasks.
27+
2528
- **Multimodal Input Support**
2629
Accepts both text and image data for more expressive interactions.
2730

0 commit comments

Comments
 (0)