Overview
Valyu integrates seamlessly with LangChain as a search tool, 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 bothValyuSearchTool
for direct tool usage and ValyuRetriever
for document retrieval workflows.
Installation
Install the official LangChain Valyu package:.env
file in your project root:
Free Credits
Get your API key with $10 credit from the Valyu Platform.
Basic Usage
Using ValyuSearchTool Directly
Using with LangChain Agents
The most powerful way to use Valyu is within LangChain agents, where the AI can dynamically decide when and how to search:Advanced Configuration
Search Parameters
The ValyuSearchTool supports all v2 API parameters for fine-tuned control:Multi-Agent Workflows
Use Valyu in complex multi-agent systems:Example Applications
Financial Research Assistant
Academic Research Agent
Best Practices
1. Cost Optimization
2. Search Type Selection
3. Error Handling and Fallbacks
4. Agent System Messages
Integration with Other LangChain Components
Built-in Retriever
The package includes a ready-to-use retriever class:Custom Retrievers
API Reference
For complete parameter documentation, see the Valyu API Reference.Key Parameters
query
(required): Natural language search querysearch_type
:"all"
,"web"
, or"proprietary"
max_num_results
: 1-30 results (default: 10)relevance_threshold
: 0.0-1.0 (default: 0.5)max_price
: Maximum cost in dollars (default: 50.0)is_tool_call
: Optimize for agent usage (default: true)start_date
/end_date
: Time filtering (YYYY-MM-DD)