Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Gracefully degrades if user does not have tavily installed

Stefan Krawczyk64ed79d9b269
diff --git a/examples/deep-researcher/utils.py b/examples/deep-researcher/utils.py
index a4608587..d0aa09e1 100644
--- a/examples/deep-researcher/utils.py
+++ b/examples/deep-researcher/utils.py
@@ -21,8 +21,17 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
+import logging
-from tavily import TavilyClient
+logger = logging.getLogger(__name__)
+
+try:
+ from tavily import TavilyClient
+except ImportError:
+ logger.warning(
+ "Please install tavily with `pip install tavily-python` if you want the deep research example to function."
+ )
+ TavilyClient = None
def deduplicate_and_format_sources(