mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 08:25:23 +02:00
feat: add COHERE_BASE_URL configuration support for custom Cohere rerank endpoints
- Add cohereBaseUrl to webSearchSchema configuration - Update loadWebSearchConfig to load cohereBaseUrl from environment - Add cohereBaseUrl to TWebSearchKeys type definition - Configure cohereBaseUrl as optional parameter for cohere reranker - Add COHERE_BASE_URL documentation to .env.example This enables configuration of custom Cohere endpoints (such as LiteLLM proxy) for web search reranking. The configuration infrastructure is ready for when the @librechat/agents package supports custom base URLs. Usage: COHERE_BASE_URL=http://litellm:8000/v1 COHERE_API_KEY=your_api_key
This commit is contained in:
parent
2a50c372ef
commit
00a99aca0a
4 changed files with 11 additions and 2 deletions
|
|
@ -814,6 +814,7 @@ OPENWEATHER_API_KEY=
|
||||||
# JINA_API_KEY=your_jina_api_key
|
# JINA_API_KEY=your_jina_api_key
|
||||||
# or
|
# or
|
||||||
# COHERE_API_KEY=your_cohere_api_key
|
# COHERE_API_KEY=your_cohere_api_key
|
||||||
|
# COHERE_BASE_URL=your_custom_cohere_base_url
|
||||||
|
|
||||||
#======================#
|
#======================#
|
||||||
# MCP Configuration #
|
# MCP Configuration #
|
||||||
|
|
|
||||||
|
|
@ -836,6 +836,7 @@ export const webSearchSchema = z.object({
|
||||||
jinaApiKey: z.string().optional().default('${JINA_API_KEY}'),
|
jinaApiKey: z.string().optional().default('${JINA_API_KEY}'),
|
||||||
jinaApiUrl: z.string().optional().default('${JINA_API_URL}'),
|
jinaApiUrl: z.string().optional().default('${JINA_API_URL}'),
|
||||||
cohereApiKey: z.string().optional().default('${COHERE_API_KEY}'),
|
cohereApiKey: z.string().optional().default('${COHERE_API_KEY}'),
|
||||||
|
cohereBaseUrl: z.string().optional().default('${COHERE_BASE_URL}'),
|
||||||
searchProvider: z.nativeEnum(SearchProviders).optional(),
|
searchProvider: z.nativeEnum(SearchProviders).optional(),
|
||||||
scraperProvider: z.nativeEnum(ScraperProviders).optional(),
|
scraperProvider: z.nativeEnum(ScraperProviders).optional(),
|
||||||
rerankerType: z.nativeEnum(RerankerTypes).optional(),
|
rerankerType: z.nativeEnum(RerankerTypes).optional(),
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@ export const webSearchAuth = {
|
||||||
/** Optional (0) */
|
/** Optional (0) */
|
||||||
jinaApiUrl: 0 as const,
|
jinaApiUrl: 0 as const,
|
||||||
},
|
},
|
||||||
cohere: { cohereApiKey: 1 as const },
|
cohere: {
|
||||||
|
cohereApiKey: 1 as const,
|
||||||
|
/** Optional (0) */
|
||||||
|
cohereBaseUrl: 0 as const,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -72,6 +76,7 @@ export function loadWebSearchConfig(
|
||||||
const jinaApiKey = config?.jinaApiKey ?? '${JINA_API_KEY}';
|
const jinaApiKey = config?.jinaApiKey ?? '${JINA_API_KEY}';
|
||||||
const jinaApiUrl = config?.jinaApiUrl ?? '${JINA_API_URL}';
|
const jinaApiUrl = config?.jinaApiUrl ?? '${JINA_API_URL}';
|
||||||
const cohereApiKey = config?.cohereApiKey ?? '${COHERE_API_KEY}';
|
const cohereApiKey = config?.cohereApiKey ?? '${COHERE_API_KEY}';
|
||||||
|
const cohereBaseUrl = config?.cohereBaseUrl ?? '${COHERE_BASE_URL}';
|
||||||
const safeSearch = config?.safeSearch ?? SafeSearchTypes.MODERATE;
|
const safeSearch = config?.safeSearch ?? SafeSearchTypes.MODERATE;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -80,6 +85,7 @@ export function loadWebSearchConfig(
|
||||||
jinaApiKey,
|
jinaApiKey,
|
||||||
jinaApiUrl,
|
jinaApiUrl,
|
||||||
cohereApiKey,
|
cohereApiKey,
|
||||||
|
cohereBaseUrl,
|
||||||
serperApiKey,
|
serperApiKey,
|
||||||
searxngApiKey,
|
searxngApiKey,
|
||||||
firecrawlApiKey,
|
firecrawlApiKey,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ export type TWebSearchKeys =
|
||||||
| 'firecrawlVersion'
|
| 'firecrawlVersion'
|
||||||
| 'jinaApiKey'
|
| 'jinaApiKey'
|
||||||
| 'jinaApiUrl'
|
| 'jinaApiUrl'
|
||||||
| 'cohereApiKey';
|
| 'cohereApiKey'
|
||||||
|
| 'cohereBaseUrl';
|
||||||
|
|
||||||
export type TWebSearchCategories =
|
export type TWebSearchCategories =
|
||||||
| SearchCategories.PROVIDERS
|
| SearchCategories.PROVIDERS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue