[PR #4974] [MERGED] feat: Add support for SearchApi as alternative to WebSearch #8399

Closed
opened 2025-11-11 17:55:34 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/4974
Author: @raju249
Created: 8/28/2024
Status: Merged
Merged: 8/30/2024
Merged by: @tjbck

Base: devHead: add-search-api


📝 Commits (1)

  • 7e1923f Add searchapi as an alternative web search

📊 Changes

7 files changed (+504 additions, -2 deletions)

View changed files

📝 README.md (+1 -1)
📝 backend/apps/rag/main.py (+27 -0)
📝 backend/apps/rag/search/main.py (+2 -1)
backend/apps/rag/search/searchapi.py (+50 -0)
backend/apps/rag/search/testdata/searchapi.json (+383 -0)
📝 backend/config.py (+12 -0)
📝 src/lib/components/admin/Settings/WebSearch.svelte (+29 -0)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

Added SearchApi Google Search Api as an option for web search alternatives. Based on our customer requests we are raising the PR to add SearchAPI as an option. We are ready to invest time in adding open-source integrations. This can be a great addition to the Open WebUI web search. I have opened the docs PR too. Please feel free to mention @raju249 and @SebastjanPrachovskij for any future reviews for PR related to SearchApi. We would be happy to help.

The end user can change the search engine used on the SearchApi side via the SEARCHAPI_ENGINE parameter. Organic results share the same structure across all existing and upcoming SERP engines, so we will always have a title, snippet, and link. Google, Bing, Baidu, Google News, Bing News, Google Videos, Google Scholar, and Google Patents are already supported. Yandex and Yahoo are coming soon as well.

Added

  • Added SEARCHAPI_API_KEY API key to the config.
  • Added SEARCHAPI_ENGINE key to the config to change engine based on user preferences.
  • Added searchapi as an option for webSearchEngines.
  • Added backend/apps/rag/search/searchapi.py which is the main function for calling SearchApi Google Search Api by default if SEARCHAPI_ENGINE is not present from the config.
  • Builds the query payload with api_key and query parameter.
  • Updated config to set SEARCHAPI_API_KEY in the config.
  • Added Search Api test data.

Changed

  • Updated README.md to include SearchApi.io as an option for Web Search.

Screenshots or Videos

Selecting the search and setting the API key and Engine

Screenshot 2024-08-28 at 2 48 03 PM

Performing the search

Screenshot 2024-08-27 at 5 45 18 PM


🔄 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/open-webui/pull/4974 **Author:** [@raju249](https://github.com/raju249) **Created:** 8/28/2024 **Status:** ✅ Merged **Merged:** 8/30/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `add-search-api` --- ### 📝 Commits (1) - [`7e1923f`](https://github.com/open-webui/open-webui/commit/7e1923fcfe18a109c3b8516e812197d7378ed887) Add searchapi as an alternative web search ### 📊 Changes **7 files changed** (+504 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `backend/apps/rag/main.py` (+27 -0) 📝 `backend/apps/rag/search/main.py` (+2 -1) ➕ `backend/apps/rag/search/searchapi.py` (+50 -0) ➕ `backend/apps/rag/search/testdata/searchapi.json` (+383 -0) 📝 `backend/config.py` (+12 -0) 📝 `src/lib/components/admin/Settings/WebSearch.svelte` (+29 -0) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests for validating the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description Added [SearchApi Google Search Api](https://www.searchapi.io/docs/google) as an option for web search alternatives. Based on our customer requests we are raising the PR to add SearchAPI as an option. We are ready to invest time in adding open-source integrations. This can be a great addition to the Open WebUI web search. I have opened the [docs](https://github.com/open-webui/docs/pull/198) PR too. Please feel free to mention @raju249 and @SebastjanPrachovskij for any future reviews for PR related to SearchApi. We would be happy to help. The end user can change the search engine used on the SearchApi side via the `SEARCHAPI_ENGINE` parameter. Organic results share the same structure across all existing and upcoming SERP engines, so we will always have a `title`, `snippet`, and `link`. Google, Bing, Baidu, Google News, Bing News, Google Videos, Google Scholar, and Google Patents are already supported. Yandex and Yahoo are coming soon as well. ### Added - Added `SEARCHAPI_API_KEY` API key to the config. - Added `SEARCHAPI_ENGINE` key to the config to change engine based on user preferences. - Added `searchapi` as an option for `webSearchEngines`. - Added `backend/apps/rag/search/searchapi.py` which is the main function for calling [SearchApi](https://searchapi.io) Google Search Api by default if `SEARCHAPI_ENGINE` is not present from the config. - Builds the query payload with api_key and query parameter. - Updated config to set `SEARCHAPI_API_KEY` in the config. - Added Search Api test data. ### Changed - Updated README.md to include [SearchApi.io](https://searchapi.io) as an option for Web Search. ### Screenshots or Videos Selecting the search and setting the API key and Engine ![Screenshot 2024-08-28 at 2 48 03 PM](https://github.com/user-attachments/assets/b541d1f0-53d3-4b55-968d-249c1827576f) Performing the search ![Screenshot 2024-08-27 at 5 45 18 PM](https://github.com/user-attachments/assets/a2acf87c-a0a0-4e57-ab56-7198f4c385e4) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-11 17:55:34 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#8399