Skip to main content

Valyu Plugin

The Valyu plugin provides AI-native search and content extraction across web and proprietary data sources using the Valyu API. It is a dual-capability plugin that serves as both a search provider and a content extractor through a single API key.

Source: packages/plugins/valyu/src/valyu.plugin.ts

Overview

PropertyValue
Plugin IDvalyu
Categorysearch
Capabilitiessearch, content-extractor
Version1.0.0
Configuration Modehybrid
Auto-enableNo
Built-inYes
System PluginNo
Dependenciesvalyu-js

The plugin implements IPlugin, ISearchPlugin, and IContentExtractorPlugin. This dual-capability design means a single Valyu API key provides both search and content extraction, reducing the number of services you need to configure.

Architecture

Dual-Capability Design

Unlike most plugins that serve a single role, the Valyu plugin registers for two capabilities:

  • Search -- discovers relevant URLs and content for work items
  • Content extraction -- pulls full text and markdown from web pages

Both capabilities share the same API client and credentials.

Configuration

Settings Schema

SettingTypeRequiredDefaultScopeDescription
apiKeystringYes--userValyu API key (secret)
responseLengthstringNo"medium"--Content volume per result

Response Length Options

ValueApproximate Characters
short~25,000
medium~50,000
large~100,000
maxUnlimited

Environment Variables

VariableDescription
PLUGIN_VALYU_API_KEYAPI key fallback

Search Method

async search(options: SearchOptions): Promise<SearchResponse>

Searches across all Valyu data sources (web, proprietary, and news) using searchType: 'all'. Results include titles, URLs, content snippets, relevance scores, and publication dates.

Search Options

The plugin maps standard SearchOptions to Valyu-specific parameters:

SearchOptions FieldValyu ParameterDescription
queryFirst argumentThe search query string
limitmaxNumResultsMaximum results (default: 20)
includeDomainsincludedSourcesRestrict to specific domains
excludeDomainsexcludeSourcesExclude specific domains
regioncountryCodeCountry code filter (uppercased)
timeRangestartDate / endDateDate range filter

Time Range Filtering

The plugin converts the standard timeRange values to date ranges:

Time RangeStart Date
day1 day ago
week7 days ago
month1 month ago
year1 year ago
allNo filter

Search Result Fields

Each result includes:

FieldDescription
titlePage title
urlSource URL
snippetContent excerpt
positionResult ranking (1-based)
publishedDatePublication date
metadata.relevanceScoreValyu relevance score
metadata.sourceSource identifier
metadata.descriptionSource description

Content Extraction

Single URL Extraction

async extract(options: ContentExtractionOptions): Promise<ContentExtractionResult>

Extracts content from a single URL using the Valyu contents() API. Returns the extracted text as both plain content and markdown.

Batch Extraction

async extractBatch(
urls: readonly string[],
options?: Partial<ContentExtractionOptions>
): Promise<readonly ContentExtractionResult[]>

Processes URLs in batches of 10 using the Valyu contents() API. This is more efficient than sequential extraction because the API handles multiple URLs in a single request. If the batch call fails, all URLs in that batch return errors.

URL Filtering

The canExtract() method accepts any HTTP or HTTPS URL, making Valyu a general-purpose content extractor.

Usage in Pipelines

During work generation, the search facade uses Valyu to:

  1. Find information about each item via search queries
  2. Discover source URLs for items that need them
  3. Extract content from web pages for enrichment

Valyu is particularly useful when your work covers academic or specialized topics, since it can pull from proprietary data sources like arXiv and PubMed.

Comparison with Other Search Plugins

FeatureValyuTavilyExaSerpAPI
SearchYesYesYesYes
Content extractionYes (dual)Yes (dual)NoNo
Proprietary data sourcesYesNoNoNo
News searchYes (included)NoYes (category)Yes (engine)
AI-optimized resultsYesYesYesNo
Response length controlYes (4 levels)NoNoNo
Domain filteringInclude or excludeInclude onlyInclude or excludeSite prefix
Date filteringDate rangeNoNoNo
Relevance scoringYesYesYesNo
Batch extractionYes (groups of 10)NoNoNo

Valyu stands out with its multi-source search across web, proprietary, and news data, along with configurable response length. Tavily offers a similar dual-capability design but without proprietary data access.

API Reference

Class: ValyuSearchPlugin

class ValyuSearchPlugin implements IPlugin, ISearchPlugin, IContentExtractorPlugin {
readonly id: 'valyu';
readonly category: 'search';

search(options: SearchOptions): Promise<SearchResponse>;
extract(options: ContentExtractionOptions): Promise<ContentExtractionResult>;
extractBatch(
urls: readonly string[],
options?: Partial<ContentExtractionOptions>
): Promise<readonly ContentExtractionResult[]>;
canExtract(url: string): Promise<boolean>;
getSupportedFormats(): readonly ('text' | 'html' | 'markdown')[];
getRateLimitInfo(): Promise<RateLimitInfo>;
}

Getting Started

  1. Create an account at valyu.ai
  2. Copy your API key from the Valyu dashboard
  3. Enable the Valyu plugin on the Plugins page
  4. Enter the API key in the plugin settings
  5. Select Valyu as the search provider and/or content extractor for your work

Troubleshooting

IssueCauseSolution
"API key not configured"Missing credentialsSet the API key in plugin settings or via environment variable
No search resultsQuery too specific or restrictive filtersBroaden the query or remove domain/date filters
Empty content extractionTarget page blocks automated accessTry a different content extractor (e.g., Firecrawl)
Batch extraction partial failuresSome URLs are inaccessibleCheck individual result success fields for per-URL status
Large response sizesresponseLength set too highUse "short" or "medium" for faster responses