diff --git a/lightrag/llm/openai.py b/lightrag/llm/openai.py index 025a094e..c87ddbe1 100644 --- a/lightrag/llm/openai.py +++ b/lightrag/llm/openai.py @@ -13,8 +13,18 @@ import pipmaster as pm # Pipmaster for dynamic library install if not pm.is_installed("openai"): pm.install("openai") +# Try to import Langfuse for LLM observability (optional) +# Falls back to standard OpenAI client if not available +try: + from langfuse.openai import AsyncOpenAI + LANGFUSE_ENABLED = True + logger.info("Langfuse observability enabled for OpenAI client") +except ImportError: + from openai import AsyncOpenAI + LANGFUSE_ENABLED = False + logger.debug("Langfuse not available, using standard OpenAI client") + from openai import ( - AsyncOpenAI, APIConnectionError, RateLimitError, APITimeoutError, diff --git a/pyproject.toml b/pyproject.toml index 29f7c58e..8eabb37c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,6 @@ dependencies = [ "aiohttp", "configparser", "future", - "google-api-core>=2.0.0,<3.0.0", - "google-genai>=1.0.0,<2.0.0", "json_repair", "nano-vectordb", "networkx", @@ -61,8 +59,6 @@ api = [ "tenacity", "tiktoken", "xlsxwriter>=3.1.0", - "google-api-core>=2.0.0,<3.0.0", - "google-genai>=1.0.0,<2.0.0", # API-specific dependencies "aiofiles", "ascii_colors", @@ -98,7 +94,7 @@ offline-storage = [ "pymilvus>=2.6.2,<3.0.0", "pymongo>=4.0.0,<5.0.0", "asyncpg>=0.29.0,<1.0.0", - "qdrant-client>=1.11.0,<2.0.0", + "qdrant-client>=1.7.0,<2.0.0", ] offline-llm = [ @@ -110,8 +106,6 @@ offline-llm = [ "aioboto3>=12.0.0,<16.0.0", "voyageai>=0.2.0,<1.0.0", "llama-index>=0.9.0,<1.0.0", - "google-api-core>=2.0.0,<3.0.0", - "google-genai>=1.0.0,<2.0.0", ] offline = [ @@ -119,15 +113,6 @@ offline = [ "lightrag-hku[offline-docs,offline-storage,offline-llm]", ] -evaluation = [ - # RAG evaluation dependencies (RAGAS framework) - "ragas>=0.3.7", - "datasets>=4.3.0", - "httpx>=0.28.1", - "pytest>=8.4.2", - "pytest-asyncio>=1.2.0", -] - observability = [ # LLM observability and tracing dependencies "langfuse>=3.8.1",