[PR #57] [MERGED] feat: Add Google Programmable Search Engine (PSE) Tool Server #13

Closed
opened 2026-02-15 20:17:05 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/openapi-servers/pull/57
Author: @taylorwilsdon
Created: 7/17/2025
Status: Merged
Merged: 9/1/2025
Merged by: @tjbck

Base: mainHead: google_pse


📝 Commits (6)

📊 Changes

5 files changed (+388 additions, -0 deletions)

View changed files

servers/google-pse/Dockerfile (+51 -0)
servers/google-pse/README.md (+154 -0)
servers/google-pse/compose.yaml (+6 -0)
servers/google-pse/main.py (+172 -0)
servers/google-pse/requirements.txt (+5 -0)

📄 Description

This PR allows for "magic" native tool calling for web search without downstream scraping - very useful while still preserving the core Open WebUI Web Search capabilities for things that require greater research.

image

Summary

This PR introduces a new FastAPI-based server that provides web search functionality using Google's Programmable Search Engine via the Custom Search JSON API. The server offers a clean, RESTful interface for performing web searches with comprehensive filtering and configuration options.

What's New

Core Features

  • Web Search API: Perform searches using Google's Custom Search JSON API
  • Advanced Filtering: Support for language, country, date restrictions, file types, and site-specific searches
  • Flexible Configuration: Environment variable or query parameter-based API key and search engine ID configuration
  • Rich Metadata: Returns search timing, result counts, and pagination information
  • Safety Controls: Configurable safe search filtering

Files Added

🔧 Technical Details

API Endpoints

  • GET /search - Main search endpoint with comprehensive query parameters
  • GET /health - Health check endpoint

Key Parameters

  • Required: q (search query)
  • Optional: num, start, safe, lr, cr, dateRestrict, exactTerms, excludeTerms, fileType, siteSearch, siteSearchFilter

Configuration

Requires two environment variables:

  • GOOGLE_API_KEY - Google API key with Custom Search API enabled
  • GOOGLE_PSE_CX - Programmable Search Engine ID

Security & Best Practices

  • Non-privileged user in Docker container
  • Proper error handling and validation
  • CORS middleware for cross-origin requests
  • Comprehensive Pydantic models for type safety

Testing

The server can be tested locally with:

cd servers/google-pse
pip install -r requirements.txt
export GOOGLE_API_KEY="your_key"
export GOOGLE_PSE_CX="your_cx"
uvicorn main:app --reload

Or with Docker:

docker-compose up --build

Documentation

  • Interactive API docs available at /docs
  • OpenAPI specification at /openapi.json
  • Comprehensive README with setup instructions and examples

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/openapi-servers/pull/57 **Author:** [@taylorwilsdon](https://github.com/taylorwilsdon) **Created:** 7/17/2025 **Status:** ✅ Merged **Merged:** 9/1/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `main` ← **Head:** `google_pse` --- ### 📝 Commits (6) - [`2ab5136`](https://github.com/open-webui/openapi-servers/commit/2ab51364b6762d36ebc2954b1c7ce2820b41d7bf) Update README.md - [`1e69956`](https://github.com/open-webui/openapi-servers/commit/1e69956afaa66b0c750d4404c02c925eacbaaefd) Update README.md - [`ab5ac99`](https://github.com/open-webui/openapi-servers/commit/ab5ac99502716b318ace771b854d2b60703bc3b9) Update README.md - [`b30ad45`](https://github.com/open-webui/openapi-servers/commit/b30ad45f783bf9493562f869cf2c2740b86d6ad8) Merge branch 'open-webui:main' into main - [`089ecbd`](https://github.com/open-webui/openapi-servers/commit/089ecbdbbdee9d320aa31374312bae28c673de72) add Google PSE OpenAPI tool server - [`549ed08`](https://github.com/open-webui/openapi-servers/commit/549ed0803b9b27bef70cc53012e23b7e4f641ae1) revert readme change ### 📊 Changes **5 files changed** (+388 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `servers/google-pse/Dockerfile` (+51 -0) ➕ `servers/google-pse/README.md` (+154 -0) ➕ `servers/google-pse/compose.yaml` (+6 -0) ➕ `servers/google-pse/main.py` (+172 -0) ➕ `servers/google-pse/requirements.txt` (+5 -0) </details> ### 📄 Description This PR allows for "magic" native tool calling for web search without downstream scraping - very useful while still preserving the core Open WebUI Web Search capabilities for things that require greater research. <img width="1957" height="1269" alt="image" src="https://github.com/user-attachments/assets/7e6cf38a-faa4-4c31-aa5b-1821fdc2c74b" /> ## Summary This PR introduces a new FastAPI-based server that provides web search functionality using Google's Programmable Search Engine via the Custom Search JSON API. The server offers a clean, RESTful interface for performing web searches with comprehensive filtering and configuration options. ## What's New ### Core Features - **Web Search API**: Perform searches using Google's Custom Search JSON API - **Advanced Filtering**: Support for language, country, date restrictions, file types, and site-specific searches - **Flexible Configuration**: Environment variable or query parameter-based API key and search engine ID configuration - **Rich Metadata**: Returns search timing, result counts, and pagination information - **Safety Controls**: Configurable safe search filtering ### Files Added - [`servers/google-pse/main.py`](servers/google-pse/main.py) - FastAPI application with search endpoints - [`servers/google-pse/Dockerfile`](servers/google-pse/Dockerfile) - Multi-stage Docker build with security best practices - [`servers/google-pse/compose.yaml`](servers/google-pse/compose.yaml) - Docker Compose configuration - [`servers/google-pse/requirements.txt`](servers/google-pse/requirements.txt) - Python dependencies - [`servers/google-pse/README.md`](servers/google-pse/README.md) - Comprehensive documentation ## 🔧 Technical Details ### API Endpoints - **`GET /search`** - Main search endpoint with comprehensive query parameters - **`GET /health`** - Health check endpoint ### Key Parameters - **Required**: `q` (search query) - **Optional**: `num`, `start`, `safe`, `lr`, `cr`, `dateRestrict`, `exactTerms`, `excludeTerms`, `fileType`, `siteSearch`, `siteSearchFilter` ### Configuration Requires two environment variables: - `GOOGLE_API_KEY` - Google API key with Custom Search API enabled - `GOOGLE_PSE_CX` - Programmable Search Engine ID ### Security & Best Practices - Non-privileged user in Docker container - Proper error handling and validation - CORS middleware for cross-origin requests - Comprehensive Pydantic models for type safety ## Testing The server can be tested locally with: ```bash cd servers/google-pse pip install -r requirements.txt export GOOGLE_API_KEY="your_key" export GOOGLE_PSE_CX="your_cx" uvicorn main:app --reload ``` Or with Docker: ```bash docker-compose up --build ``` ## Documentation - Interactive API docs available at `/docs` - OpenAPI specification at `/openapi.json` - Comprehensive README with setup instructions and examples --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 20:17:05 -05:00
yindo closed this issue 2026-02-15 20:17:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/openapi-servers#13