Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix linting errors

Ishaan Jaffc2f7d7b18516
diff --git a/enterprise/enterprise_hooks/session_handler.py b/enterprise/enterprise_hooks/session_handler.py
index 1ac419a7a1c..94a3ccc436e 100644
--- a/enterprise/enterprise_hooks/session_handler.py
+++ b/enterprise/enterprise_hooks/session_handler.py
@@ -11,8 +11,8 @@ from litellm.types.llms.openai import (
ResponseInputParam,
)
from litellm.types.utils import ChatCompletionMessageToolCall
-from litellm.types.responses.main import ChatCompletionSession
from litellm.responses.utils import ResponsesAPIRequestUtils
+from litellm.responses.litellm_completion_transformation.transformation import ChatCompletionSession
class _ENTERPRISE_ResponsesSessionHandler:
diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py
index 9c9923cf29f..66cf24cefee 100644
--- a/litellm/responses/litellm_completion_transformation/transformation.py
+++ b/litellm/responses/litellm_completion_transformation/transformation.py
@@ -7,14 +7,17 @@ from typing import Any, Dict, List, Optional, Union
from openai.types.responses.tool_param import FunctionToolParam
from typing_extensions import TypedDict
+HAS_ENTERPRISE_DIRECTORY = False
try:
import enterprise
from enterprise.enterprise_hooks.session_handler import (
_ENTERPRISE_ResponsesSessionHandler,
)
+
+ HAS_ENTERPRISE_DIRECTORY = True
except ImportError:
- enterprise = None
_ENTERPRISE_ResponsesSessionHandler = None # type: ignore
+ HAS_ENTERPRISE_DIRECTORY = False
from litellm.caching import InMemoryCache
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
@@ -195,7 +198,10 @@ class LiteLLMCompletionResponsesConfig:
"""
Async hook to get the chain of previous input and output pairs and return a list of Chat Completion messages
"""
- if _ENTERPRISE_ResponsesSessionHandler and ChatCompletionSession:
+ if (
+ HAS_ENTERPRISE_DIRECTORY is True
+ and _ENTERPRISE_ResponsesSessionHandler is not None
+ ):
chat_completion_session = ChatCompletionSession(
messages=[], litellm_session_id=None
)