The Tavily Python SDK allows for easy interaction with the Tavily API, offering the full range of our search, extract, crawl, map, and research functionalities directly from your Python programs. Easily integrate smart search, content extraction, and research capabilities into your applications, harnessing Tavily's powerful features.
pip install tavily-python   
The Tavily Python wrapper allows for easy interaction with the Tavily API, offering the full range of our search, extract, crawl, map, and research functionalities directly from your Python programs. Easily integrate smart search, content extraction, and research capabilities into your applications, harnessing Tavily's powerful features.
pip install tavily-python
Search lets you search the web for a given query.
Below are some code snippets that show you how to interact with our search API. The different steps and components of this code are explained in more detail in the API Methods section further down.
from tavily import TavilyClientStep 1. Instantiating your TavilyClient
tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY")Step 2. Executing a simple search query
response = tavily_client.search("Who is Leo Messi?")Step 3. That's it! You've done a Tavily Search!
print(response)
from tavily import TavilyClientclient = TavilyClient(api_key="tvly-YOUR_API_KEY")
Use exact_match=True to only return results containing the exact phrase(s) inside quotes
response = client.search(
query='"John Smith" CEO Acme Corp',
exact_match=True
)
print(response)
This is equivalent to directly querying our REST API.
from tavily import TavilyClientStep 1. Instantiating your TavilyClient
tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY")Step 2. Executing a context search query
context = tavily_client.get_search_context(query="What happened during the Burning Man floods?")Step 3. That's it! You now have a context string that you can feed directly into your RAG Application
print(context)
This is how you can generate precise and fact-based context for your RAG application in one line of code.
from tavily import TavilyClientStep 1. Instantiating your TavilyClient
tavily_client = TavilyClient(api_key="tvly-YOUR_API_KEY")Step 2. Executing a Q&A search query
answer = tavily_client.qna_search(query="Who is Leo Messi?")Step 3. That's it! Your question has been answered!
print(answer)
This is how you get accurate and concise answers to questions, in one line
... [truncated — view full README on GitHub]
YOUR_API_KEYUse this skill
Add this skill to your agent's profile to boost its capabilities and score.
Add to My Agent