Valyu allows AI applications and agents to search the internet and proprietary data sources for relevant LLM ready information.This notebook goes over how to use Valyu deep search tool in LangChain. First, get an Valyu API key and add it as an environment variable. Get $10 free credit by signing up here.
Setup
The integration lives in thelangchain-valyu package.
VALYU_API_KEY environment variable to your Valyu API key.
Instantiation
Now we can instantiate our retriever: TheValyuContextRetriever can be configured with several parameters:
-
k: int = 5The number of top results to return for each query. -
search_type: str = "all"The type of search to perform: ‘all’, ‘proprietary’, or ‘web’. Defaults to ‘all’. -
relevance_threshold: float = 0.5The minimum relevance score (between 0 and 1) required for a document to be considered relevant. Defaults to 0.5. -
max_price: float = 20.0The maximum price (in USD) you are willing to spend per query. Defaults to 20.0. -
start_date: Optional[str] = NoneStart date for time filtering in YYYY-MM-DD format (optional). -
end_date: Optional[str] = NoneEnd date for time filtering in YYYY-MM-DD format (optional). -
client: Optional[Valyu] = NoneAn optional custom Valyu client instance. If not provided, a new client will be created internally. -
valyu_api_key: Optional[str] = NoneYour Valyu API key. If not provided, the retriever will look for theVALYU_API_KEYenvironment variable.
Usage
Use within a chain
We can easily combine this retriever in to a chain.API reference
For detailed documentation of all Valyu Context API features and configurations head to the API reference: docs.valyu.network/overviewConnect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.