mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-11 00:04:08 -05:00
[PR #2004] [MERGED] feat: add user toggleable web search #7655
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/2004
Author: @cheahjs
Created: 5/6/2024
Status: ✅ Merged
Merged: 5/27/2024
Merged by: @tjbck
Base:
websearch← Head:feat/backend-web-search📝 Commits (10+)
501ff7afeat: backend implementation of various search APIs99e4eddfeat: add websearch endpoint to RAG API83f086cfix: do not return raw search exception due to API keys in URLs8b3e370fix: run formatter635951bMerge branch 'dev' into feat/backend-web-searchfb80691feat: add WEB_SEARCH_RESULT_COUNT to control max number of results14a902ffeat: add web search toggle on chat619c2f9fix: toggle style2660a6efeat: prototype frontend web search integration77928aeMerge branch 'dev' of https://github.com/open-webui/open-webui into feat/web-search-toggle📊 Changes
57 files changed (+3474 additions, -60 deletions)
View changed files
📝
backend/apps/rag/main.py(+72 -17)➕
backend/apps/rag/search/brave.py(+37 -0)➕
backend/apps/rag/search/google_pse.py(+45 -0)➕
backend/apps/rag/search/main.py(+9 -0)➕
backend/apps/rag/search/searxng.py(+44 -0)➕
backend/apps/rag/search/serper.py(+39 -0)➕
backend/apps/rag/search/serpstack.py(+43 -0)➕
backend/apps/rag/search/testdata/brave.json(+998 -0)➕
backend/apps/rag/search/testdata/google_pse.json(+442 -0)➕
backend/apps/rag/search/testdata/searxng.json(+476 -0)➕
backend/apps/rag/search/testdata/serper.json(+190 -0)➕
backend/apps/rag/search/testdata/serpstack.json(+276 -0)📝
backend/apps/rag/utils.py(+43 -1)📝
backend/config.py(+19 -0)📝
backend/constants.py(+4 -0)📝
backend/main.py(+3 -1)📝
src/lib/apis/openai/index.ts(+117 -0)📝
src/lib/apis/rag/index.ts(+32 -0)📝
src/lib/components/chat/Chat.svelte(+76 -4)📝
src/lib/components/chat/MessageInput.svelte(+72 -0)...and 37 more files
📄 Description
Pull Request Checklist
Description
Adds the ability to perform web searches via the RAG API (
rag/api/v1/websearch) using the following search providers:SEARXNG_QUERY_URL, egSEARXNG_QUERY_URL=https://search.projectsegfau.lt/search?q=<query>GOOGLE_PSE_API_KEYandGOOGLE_PSE_ENGINE_IDBRAVE_SEARCH_API_KEYSERPSTACK_API_KEY(and an optionalSERPSTACK_HTTPS=false, since the free tier doesn't allow for HTTPS connections)SERPER_API_KEY.Users can configure how many of the top search results to crawl with
RAG_WEB_SEARCH_RESULT_COUNT, andRAG_WEB_SEARCH_CONCURRENT_REQUESTScontrols the number of concurrent requests made to crawl the search results.Users can toggle web search on or off on the UI, which causes the frontend to use a prompt to generate a search query, calling the RAG API to search for that query, and then injecting the results of that as a RAG document.
Implements #586
Changelog Entry
Added
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.