# TavilySearch

> **Class** in `langchain_tavily`

📖 [View in docs](https://reference.langchain.com/python/langchain-tavily/tavily_search/TavilySearch)

Tool that queries the Tavily Search API and gets back json.

## Signature

```python
TavilySearch(
    self,
    **kwargs: Any = {},
)
```

## Description

**Setup:**

Install `langchain-tavily` and set environment variable `TAVILY_API_KEY`.

```bash
pip install -U langchain-tavily
export TAVILY_API_KEY="your-api-key"
```

Instantiate:

    ```python
    from langchain_tavily import TavilySearch

    tool = TavilySearch(
        max_results=1,
        topic="general",
        # include_answer=False,
        # include_raw_content=False,
        # include_images=False,
        # include_image_descriptions=False,
        # search_depth="basic",
        # time_range="day",
        # include_domains=None,
        # exclude_domains=None,
        # country=None
        # include_favicon=False
        # include_usage=False
    )
    ```

Invoke directly with args:

    ```python
    tool.invoke({"query": "What happened at the last wimbledon"})
    ```

    ```json
    {
        'query': 'What happened at the last wimbledon',
        'follow_up_questions': None,
        'answer': None,
        'images': [],
        'results': [{'title': "Andy Murray pulls out of the men's singles draw at his last Wimbledon",
                    'url': 'https://www.nbcnews.com/news/sports/andy-murray-wimbledon-tennis-singles-draw-rcna159912',
                    'content': "NBC News Now LONDON — Andy Murray, one of the last decade's most successful ..."
                    'score': 0.6755297,
                    'raw_content': None
                    }],
        'response_time': 1.31
    }
    ```

## Extends

- `BaseTool`

## Constructors

```python
__init__(
    self,
    **kwargs: Any = {},
) -> None
```


## Properties

- `name`
- `description`
- `args_schema`
- `handle_tool_error`
- `auto_parameters`
- `include_domains`
- `exclude_domains`
- `search_depth`
- `include_images`
- `time_range`
- `max_results`
- `topic`
- `include_answer`
- `include_raw_content`
- `include_image_descriptions`
- `country`
- `include_favicon`
- `include_usage`
- `exact_match`
- `api_wrapper`

---

[View source on GitHub](https://github.com/tavily-ai/langchain-tavily/blob/7dea6fd4ecf71bdf9319db0cac275529b4db5416/langchain_tavily/tavily_search.py#L172)