-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add user toggleable web search #2004
Conversation
667ad57
to
7827ce0
Compare
fix: google PSE endpoint uses GET fix: google PSE returns link, not url fix: serper wrong field
7827ce0
to
8b3e370
Compare
Great! |
backend/apps/rag/search/brave.py
Outdated
"Accept-Encoding": "gzip", | ||
"X-Subscription-Token": api_key, | ||
} | ||
params = {"q": query, "count": 5} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use an env var to configure this?
…eat/web-search-toggle
fc00b32
to
724b13e
Compare
this is to handle when we have multiple models selected or regenerate a response, it'll only add it to the model's response and not add dupes on the user message
724b13e
to
f49e1af
Compare
So excited for this to be working, thank you for your hard work! I got ahead of myself and grabbed your fork to play with it, but I'm having problems figuring out the correct environment string to throw it for searxng to work properly. |
Pulled this down to test it out! It works very well for the most part. Here are some observations I've noticed while using it with a SearxNG instance.
|
So I think the garbage output in my second screenshot is probably more the model and its template than any potential issue with the search functionality. But maybe there should be some adjustments when handling follow-up queries. Example:
Maybe automatically toggling search off after a successful query would be a good first step, as otherwise Open WebUI keeps using each message to generate search queries. At least for me, the generally expected behavior would be that any follow-up questions use the existing search results. A more advanced way of handling it would be to leave search enabled, but indicate to the user that it won't necessarily be used unless more refinement is needed. This requires identifying follow-up questions and asking the LLM whether or not it thinks another web search is necessary. But so far the experience is very polished! I like it and hope it's merged soon. |
I believe Duck Duck Go offers a free search API as well so might be worth adding them, but I wouldn't delay merging this PR to do that |
Thank-you, this is interesting and working quite well. |
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_KEY
andGOOGLE_PSE_ENGINE_ID
BRAVE_SEARCH_API_KEY
SERPSTACK_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_REQUESTS
controls 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.
chrome_Cmvaz6Drqg.mp4
Implements #586
Changelog Entry
Added