Python package version 0.4.0

Good news!

As of August 16th, 2024, we have officially updated our Python package (tavily-python) to support a new keyword argument, days, for key methods like search, get_search_context, and qna_search. This update is part of our ongoing effort to enhance functionality and give you more control over your search queries.

What’s new?

You can now specify the days parameter in your search queries, but please note that it only works when using the "news" search topic. The days parameter expects an integer value, representing the number of days back from the current date to include in the search results. This allows you to limit your search results to a specific time frame, making it easier to focus on the most relevant and recent data—or to broaden your search to include a larger time frame. The default value is 3 days, but you can adjust it according to your needs.

Example:

# Step 1. Instantiating your TavilyClient
from tavily import TavilyClient
client = TavilyClient(api_key="YOUR_API_KEY")

# Step 2. Executing a simple "news" search query with the days keyword argument
response = client.search("what happened today in New York?", topic="news", days=1)

What’s changing?

If you don’t use the new days parameter for the "news" search topic, nothing changes—the methods will continue to function as before. If you do use it, this new option allows you to adjust the time frame of your news search, helping you retrieve the data you need more efficiently.

Any questions?

We’re excited to bring you this new feature and can’t wait to see how you use it. If you have any questions, or if you encounter any issues, please contact us at support@tavily.com. We’re here to help!

1 Like