📚 docs: Add SearXNG Configuration and Setup Instructions for Web Search (#348)

- Introduced new environment variables for SearXNG: SEARXNG_INSTANCE_URL and SEARXNG_API_KEY.
- Updated documentation to include detailed setup instructions for configuring SearXNG with LibreChat.
- Added new images and a video guide to assist users in setting up and configuring SearXNG.
- Enhanced existing web search documentation to clarify the integration of SearXNG as a search provider
This commit is contained in:
Dustin Healy
2025-07-07 08:19:22 -07:00
committed by GitHub
parent e621266b5c
commit 8907e43abc
10 changed files with 114 additions and 8 deletions

View File

@@ -118,6 +118,8 @@ see: [OCR Config Object Structure](/docs/configuration/librechat_yaml/object_str
<OptionTable
options={[
['serperApiKey', 'String', 'Environment variable name for the Serper API key. If not set in .env, users will be prompted to provide it via UI.', ''],
['searxngInstanceUrl', 'String', 'Environment variable name for the SearXNG instance URL. If not set in .env, users will be prompted to provide it via UI.', ''],
['searxngApiKey', 'String', 'Environment variable name for the SearXNG API key. If not set in .env, users will be prompted to provide it via UI.', ''],
['firecrawlApiKey', 'String', 'Environment variable name for the Firecrawl API key. If not set in .env, users will be prompted to provide it via UI.', ''],
['firecrawlApiUrl', 'String', 'Environment variable name for the Firecrawl API URL. If not set in .env, users will be prompted to provide it via UI.', ''],
['jinaApiKey', 'String', 'Environment variable name for the Jina API key. If not set in .env, users will be prompted to provide it via UI.', ''],

View File

@@ -16,6 +16,8 @@ The web search feature consists of three main components:
webSearch:
# Search Provider Configuration
serperApiKey: "${SERPER_API_KEY}"
searxngInstanceUrl: "${SEARXNG_INSTANCE_URL}"
searxngApiKey: "${SEARXNG_API_KEY}"
searchProvider: "serper" # Options: "serper", "searxng"
# Scraper Configuration
@@ -35,6 +37,14 @@ webSearch:
## Search Providers
### searchProvider
<OptionTable
options={[
['searchProvider', 'String', 'Specifies which search provider to use.', 'Options: "serper", "searxng"'],
]}
/>
### serperApiKey
<OptionTable
@@ -45,14 +55,26 @@ webSearch:
**Note:** Get your API key from [Serper.dev](https://serper.dev/api-key)
### searchProvider
### searxngInstanceUrl
<OptionTable
options={[
['searchProvider', 'String', 'Specifies which search provider to use.', 'Options: "serper", "searxng"'],
['searxngInstanceUrl', 'String', 'Environment variable name for the SearXNG instance URL. If not set in .env, users will be prompted to provide it via UI.', '${SEARXNG_INSTANCE_URL}'],
]}
/>
### searxngApiKey
<OptionTable
options={[
['searxngApiKey', 'String', 'Environment variable name for the SearXNG API key. If not set in .env, users will be prompted to provide it via UI.', '${SEARXNG_API_KEY}'],
]}
/>
**Note:** This is optional and only needed if your SearXNG instance requires authentication.
## Scrapers
### firecrawlApiKey
@@ -141,4 +163,72 @@ webSearch:
- The configuration supports multiple services for each component (providers, scrapers, rerankers)
- If a specific service type is not specified, the system will try all available services in that category
- Safe search provides three levels of content filtering: OFF (0), MODERATE (1), and STRICT (2)
- Never put actual API keys in the YAML configuration - only use environment variable names
- Never put actual API keys in the YAML configuration - only use environment variable names
## Setting Up SearXNG
SearXNG is a privacy-focused meta search engine that you can self-host.
For more information, see the [official SearXNG documentation](https://docs.searxng.org/).
Here are the steps to set up your own SearXNG instance for use with LibreChat:
### Using Docker Desktop
1. **Search for the official SearXNG image**
- Open Docker Desktop
- Search for `searxng/searxng` in the **Images** tab
- Click **Run** on the official image to automatically pull down and run a container of the image
2. **Running the container**
- Expand the **Optional Settings** dropdown in the proceeding panel that appears once the download completes
- Set your desired configuration details (port number, container name, etc.)
- Click **Run** to start the container
3. **Configure SearXNG for LibreChat**
- Navigate to the `Files` tab in Docker Desktop
- Go to `/etc/searxng/settings.yaml`
- Open the file editor
- Navigate to the `formats` section
- Add `json` as an acceptable format so that LibreChat can communicate with your instance
- Save the file
4. **Restart the container**
- Restart the container for the changes to take effect
#### Video Guide:
Here's a video to guide you through the process from start to finish in about a minute:
<video
muted
controls
>
<source src="/videos/min_searxng_docker_setup_hq.mp4" />
</video>
**Note:** In this example, the instance URL is http://localhost:55011 (port number found under the container name in the top left at the end of the video)
### Configuring LibreChat to use SearXNG
You can configure SearXNG in LibreChat within the UI or through `librechat.yaml`.
#### UI Configuration
1. **Open the tools dropdown in the chat input bar**
![Tools configuration button](/images/web-search/tools_highlight.png)
2. **Click on the gear icon next to Web Search**
![Tools configuration section](/images/web-search/tools_config_highlight.png)
3. **Select SearXNG from the Search Provider dropdown**
![SearXNG dropdown selection](/images/web-search/searxng_dropdown_highlight.png)
4. **Enter your configuration details (e.g. instance URL, scraper type, etc.) and click save**
![Save web search configuration](/images/web-search/web_search_save.png)
5. **Click on the Web Search option in the tools dropdown**
![Web search badge in chat interface](/images/web-search/websearch_highlight.png)
6. **The Web Search badge should now be enabled, meaning your queries can now utilize the web search functionality**
![Web search badge confirmation](/images/web-search/search_badge_confirm.png)

View File

@@ -10,6 +10,9 @@ To get started with web search, you'll need to configure API keys for all three
```bash
# Search Provider (Required)
SERPER_API_KEY=your_serper_api_key
# or
SEARXNG_INSTANCE_URL=your_searxng_instance_url
SEARXNG_API_KEY=your_searxng_api_key # Optional
# Scraper (Required)
FIRECRAWL_API_KEY=your_firecrawl_api_key
@@ -24,20 +27,26 @@ To get started with web search, you'll need to configure API keys for all three
2. **User Interface** (If environment variables are not set):
- Users will be prompted to enter the required API keys when they first use the web search feature
- They can choose which reranker service to use (Jina or Cohere)
- They can choose which search provider (Serper or SearXNG) and which reranker service to use (Jina or Cohere)
## Obtaining API Keys
Each component of the web search feature requires its own API key. Here's how to obtain them:
### Search Provider: Serper
### Search Providers
#### Serper
1. Visit [Serper.dev](https://serper.dev/api-key)
2. Sign up for an account
3. Navigate to the API Key section
4. Copy your API key
5. Set it in your environment variables or provide it through the UI
#### SearXNG
1. Follow the setup instructions in the [Web Search Configuration](/docs/configuration/librechat_yaml/object_structure/web_search#setting-up-searxng) documentation
2. Set `SEARXNG_INSTANCE_URL` to your instance URL
3. Optionally set `SEARXNG_API_KEY` if your instance requires authentication
### Scraper: Firecrawl
1. Visit [Firecrawl.dev](https://docs.firecrawl.dev/introduction#api-key)
@@ -72,10 +81,9 @@ Search providers are responsible for performing the initial web search and retur
**Available Providers:**
- **Serper**: A Google Search API that provides high-quality search results
- Get your API key from [Serper.dev](https://serper.dev/api-key)
**Planned Providers:**
- **SearXNG**: Open-source, self-hosted meta search engine
- Additional third-party search services
- Self-host your own instance
- Privacy-focused search results
### 2. Scrapers
@@ -117,6 +125,11 @@ webSearch:
# Search Provider Configuration
serperApiKey: "${CUSTOM_SERPER_API_KEY}" # ✅ Correct: Using environment variable name
# serperApiKey: "sk-123..." # ❌ Wrong: Never put actual API keys here
# or
searxngInstanceUrl: "${CUSTOM_SEARXNG_INSTANCE_URL}" # ✅ Correct: Using environment variable name
searxngApiKey: "${CUSTOM_SEARXNG_API_KEY}" # ✅ Correct: Using environment variable name
# searxngInstanceUrl: "http://..." # ❌ Wrong: Never put actual URLs here
# searxngApiKey: "sk-123..." # ❌ Wrong: Never put actual API keys here
# Scraper Configuration
firecrawlApiKey: "${CUSTOM_FIRECRAWL_API_KEY}"
@@ -145,6 +158,7 @@ If you want to restrict the system to use only specific services, you can specif
webSearch:
# ... variable configurations ...
searchProvider: "serper" # Only use Serper for search
# searchProvider: "searxng" # Only use SearXNG for search
scraperType: "firecrawl" # Only use Firecrawl for scraping
rerankerType: "jina" # Only use Jina for reranking
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.