Overview
Valyu integrates seamlessly with LlamaIndex as a comprehensive tool spec, allowing you to enhance your AI agents and RAG applications with real-time web search and proprietary data sources. The integration provides LLM-ready context from multiple sources including web pages, academic journals, financial data, and more. The package includes two main functions:search()
: Deep search operations with comprehensive parameter controlget_contents()
: Extract clean content from specific URLs
Installation
Install the official LlamaIndex Valyu package:Free Credits
Get your API key with $10 credit from the Valyu Platform.
Basic Usage
Using ValyuToolSpec for Deep Search
Using ValyuToolSpec for Content Extraction
Using with LlamaIndex OpenAI Agents
The most powerful way to use Valyu is within LlamaIndex agents, where the AI can dynamically decide when and how to search:Advanced Configuration
Comprehensive Parameter Configuration
The ValyuToolSpec supports extensive configuration during initialization:Source Filtering Examples
Multi-Agent Workflows
Use Valyu in specialized agent configurations:Example Applications
Financial Research Assistant
Academic Research Agent
Best Practices
1. Search Type Selection
2. Error Handling and Fallbacks
3. Agent System Messages
Integration with Other LlamaIndex Components
Custom Query Engines
Integration with Retrievers
API Reference
For complete parameter documentation, see the Valyu API Reference.ValyuToolSpec Initialization Parameters
api_key
(required): Valyu API keyverbose
: Enable verbose logging (default: False)max_price
: Maximum cost in dollars for search operations (default: 100)relevance_threshold
: Minimum relevance score 0.0-1.0 (default: 0.5)fast_mode
: Enable fast mode for faster results (default: False)included_sources
: List of URLs/domains to include (optional)excluded_sources
: List of URLs/domains to exclude (optional)response_length
: Content length - int, “short”, “medium”, “large”, “max” (optional)country_code
: 2-letter ISO country code for geo-bias (optional)contents_summary
: AI summary config - bool, str, or dict (optional)contents_extract_effort
: “normal”, “high”, or “auto” (default: “normal”)contents_response_length
: Content length per URL (default: “short”)
search() Method Parameters
query
(required): Natural language search querysearch_type
:"all"
,"web"
, or"proprietary"
(default: “all”)max_num_results
: 1-20 results (default: 5)start_date
/end_date
: Time filtering in YYYY-MM-DD format (optional)fast_mode
: Override tool default fast mode setting (optional)
get_contents() Method Parameters
urls
(required): List of URLs to extract content from (max 10 per request)