From 73ad1bf6ed28244f6be59881d11fbe1bbe6d7d07 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 3 Oct 2023 20:56:13 -0700 Subject: [PATCH] raise error when langfuse not installed --- litellm/integrations/langfuse.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/langfuse.py b/litellm/integrations/langfuse.py index 9ec9a4d7f86..845189ef7c3 100644 --- a/litellm/integrations/langfuse.py +++ b/litellm/integrations/langfuse.py @@ -11,7 +11,10 @@ import traceback class LangFuseLogger: # Class variables or attributes def __init__(self): - from langfuse import Langfuse + try: + from langfuse import Langfuse + except: + raise Exception("\033[91mLangfuse not installed, try running 'pip install langfuse' to fix this error\033[0m") # Instance variables self.secret_key = os.getenv("LANGFUSE_SECRET_KEY") self.public_key = os.getenv("LANGFUSE_PUBLIC_KEY")