From 8780a3391b1a37d08c258f733a4559dc9c15b837 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 17:10:05 +0000 Subject: [PATCH] feat: make search provider configurable via SEARCH_API Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com> --- .env.local.example | 3 +++ lib/agents/tools/search.tsx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.local.example b/.env.local.example index 1934b0c0..9691a67c 100644 --- a/.env.local.example +++ b/.env.local.example @@ -25,3 +25,6 @@ NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL_HERE NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY_HERE SUPABASE_SERVICE_ROLE_KEY=YOUR_SUPABASE_SERVICE_ROLE_KEY_HERE DATABASE_URL=postgresql://postgres:[YOUR-POSTGRES-PASSWORD]@[YOUR-SUPABASE-DB-HOST]:[PORT]/postgres + +# Search Provider Configuration +SEARCH_API=tavily # Options: tavily, exa diff --git a/lib/agents/tools/search.tsx b/lib/agents/tools/search.tsx index 7510a795..4943289b 100644 --- a/lib/agents/tools/search.tsx +++ b/lib/agents/tools/search.tsx @@ -39,7 +39,7 @@ export const searchTool = ({ uiStream, fullResponse }: ToolProps) => ({ const filledQuery = query.length < 5 ? query + ' '.repeat(5 - query.length) : query let searchResult - const searchAPI: 'tavily' | 'exa' = 'tavily' + const searchAPI = process.env.SEARCH_API === 'exa' ? 'exa' : 'tavily' try { searchResult = searchAPI === 'tavily' @@ -54,7 +54,7 @@ export const searchTool = ({ uiStream, fullResponse }: ToolProps) => ({ include_image_descriptions, include_raw_content ) - : await exaSearch(query) + : await exaSearch(query, max_results) } catch (error) { console.error('Search API error:', error) hasError = true