From 6b060f98656e00af41fe6c24567ea7439e7e0cd5 Mon Sep 17 00:00:00 2001 From: Alexander Thiess Date: Mon, 22 Sep 2025 12:59:44 +0200 Subject: [PATCH] only use langchain if env vars are set --- src/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index d1b2678..403de11 100644 --- a/src/main.py +++ b/src/main.py @@ -15,20 +15,22 @@ from tools.base_tool import ToolContext, set_tool_context load_dotenv() + logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' ) logging.getLogger('watchfiles').setLevel(logging.WARNING) -langfuse = get_client() +if all(var in os.environ for var in ['LANGFUSE_PUBLIC_KEY', 'LANGFUSE_SECRET_KEY', 'LANGFUSE_HOST']): + langfuse = get_client() -if langfuse.auth_check(): - print("Langfuse client is authenticated and ready!") -else: - print("Authentication failed. Please check your credentials and host.") + if langfuse.auth_check(): + print("Langfuse client is authenticated and ready!") + else: + print("Authentication failed. Please check your credentials and host.") -Agent.instrument_all() + Agent.instrument_all() app.add_static_files('/static', 'src/static')