mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 10:48:32 +07:00
* feat: enhance accessibility and improve component structure across various files * feat: enhance components with TypeScript typings and improve documentation - Added TypeScript interface for Screenshot component props. - Updated button component documentation for clarity. - Removed unnecessary console log in ContainerScroll component. - Added descriptive comments for FloatingDock and utility functions. - Improved CSP headers in next.config.mjs for security. - Cleaned up package.json by removing unused dependencies. - Refactored _app.tsx to use AppProps for type safety. - Updated meta configuration by removing hidden display property. - Added API documentation comments for GitHub stats and subscription endpoints. - Enhanced error handling in subscription API. - Updated Tailwind CSS configuration with detailed comments. - Cleaned up style.css by organizing and refining styles. - Updated tsconfig.json to include TypeScript files for API routes. - Added comments to Subscriber model and dbConnect utility for clarity. * feat: add aria-labels to HeroLinks for improved accessibility * feat: replace Twitter icon with X and add new X icon component * chore: update code structure for better readability and maintenance * chore: update .gitignore to include additional AI assistant files and Claude Flow generated files * feat: replace sidebar emojis with Lucide icons, fix duplicate titles, and clean up codebase - Add icon resolver (lib/icons.tsx) with 73 Lucide React icons mapped to string IDs - Wire icon resolver into Fumadocs loader for automatic sidebar icon rendering - Update all 19 meta.json files to use icon field instead of emoji prefixes - Add icon frontmatter to all 162 MDX documentation pages - Deduplicate adjacent sidebar icons (e.g. Search/ListFilter, Brain/Bookmark) - Remove duplicate H1 headings from 154 MDX files (DocsTitle renders frontmatter) - Add frontmatter to 33 files that were missing it - Shorten overly long titles (agents, mcp, url_query) - Rewrite /docs/local cards from old Nextra syntax to Fumadocs Card components - Remove all emojis from Get Started and Features index pages - Collapse sidebar folders by default (defaultOpenLevel: 0) - Delete temporary debugging scripts, test specs, and screenshot artifacts - Fix eslint errors in mdx-components, nextra-shims, tailwind config, and error page - Update .gitignore to exclude test/debug artifacts * feat: enhance accessibility and improve UI components - Added aria-hidden attributes to social media icons in FooterMenu for better accessibility. - Updated FooterMenu to use <footer> element for semantic HTML. - Improved Carousel component by adding aria-labels to navigation buttons for better screen reader support. - Modified OptionTable to use a unique key for each row to prevent rendering issues. - Enhanced CredentialsGeneratorBox with aria-labels for input fields and buttons to improve accessibility. - Updated documentation to remove unnecessary links and improve clarity in various sections. - Fixed iframe attributes in documentation for better compatibility and accessibility. - Adjusted CSS variable for muted foreground color to improve contrast. - Updated package.json and pnpm-lock.yaml for dependency management and optimization. * feat: update FileComponent and FolderComponent to include new props for enhanced functionality * Add new AI provider icons and update documentation - Introduced new SVG icons for AI providers: TogetherAI, TrueFoundry, VLLM, Vultr, and XAI. - Updated existing AI endpoint documentation to reflect new icon names and improve clarity. - Replaced generic \Plug\ icons with specific provider icons for Anyscale, APIpie, Cloudflare, Cohere, Databricks, DeepSeek, Fireworks, Groq, Helicone, HuggingFace, LiteLLM, Mistral, MLX, Moonshot, NeuroChain, Ollama, OpenRouter, Perplexity, Portkey, ShuttleAI, and TrueFoundry. - Enhanced the icon resolution logic to include new icons in the icon registry. * feat: add DocsHub and QuickStartHub components for enhanced documentation navigation * feat: implement FeaturesHub component for enhanced feature navigation and update ViewOptions for improved links * feat: add fresh-build script for streamlined project setup and development * fix: update ESLint configuration and improve type handling in components - Added 'next.config.mjs' to ESLint ignore list. - Refactored version assignment in ChangelogPage for better type safety. - Removed unnecessary type casting in Author components for cleaner code. - Simplified BlogHeader component by removing redundant type assertions. - Added eslint-disable comments for unused variables in CardCompat and Nextra shims. * fix: update ViewOptions link for LibreChat to remove unnecessary submit parameter * feat: enhance HomePage layout and improve GitHub star display - Integrated HomeLayout component for better page structure. - Updated HeroSection to improve the presentation of GitHub stars with a new layout and styling. - Adjusted link attributes for better accessibility and user experience. * refactor: simplify title for Model Context Protocol (MCP) documentation - Changed the title from "Model Context Protocol (MCP)" to "MCP" for brevity. - Updated the description to clarify how LibreChat utilizes MCP for integration with external tools and services. * feat: enhance navigation styling and update HomeLayout props - Added a new background style for the navigation bar with a blur effect. - Updated HomeLayout component to include a transparent navigation mode for improved visual integration. * refactor: deprecate plugins in favor of agents and update related documentation - Removed references to plugins across various files, including the FeaturesHub and documentation. - Updated navigation redirects to point to agents instead of plugins. - Deleted the plugins documentation file to streamline content and reduce confusion. * feat: update demo images for improved visual representation --------- Co-authored-by: Danny Avila <danny@librechat.ai>
207 lines
8.2 KiB
Plaintext
207 lines
8.2 KiB
Plaintext
---
|
|
title: "Web Search"
|
|
icon: Search
|
|
---
|
|
|
|
LibreChat's web search feature allows you to search the internet and retrieve relevant information to enhance your conversations. The feature consists of three main components that work together to provide comprehensive search results.
|
|
|
|
## Quick Start
|
|
|
|
To get started with web search, you'll need to configure API keys for all three components to ensure effective search results. You can do this in two ways:
|
|
|
|
1. **Environment Variables** (Recommended for admins):
|
|
```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
|
|
# Optional: Custom Firecrawl API URL
|
|
FIRECRAWL_API_URL=your_firecrawl_api_url
|
|
# Optional: Firecrawl API version (v0 or v1)
|
|
# FIRECRAWL_VERSION=v1
|
|
|
|
# Reranker (Required)
|
|
JINA_API_KEY=your_jina_api_key
|
|
# Optional: Custom Jina API URL
|
|
JINA_API_URL=your_jina_api_url
|
|
# or
|
|
COHERE_API_KEY=your_cohere_api_key
|
|
```
|
|
|
|
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 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 Providers
|
|
|
|
#### Serper
|
|
1. Visit [Serper.dev](https://serper.dev)
|
|
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)
|
|
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
|
|
6. (Optional) If you're using a custom Firecrawl instance, you'll also need to set the API URL
|
|
|
|
### Rerankers
|
|
|
|
#### Jina
|
|
1. Visit [Jina.ai](https://jina.ai/api-dashboard/)
|
|
2. Sign up for an account
|
|
3. Navigate to the API Dashboard
|
|
4. Copy your API key
|
|
5. Set it in your environment variables or provide it through the UI
|
|
|
|
#### Cohere
|
|
1. Visit [Cohere Dashboard](https://dashboard.cohere.com/welcome/login)
|
|
2. Sign up for an account
|
|
3. Navigate to the API Keys section
|
|
4. Copy your API key
|
|
5. Set it in your environment variables or provide it through the UI
|
|
|
|
## Components
|
|
|
|
### 1. Search Providers
|
|
|
|
Search providers are responsible for performing the initial web search and returning relevant results.
|
|
|
|
**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)
|
|
- **SearXNG**: Open-source, self-hosted meta search engine
|
|
- Self-host your own instance
|
|
- Privacy-focused search results
|
|
|
|
### 2. Scrapers
|
|
|
|
Scrapers extract the actual content from web pages returned by the search provider.
|
|
|
|
**Available Scrapers:**
|
|
- **Firecrawl**: A powerful web scraping service that extracts content from web pages
|
|
- Get your API key from [Firecrawl.dev](https://docs.firecrawl.dev/introduction#api-key)
|
|
- API URL is optional (defaults to Firecrawl's hosted service)
|
|
|
|
**Planned Scrapers:**
|
|
- **Local Firecrawl**: Self-hosted version of Firecrawl
|
|
- Additional third-party scraping services
|
|
|
|
### 3. Rerankers
|
|
|
|
Rerankers analyze the scraped content to determine the most relevant parts and reorder them for better results.
|
|
|
|
**Available Rerankers:**
|
|
- **Jina**: AI-powered reranking service
|
|
- Get your API key from [Jina.ai](https://jina.ai/api-dashboard/)
|
|
- API URL is optional (defaults to Jina's hosted service)
|
|
- **Cohere**: Advanced reranking service
|
|
- Get your API key from [Cohere Dashboard](https://dashboard.cohere.com/welcome/login)
|
|
|
|
**Planned Rerankers:**
|
|
- **RAG API**: Open-source reranking using RAG (Retrieval-Augmented Generation)
|
|
- Additional third-party reranking services
|
|
|
|
## Configuration
|
|
|
|
### Admin Configuration
|
|
|
|
Admins can configure the web search feature using environment variables. The YAML configuration allows you to specify custom environment variable names for each component.
|
|
|
|
⚠️ **Important: Never put actual API keys or values in the YAML file (they won't work)- only use environment variable names.**
|
|
|
|
```yaml
|
|
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}"
|
|
firecrawlApiUrl: "${CUSTOM_FIRECRAWL_API_URL}"
|
|
# firecrawlApiKey: "fc-123..." # ❌ Wrong: Never put actual API keys here
|
|
# firecrawlApiUrl: "https://..." # ❌ Wrong: Never put actual URLs here
|
|
|
|
# Reranker Configuration
|
|
jinaApiKey: "${CUSTOM_JINA_API_KEY}"
|
|
jinaApiUrl: "${CUSTOM_JINA_API_URL}"
|
|
cohereApiKey: "${CUSTOM_COHERE_API_KEY}"
|
|
# jinaApiKey: "jn-123..." # ❌ Wrong: Never put actual API keys here
|
|
# jinaApiUrl: "https://..." # ❌ Wrong: Never put actual URLs here
|
|
# cohereApiKey: "ch-123..." # ❌ Wrong: Never put actual API keys here
|
|
|
|
# General Settings
|
|
safeSearch: 1 # Options: 0 (OFF), 1 (MODERATE - default), 2 (STRICT)
|
|
```
|
|
|
|
**Note:** The YAML configuration should only contain environment variable names (in the format `${VARIABLE_NAME}`). This flexibility enables:
|
|
- Using different variable names in different environments
|
|
- Supporting multiple configurations for different user groups
|
|
- Future integration with role-based configurations
|
|
|
|
If you want to restrict the system to use only specific services, you can specify the service types:
|
|
|
|
```yaml
|
|
webSearch:
|
|
# ... variable configurations ...
|
|
searchProvider: "serper" # Only use Serper for search
|
|
# searchProvider: "searxng" # Only use SearXNG for search
|
|
scraperProvider: "firecrawl" # Only use Firecrawl for scraping
|
|
rerankerType: "jina" # Only use Jina for reranking
|
|
```
|
|
|
|
### User Configuration
|
|
|
|
If the admin hasn't configured all the necessary API keys, users will be prompted to provide them through the UI. The interface allows users to:
|
|
|
|
1. Choose their preferred reranker (Jina or Cohere)
|
|
2. Enter API keys for the required services
|
|
3. Configure the Firecrawl API URL if needed (optional)
|
|
4. Configure the Jina API URL if needed (optional)
|
|
|
|
## Usage
|
|
|
|
Once configured, you can use web search in two ways:
|
|
|
|
1. **Chat Interface**: Click the web search button in the chat interface to enable web search for your conversation
|
|
2. **Agents**: Use the `web_search` capability in agents to allow them to search the web
|
|
|
|
## Notes
|
|
|
|
- All three components (search provider, scraper, and reranker) are required for effective search results
|
|
- The Firecrawl API URL is optional and defaults to their hosted service
|
|
- The Jina API URL is optional and defaults to their hosted service
|
|
- Safe search provides three levels of content filtering: OFF (0), MODERATE (1 - default), and STRICT (2)
|
|
- The scraper timeout is set to 7.5 seconds (7500ms) by default
|
|
- API keys can be revoked at any time through the UI
|
|
- Future updates will include more open-source, self-hosted options for all components
|
|
- Additional customization options are planned, including:
|
|
- Control over the number of links to scrape
|
|
- Domain allowlist/blocklist for scraping
|
|
- Custom scraping rules and filters
|
|
- Advanced result filtering and ranking options
|
|
- Rate limiting and request throttling controls
|