From a79985b8a96e313fc490d463a7f5ee0c32b0b6c6 Mon Sep 17 00:00:00 2001 From: Pascal Garber Date: Sat, 7 Mar 2026 08:50:23 +0100 Subject: [PATCH] feat: add custom reranker provider support in web search config Add 'custom' to RerankerTypes enum and support for customRerankerApiUrl, customRerankerApiKey, and customRerankerModel configuration fields. This enables using any Jina-compatible /v1/rerank endpoint (e.g. Scaleway, vLLM, LiteLLM) as a reranker provider. Depends on: https://github.com/danny-avila/agents/issues/65 Co-Authored-By: Claude Opus 4.6 --- packages/data-provider/src/config.ts | 4 ++++ packages/data-schemas/src/app/web.ts | 12 ++++++++++++ packages/data-schemas/src/types/web.ts | 5 ++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts index 6a77508f59..0e779ed603 100644 --- a/packages/data-provider/src/config.ts +++ b/packages/data-provider/src/config.ts @@ -842,6 +842,7 @@ export enum ScraperProviders { export enum RerankerTypes { JINA = 'jina', COHERE = 'cohere', + CUSTOM = 'custom', } export enum SafeSearchTypes { @@ -860,6 +861,9 @@ export const webSearchSchema = z.object({ jinaApiKey: z.string().optional().default('${JINA_API_KEY}'), jinaApiUrl: z.string().optional().default('${JINA_API_URL}'), cohereApiKey: z.string().optional().default('${COHERE_API_KEY}'), + customRerankerApiUrl: z.string().optional().default('${CUSTOM_RERANKER_API_URL}'), + customRerankerApiKey: z.string().optional().default('${CUSTOM_RERANKER_API_KEY}'), + customRerankerModel: z.string().optional().default('${CUSTOM_RERANKER_MODEL}'), searchProvider: z.nativeEnum(SearchProviders).optional(), scraperProvider: z.nativeEnum(ScraperProviders).optional(), rerankerType: z.nativeEnum(RerankerTypes).optional(), diff --git a/packages/data-schemas/src/app/web.ts b/packages/data-schemas/src/app/web.ts index a61e1f1611..5e46d84322 100644 --- a/packages/data-schemas/src/app/web.ts +++ b/packages/data-schemas/src/app/web.ts @@ -31,6 +31,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, + }, }, }; @@ -72,6 +78,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; return { @@ -80,6 +89,9 @@ export function loadWebSearchConfig( jinaApiKey, jinaApiUrl, cohereApiKey, + customRerankerApiUrl, + customRerankerApiKey, + customRerankerModel, serperApiKey, searxngApiKey, firecrawlApiKey, diff --git a/packages/data-schemas/src/types/web.ts b/packages/data-schemas/src/types/web.ts index a9cc1f0cc6..dcd0dcd320 100644 --- a/packages/data-schemas/src/types/web.ts +++ b/packages/data-schemas/src/types/web.ts @@ -9,7 +9,10 @@ export type TWebSearchKeys = | 'firecrawlVersion' | 'jinaApiKey' | 'jinaApiUrl' - | 'cohereApiKey'; + | 'cohereApiKey' + | 'customRerankerApiUrl' + | 'customRerankerApiKey' + | 'customRerankerModel'; export type TWebSearchCategories = | SearchCategories.PROVIDERS