The Context API allows you to search and retrieve relevant information from both proprietary datasets and the web. By default, it intelligently chooses the most relevant results for your query from all available sources.

Installation

Environment Setup

To use the SDK, you’ll need to set up your API key in your environment:

Basic Usage

Input Parameters

ParameterTypeRequiredDescription
querystrYesThe question or topic you want information on
search_typestrYesType of search: “proprietary”, “web”, or “all”
data_sourcesList[str]NoSpecific indices to search over (e.g., [“valyu/valyu-arxiv”])
max_num_resultsintNoNumber of results to return after reranking (default: 10)
similarity_thresholdfloatNoMinimum similarity score for results (default: 0.4)
query_rewriteboolNoWhether to rewrite query for better performance (default: True)
max_pricefloatYesMaximum allowed price per thousand queries (CPM)

Response Structure

Examples