Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix: graceful fallback when langfuse is not installed
Xubin Renf82b5a1b029d
diff --git a/nanobot/providers/openai_compat_provider.py b/nanobot/providers/openai_compat_provider.pyindex a06bfa237..7149b95e1 100644--- a/nanobot/providers/openai_compat_provider.py+++ b/nanobot/providers/openai_compat_provider.py@@ -4,7 +4,7 @@ from __future__ import annotationsimport asyncioimport hashlib-import importlib+import importlib.utilimport osimport secretsimport string@@ -14,13 +14,15 @@ from typing import TYPE_CHECKING, Anyimport json_repair-if os.environ.get("LANGFUSE_SECRET_KEY"):- LANGFUSE_AVAILABLE = importlib.util.find_spec("langfuse") is not None- if not LANGFUSE_AVAILABLE:- raise ImportError("Langfuse is not available; please install it with `pip install langfuse`")-+if os.environ.get("LANGFUSE_SECRET_KEY") and importlib.util.find_spec("langfuse"):from langfuse.openai import AsyncOpenAIelse:+ if os.environ.get("LANGFUSE_SECRET_KEY"):+ import logging+ logging.getLogger(__name__).warning(+ "LANGFUSE_SECRET_KEY is set but langfuse is not installed; "+ "install with `pip install langfuse` to enable tracing"+ )from openai import AsyncOpenAIfrom nanobot.providers.base import LLMProvider, LLMResponse, ToolCallRequest