mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 10:48:32 +07:00
📚 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:
@@ -118,6 +118,8 @@ see: [OCR Config Object Structure](/docs/configuration/librechat_yaml/object_str
|
|||||||
<OptionTable
|
<OptionTable
|
||||||
options={[
|
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.', ''],
|
['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.', ''],
|
['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.', ''],
|
['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.', ''],
|
['jinaApiKey', 'String', 'Environment variable name for the Jina API key. If not set in .env, users will be prompted to provide it via UI.', ''],
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ The web search feature consists of three main components:
|
|||||||
webSearch:
|
webSearch:
|
||||||
# Search Provider Configuration
|
# Search Provider Configuration
|
||||||
serperApiKey: "${SERPER_API_KEY}"
|
serperApiKey: "${SERPER_API_KEY}"
|
||||||
|
searxngInstanceUrl: "${SEARXNG_INSTANCE_URL}"
|
||||||
|
searxngApiKey: "${SEARXNG_API_KEY}"
|
||||||
searchProvider: "serper" # Options: "serper", "searxng"
|
searchProvider: "serper" # Options: "serper", "searxng"
|
||||||
|
|
||||||
# Scraper Configuration
|
# Scraper Configuration
|
||||||
@@ -35,6 +37,14 @@ webSearch:
|
|||||||
|
|
||||||
## Search Providers
|
## Search Providers
|
||||||
|
|
||||||
|
### searchProvider
|
||||||
|
|
||||||
|
<OptionTable
|
||||||
|
options={[
|
||||||
|
['searchProvider', 'String', 'Specifies which search provider to use.', 'Options: "serper", "searxng"'],
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
|
||||||
### serperApiKey
|
### serperApiKey
|
||||||
|
|
||||||
<OptionTable
|
<OptionTable
|
||||||
@@ -45,14 +55,26 @@ webSearch:
|
|||||||
|
|
||||||
**Note:** Get your API key from [Serper.dev](https://serper.dev/api-key)
|
**Note:** Get your API key from [Serper.dev](https://serper.dev/api-key)
|
||||||
|
|
||||||
### searchProvider
|
|
||||||
|
### searxngInstanceUrl
|
||||||
|
|
||||||
<OptionTable
|
<OptionTable
|
||||||
options={[
|
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
|
## Scrapers
|
||||||
|
|
||||||
### firecrawlApiKey
|
### firecrawlApiKey
|
||||||
@@ -141,4 +163,72 @@ webSearch:
|
|||||||
- The configuration supports multiple services for each component (providers, scrapers, rerankers)
|
- 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
|
- 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)
|
- 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**
|
||||||
|

|
||||||
|
|
||||||
|
2. **Click on the gear icon next to Web Search**
|
||||||
|

|
||||||
|
|
||||||
|
3. **Select SearXNG from the Search Provider dropdown**
|
||||||
|

|
||||||
|
|
||||||
|
4. **Enter your configuration details (e.g. instance URL, scraper type, etc.) and click save**
|
||||||
|

|
||||||
|
|
||||||
|
5. **Click on the Web Search option in the tools dropdown**
|
||||||
|

|
||||||
|
|
||||||
|
6. **The Web Search badge should now be enabled, meaning your queries can now utilize the web search functionality**
|
||||||
|

|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ To get started with web search, you'll need to configure API keys for all three
|
|||||||
```bash
|
```bash
|
||||||
# Search Provider (Required)
|
# Search Provider (Required)
|
||||||
SERPER_API_KEY=your_serper_api_key
|
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)
|
# Scraper (Required)
|
||||||
FIRECRAWL_API_KEY=your_firecrawl_api_key
|
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):
|
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
|
- 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
|
## Obtaining API Keys
|
||||||
|
|
||||||
Each component of the web search feature requires its own API key. Here's how to obtain them:
|
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)
|
1. Visit [Serper.dev](https://serper.dev/api-key)
|
||||||
2. Sign up for an account
|
2. Sign up for an account
|
||||||
3. Navigate to the API Key section
|
3. Navigate to the API Key section
|
||||||
4. Copy your API key
|
4. Copy your API key
|
||||||
5. Set it in your environment variables or provide it through the UI
|
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
|
### Scraper: Firecrawl
|
||||||
|
|
||||||
1. Visit [Firecrawl.dev](https://docs.firecrawl.dev/introduction#api-key)
|
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:**
|
**Available Providers:**
|
||||||
- **Serper**: A Google Search API that provides high-quality search results
|
- **Serper**: A Google Search API that provides high-quality search results
|
||||||
- Get your API key from [Serper.dev](https://serper.dev/api-key)
|
- Get your API key from [Serper.dev](https://serper.dev/api-key)
|
||||||
|
|
||||||
**Planned Providers:**
|
|
||||||
- **SearXNG**: Open-source, self-hosted meta search engine
|
- **SearXNG**: Open-source, self-hosted meta search engine
|
||||||
- Additional third-party search services
|
- Self-host your own instance
|
||||||
|
- Privacy-focused search results
|
||||||
|
|
||||||
### 2. Scrapers
|
### 2. Scrapers
|
||||||
|
|
||||||
@@ -117,6 +125,11 @@ webSearch:
|
|||||||
# Search Provider Configuration
|
# Search Provider Configuration
|
||||||
serperApiKey: "${CUSTOM_SERPER_API_KEY}" # ✅ Correct: Using environment variable name
|
serperApiKey: "${CUSTOM_SERPER_API_KEY}" # ✅ Correct: Using environment variable name
|
||||||
# serperApiKey: "sk-123..." # ❌ Wrong: Never put actual API keys here
|
# 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
|
# Scraper Configuration
|
||||||
firecrawlApiKey: "${CUSTOM_FIRECRAWL_API_KEY}"
|
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:
|
webSearch:
|
||||||
# ... variable configurations ...
|
# ... variable configurations ...
|
||||||
searchProvider: "serper" # Only use Serper for search
|
searchProvider: "serper" # Only use Serper for search
|
||||||
|
# searchProvider: "searxng" # Only use SearXNG for search
|
||||||
scraperType: "firecrawl" # Only use Firecrawl for scraping
|
scraperType: "firecrawl" # Only use Firecrawl for scraping
|
||||||
rerankerType: "jina" # Only use Jina for reranking
|
rerankerType: "jina" # Only use Jina for reranking
|
||||||
```
|
```
|
||||||
|
|||||||
BIN
public/images/web-search/search_badge_confirm.png
Normal file
BIN
public/images/web-search/search_badge_confirm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 165 KiB |
BIN
public/images/web-search/searxng_dropdown_highlight.png
Normal file
BIN
public/images/web-search/searxng_dropdown_highlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 214 KiB |
BIN
public/images/web-search/tools_config_highlight.png
Normal file
BIN
public/images/web-search/tools_config_highlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 162 KiB |
BIN
public/images/web-search/tools_highlight.png
Normal file
BIN
public/images/web-search/tools_highlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
BIN
public/images/web-search/web_search_save.png
Normal file
BIN
public/images/web-search/web_search_save.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 209 KiB |
BIN
public/images/web-search/websearch_highlight.png
Normal file
BIN
public/images/web-search/websearch_highlight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 161 KiB |
BIN
public/videos/min_searxng_docker_setup_hq.mp4
Normal file
BIN
public/videos/min_searxng_docker_setup_hq.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user