Skip to main content
Add web and specialist retrieval to LlamaIndex through ValyuToolSpec. Use Search to find evidence and Contents to read known URLs, then pass the returned documents to your existing retrieval or agent pipeline. The package includes two main functions:
  • search(): Search operations with comprehensive parameter control
  • get_contents(): Extract clean content from specific URLs

Installation

Install the official LlamaIndex Valyu package:
Configure your credentials by setting the following environment variable:

Basic usage

Using ValyuToolSpec for Content Extraction

Using with LlamaIndex OpenAI Agents

The following example uses the llama-index-agent-openai integration. Install it with pip install llama-index-agent-openai and set OPENAI_API_KEY before running:

Advanced configuration

Set search defaults at initialization, override per call:
get_contents(urls=[...]) extracts clean content from URLs (max 10 per request).
Pass a system_prompt to your agent: use search_type="all" for broad coverage (web + proprietary), or "web" for current events only; raise relevance_threshold (0.6+) for precision; cite sources; use natural-language queries, not operators. See the Prompting Guide.
Wrap ValyuToolSpec.search() in a CustomQueryEngine or BaseRetriever to plug Valyu into existing LlamaIndex pipelines - call search() in custom_query/_retrieve and map each result doc (with doc.metadata['relevance_score']) into your response or NodeWithScore objects.

Additional resources

LlamaIndex Valyu Tool

Official LlamaIndex tool documentation

API Reference

Complete Valyu API documentation

LlamaHub

Valyu tool on LlamaHub

Get API Key

Sign up for $10 free credits ($20 with a company email)