SDK
Context
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
Parameter | Type | Required | Description |
---|---|---|---|
query | str | Yes | The question or topic you want information on |
search_type | str | Yes | Type of search: “proprietary”, “web”, or “all” |
data_sources | List[str] | No | Specific indices to search over (e.g., [“valyu/valyu-arxiv”]) |
max_num_results | int | No | Number of results to return after reranking (default: 10) |
similarity_threshold | float | No | Minimum similarity score for results (default: 0.4) |
query_rewrite | bool | No | Whether to rewrite query for better performance (default: True) |
max_price | float | Yes | Maximum allowed price per thousand queries (CPM) |