TavilySearchInput#
- class langchain_tavily.tavily_search.TavilySearchInput[source]#
Bases:
BaseModel
Input for [TavilySearch]
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param exclude_domains: List[str] | None = []#
A list of domains to exclude from search results.
Use this parameter when: 1. The user explicitly requests to avoid certain websites (e.g., “Find information about climate change but not from twitter.com”) 2. The user mentions not wanting results from specific organizations without naming the domain (e.g., “Find phone reviews but nothing from Apple”)
In both cases, you should determine the appropriate domains to exclude (e.g., [“twitter.com”] or [“apple.com”]) and set this parameter.
Results will filter out all content from the specified domains. Default is None (no domain exclusion).
- param include_domains: List[str] | None = []#
A list of domains to restrict search results to.
Use this parameter when: 1. The user explicitly requests information from specific websites (e.g., “Find climate data from nasa.gov”) 2. The user mentions an organization or company without specifying the domain (e.g., “Find information about iPhones from Apple”)
In both cases, you should determine the appropriate domains (e.g., [“nasa.gov”] or [“apple.com”]) and set this parameter.
Results will ONLY come from the specified domains - no other sources will be included. Default is None (no domain restriction).
- param include_images: bool | None = False#
Determines if the search returns relevant images along with text results.
Set to True when the user explicitly requests visuals or when images would significantly enhance understanding (e.g., “Show me what black holes look like,” “Find pictures of Renaissance art”).
Leave as False (default) for most informational queries where text is sufficient.
- param query: str [Required]#
Search query to look up
- param search_depth: Literal['basic', 'advanced'] | None = 'basic'#
Controls search thoroughness and result comprehensiveness.
Use “basic” for simple queries requiring quick, straightforward answers.
Use “advanced” (default) for complex queries, specialized topics, rare information, or when in-depth analysis is needed.
- param time_range: Literal['day', 'week', 'month', 'year'] | None = None#
Limits results to content published within a specific timeframe.
ONLY set this when the user explicitly mentions a time period (e.g., “latest AI news,” “articles from last week”).
For less popular or niche topics, use broader time ranges (“month” or “year”) to ensure sufficient relevant results.
Options: “day” (24h), “week” (7d), “month” (30d), “year” (365d).
Default is None.
- param topic: Literal['general', 'news', 'finance'] | None = 'general'#
Specifies search category for optimized results.
Use “general” (default) for most queries, INCLUDING those with terms like “latest,” “newest,” or “recent” when referring to general information.
Use “finance” for markets, investments, economic data, or financial news.
Use “news” ONLY for politics, sports, or major current events covered by mainstream media - NOT simply because a query asks for “new” information.