Everything you need to use Valyu in python
Parameter | Type | Description | Default |
---|---|---|---|
query | str | The input query to be processed. | Required |
search_type | Literal[‘all’, ‘proprietary’, ‘web’] | Specifies the type of search to be performed. ‘all’ includes both proprietary and web sources, ‘proprietary’ searches over Valyu indices, and ‘web’ is just web search. | ”all” |
max_num_results | int | The maximum number of results to be returned (1-20). | 5 |
relevance_threshold | float | The minimum relevance score required for a result to be included (0.0-1.0). | 0.5 |
max_price | float | Maximum cost in dollars for 1000 retrievals. | 30.0 |
is_tool_call | bool | Set to True when called by AI agents/tools (optimized for LLM consumption). Set to False for direct user queries. | True |
category | str | Natural language category to guide search context (optional). | None |
included_sources | List[str] | List of specific sources to search within (URLs, domains, or dataset names). When a URL or domain path is provided (e.g., ‘https://valyu.network/blog’ or ‘valyu.network/blog’), only that specific path will be searched. For entire domains, use either the domain name (e.g., ‘valyu.network’) or the base URL (e.g., ‘https://valyu.network’) (optional). | None |
excluded_sources | List[str] | List of specific sources to exclude from search (URLs, domains, or dataset names). When a URL or domain path is provided (e.g., ‘https://valyu.network/blog’ or ‘valyu.network/blog’), only that specific path will be excluded. For entire domains, use either the domain name (e.g., ‘valyu.network’) or the base URL (e.g., ‘https://valyu.network’) (optional). | None |
response_length | Union[int, str] | Controls content length per result. Integer for character count or predefined values: “short” (25k), “medium” (50k), “large” (100k), “max” (full) (optional). | “short” |
country_code | str | 2-letter ISO country code to bias search results to a specific country (optional). | None |
start_date | str | Start date for time filtering in YYYY-MM-DD format (optional). | None |
end_date | str | End date for time filtering in YYYY-MM-DD format (optional). | None |
Parameter | Type | Description |
---|---|---|
success | boolean | Indicates if the request was successful |
error | string | Error message if any |
tx_id | string | Unique transaction ID for the request |
query | string | The processed query string |
results | array | Array of result objects (see Results Object table below) |
results_by_source | object | Count of results by source type (web/proprietary) |
total_results | integer | Total number of results returned |
total_characters | integer | Total number of characters in results |
Parameter | Type | Description |
---|---|---|
id | string | Unique identifier for the result (optional) |
title | string | Title of the result |
url | string | URL of the source |
content | string | The actual text chunk of the result |
source | string | Source identifier (e.g., “valyu/valyu-arxiv”, “valyu/valyu-stocks-US”) |
price | float | Cost of this specific text chunk in USD |
length | integer | Character length of the content |
image_url | object | Map of image identifiers to image URLs, can be used to render in frontend AI applications |
data_type | string | Type of data, either “unstructured” or “structured”. If structured (e.g. for stock data) it will be a string JSON object |
source_type | string | Type of source (e.g., “paper”, “data”, “web”, “book”) |
relevance_score | float | Relevance score between 0 and 1 |
publication_date | string | Publication date in YYYY-MM-DD format (for source_type “paper” and “book”) |
doi | string | Digital Object Identifier (for source_type “paper” and “book”) |
citation | string | Formatted citation string (for source_type “paper”) |
citation_count | integer | Number of citations (for source_type “paper”) |
authors | array | List of author names (for source_type “paper” and “book”) |
references | string | References section content (for source_type “paper” and “book”) |