Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/api/src/admin/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const CONFIG_SECRET_FIELDS: readonly ConfigSecretField[] = (
{ path: 'webSearch.tavilyApiKey', allowEnvPlaceholder: true },
{ path: 'webSearch.jinaApiKey', allowEnvPlaceholder: true },
{ path: 'webSearch.cohereApiKey', allowEnvPlaceholder: true },
{ path: 'webSearch.customRerankerApiKey', allowEnvPlaceholder: true },
{ path: 'endpoints.assistants.apiKey', allowEnvPlaceholder: true },
{ path: 'endpoints.azureAssistants.apiKey', allowEnvPlaceholder: true },
] satisfies ConfigSecretFieldInput[]
Expand Down
5 changes: 5 additions & 0 deletions packages/data-provider/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,7 @@ export enum RerankerTypes {
JINA = 'jina',
COHERE = 'cohere',
NONE = 'none',
CUSTOM = 'custom',
}

export enum SafeSearchTypes {
Expand Down Expand Up @@ -1779,6 +1780,10 @@ export const webSearchSchema = z.object({
jinaApiUrl: z.string().optional().default('${JINA_API_URL}'),
cohereApiKey: z.string().optional().default('${COHERE_API_KEY}'),
cohereApiKeyPreview: apiKeyPreviewSchema,
customRerankerApiUrl: z.string().optional().default('${CUSTOM_RERANKER_API_URL}'),
customRerankerApiKey: z.string().optional().default('${CUSTOM_RERANKER_API_KEY}'),
customRerankerApiKeyPreview: apiKeyPreviewSchema,
customRerankerModel: z.string().optional().default('${CUSTOM_RERANKER_MODEL}'),
searchProvider: z.nativeEnum(SearchProviders).optional(),
scraperProvider: z.nativeEnum(ScraperProviders).optional(),
rerankerType: z.nativeEnum(RerankerTypes).optional(),
Expand Down
3 changes: 3 additions & 0 deletions packages/data-schemas/src/app/web.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ describe('loadWebSearchConfig', () => {
jinaApiKey: '${JINA_API_KEY}',
jinaApiUrl: '${JINA_API_URL}',
cohereApiKey: '${COHERE_API_KEY}',
customRerankerApiUrl: '${CUSTOM_RERANKER_API_URL}',
customRerankerApiKey: '${CUSTOM_RERANKER_API_KEY}',
customRerankerModel: '${CUSTOM_RERANKER_MODEL}',
safeSearch: SafeSearchTypes.MODERATE,
rerankerType: undefined,
tavilyApiKey: '${TAVILY_API_KEY}',
Expand Down
14 changes: 13 additions & 1 deletion packages/data-schemas/src/app/web.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RerankerTypes, SafeSearchTypes } from 'librechat-data-provider';
import { SafeSearchTypes } from 'librechat-data-provider';
import type { TCustomConfig } from 'librechat-data-provider';
import type { TWebSearchKeys, TWebSearchCategories } from '~/types/web';

Expand Down Expand Up @@ -39,6 +39,12 @@ export const webSearchAuth = {
jinaApiUrl: 0 as const,
},
cohere: { cohereApiKey: 1 as const },
custom: {
customRerankerApiUrl: 1 as const,
customRerankerModel: 1 as const,
/** Optional (0) */
customRerankerApiKey: 0 as const,
},
},
};

Expand Down Expand Up @@ -83,6 +89,9 @@ export function loadWebSearchConfig(
const jinaApiKey = config?.jinaApiKey ?? '${JINA_API_KEY}';
const jinaApiUrl = config?.jinaApiUrl ?? '${JINA_API_URL}';
const cohereApiKey = config?.cohereApiKey ?? '${COHERE_API_KEY}';
const customRerankerApiUrl = config?.customRerankerApiUrl ?? '${CUSTOM_RERANKER_API_URL}';
const customRerankerApiKey = config?.customRerankerApiKey ?? '${CUSTOM_RERANKER_API_KEY}';
const customRerankerModel = config?.customRerankerModel ?? '${CUSTOM_RERANKER_MODEL}';
const safeSearch = config?.safeSearch ?? SafeSearchTypes.MODERATE;
const rerankerType = config?.rerankerType;

Expand All @@ -92,6 +101,9 @@ export function loadWebSearchConfig(
jinaApiKey,
jinaApiUrl,
cohereApiKey,
customRerankerApiUrl,
customRerankerApiKey,
customRerankerModel,
serperApiKey,
searxngApiKey,
tavilyApiKey,
Expand Down
5 changes: 4 additions & 1 deletion packages/data-schemas/src/types/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export type TWebSearchKeys =
| 'tavilyExtractUrl'
| 'jinaApiKey'
| 'jinaApiUrl'
| 'cohereApiKey';
| 'cohereApiKey'
| 'customRerankerApiUrl'
| 'customRerankerApiKey'
| 'customRerankerModel';

export type TWebSearchCategories =
| SearchCategories.PROVIDERS
Expand Down