Repository navigation
Feat: add tavily for search and scraper - #85
Closed
yashwanth-alapati wants to merge 6 commits into
Closed
yashwanth-alapati wants to merge 6 commits into
yashwanth-alapati wants to merge 6 commits into
Conversation
- Replace per-provider union types with `AnyScraperResponse` named type - Add optional `scrapeUrls` batch method to `BaseScraper` interface - Rename `raw_content` to `rawContent` in `TavilyScrapeResponse` (camelCase convention) - Add `TavilySearchResult` and `TavilyExtractResult` named types - Split `TAVILY_API_URL` into separate `tavilySearchUrl` and `tavilyExtractUrl` fields - Add configurable `searchDepth` to `SearchConfig` - Flatten `TavilyConfig` into `SearchToolConfig` via `SearchConfig` extension
Major fixes: - Wrap `new URL().hostname` in try/catch to prevent single bad URL from discarding entire result set (Finding LibreChat-AI#1) - Remove Tavily from country schema — Tavily API does not support country filtering (Finding LibreChat-AI#2) - Split shared `TAVILY_API_URL` into `TAVILY_SEARCH_URL` and `TAVILY_EXTRACT_URL` to avoid env var collision (Finding LibreChat-AI#3) - Reduce default timeout from 60s to 15s, matching other providers (Finding LibreChat-AI#4) - Implement batch URL extraction via `scrapeUrls` — Tavily Extract supports up to 20 URLs per request (Finding LibreChat-AI#5) - Remove dead `topStories` computation; let `news` flow through the existing `executeParallelSearches` merge pipeline (Finding LibreChat-AI#6) - Use `scraper.extractMetadata()` abstraction instead of runtime `'metadata' in` check (Finding LibreChat-AI#8) - Read `failed_results` from Tavily Extract API for actionable error messages (Finding LibreChat-AI#12) - Add JSDoc for `'h'` → `'day'` time range approximation (Finding LibreChat-AI#13) - Make `search_depth` configurable via `searchDepth` config (Finding LibreChat-AI#14) - Hoist `TAVILY_TIME_RANGE_MAP` to module scope (Finding LibreChat-AI#15) - Use batch-aware `scrapeMany` that delegates to `scrapeUrls` when available on the scraper instance
Covers constructor defaults, env var handling, single URL scraping, batch scraping with chunking, mixed success/failure, extractContent, and extractMetadata — 18 tests total.
Collaborator
|
Closing this contributor-fork PR because maintainer pushes to I continued the rebased/fixed work in the replacement maintainer-owned PR: #135. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrate tavily: