diff --git a/pages/docs/configuration/librechat_yaml/object_structure/config.mdx b/pages/docs/configuration/librechat_yaml/object_structure/config.mdx index 79da7ba..e187600 100644 --- a/pages/docs/configuration/librechat_yaml/object_structure/config.mdx +++ b/pages/docs/configuration/librechat_yaml/object_structure/config.mdx @@ -118,6 +118,8 @@ see: [OCR Config Object Structure](/docs/configuration/librechat_yaml/object_str + ### serperApiKey +### searxngApiKey + + + +**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 \ No newline at end of file +- 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: + + + +**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) + diff --git a/pages/docs/features/web_search.mdx b/pages/docs/features/web_search.mdx index 17a4a80..46a62df 100644 --- a/pages/docs/features/web_search.mdx +++ b/pages/docs/features/web_search.mdx @@ -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 ``` diff --git a/public/images/web-search/search_badge_confirm.png b/public/images/web-search/search_badge_confirm.png new file mode 100644 index 0000000..1eb7c68 Binary files /dev/null and b/public/images/web-search/search_badge_confirm.png differ diff --git a/public/images/web-search/searxng_dropdown_highlight.png b/public/images/web-search/searxng_dropdown_highlight.png new file mode 100644 index 0000000..a31ede8 Binary files /dev/null and b/public/images/web-search/searxng_dropdown_highlight.png differ diff --git a/public/images/web-search/tools_config_highlight.png b/public/images/web-search/tools_config_highlight.png new file mode 100644 index 0000000..58fede0 Binary files /dev/null and b/public/images/web-search/tools_config_highlight.png differ diff --git a/public/images/web-search/tools_highlight.png b/public/images/web-search/tools_highlight.png new file mode 100644 index 0000000..11b71fe Binary files /dev/null and b/public/images/web-search/tools_highlight.png differ diff --git a/public/images/web-search/web_search_save.png b/public/images/web-search/web_search_save.png new file mode 100644 index 0000000..094c8c6 Binary files /dev/null and b/public/images/web-search/web_search_save.png differ diff --git a/public/images/web-search/websearch_highlight.png b/public/images/web-search/websearch_highlight.png new file mode 100644 index 0000000..84cd686 Binary files /dev/null and b/public/images/web-search/websearch_highlight.png differ diff --git a/public/videos/min_searxng_docker_setup_hq.mp4 b/public/videos/min_searxng_docker_setup_hq.mp4 new file mode 100644 index 0000000..9c39b82 Binary files /dev/null and b/public/videos/min_searxng_docker_setup_hq.mp4 differ