Python package version 0.3.5

Good news!

As of July 17th, 2024, we have officially updated our Python package (tavily-python) with improved error handling! And as a bonus, the package can now automatically load an API key from the environment variables.

To update to this new version, simply run:

pip install --upgrade tavily-python

What’s new?

New exception classes have been added to make error handling much easier.

from tavily import MissingAPIKeyError, InvalidAPIKeyError, UsageLimitExceededError

Additionally, you can now initialize the TavilyClient class without specifying an API key explicitly. The package will try loading it directly from an environment variable named TAVILY_API_KEY if it exists.

from tavily import TavilyClient

client = TavilyClient()

What’s changing?

If a search query fails, instead of a generic HTTPError, the proper error class will be raised, along with a helpful message telling you exactly what went wrong.

Any questions?

Feel free to post any feedback/questions you may have. We’ll be happy to help you.

1 Like