diff --git a/litellm/integrations/langfuse/langfuse.py b/litellm/integrations/langfuse/langfuse.py index 0efc7d66876..2573e02a9d1 100644 --- a/litellm/integrations/langfuse/langfuse.py +++ b/litellm/integrations/langfuse/langfuse.py @@ -154,7 +154,7 @@ class LangFuseLogger: self.langfuse_client = create_mock_langfuse_client() self.is_mock_mode = True else: - http_client = _get_httpx_client() + http_client = _get_httpx_client(params={"ssl_verify": litellm.ssl_verify}) self.langfuse_client = http_client.client self.is_mock_mode = False diff --git a/litellm/integrations/langfuse/langfuse_prompt_management.py b/litellm/integrations/langfuse/langfuse_prompt_management.py index b7a565512c6..9451c1162c0 100644 --- a/litellm/integrations/langfuse/langfuse_prompt_management.py +++ b/litellm/integrations/langfuse/langfuse_prompt_management.py @@ -4,6 +4,8 @@ Call Hook for LiteLLM Proxy which allows Langfuse prompt management. import os from functools import lru_cache + +import litellm from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple, Union, cast from packaging.version import Version @@ -19,6 +21,7 @@ from litellm.types.utils import StandardCallbackDynamicParams, StandardLoggingPa from ...litellm_core_utils.specialty_caches.dynamic_logging_cache import ( DynamicLoggingCache, ) +from ...llms.custom_httpx.http_handler import _get_httpx_client from ..prompt_management_base import PromptManagementBase from .langfuse import LangFuseLogger, resolve_langfuse_credentials from .langfuse_handler import LangFuseHandler @@ -47,6 +50,7 @@ def langfuse_client_init( langfuse_host=None, flush_interval=1, allow_env_credentials: bool = True, + ssl_verify=None, ) -> LangfuseClass: """ Initialize Langfuse client with caching to prevent multiple initializations. @@ -102,6 +106,9 @@ def langfuse_client_init( if Version(langfuse.version.__version__) >= Version("2.6.0"): parameters["sdk_integration"] = "litellm" + http_client = _get_httpx_client(params={"ssl_verify": ssl_verify}) + parameters["httpx_client"] = http_client.client + client = Langfuse(**parameters) return client @@ -123,6 +130,7 @@ class LangfusePromptManagement(LangFuseLogger, PromptManagementBase, CustomLogge langfuse_secret=langfuse_secret, langfuse_host=langfuse_host, flush_interval=flush_interval, + ssl_verify=litellm.ssl_verify, ) @property @@ -222,6 +230,7 @@ class LangfusePromptManagement(LangFuseLogger, PromptManagementBase, CustomLogge langfuse_secret_key=dynamic_callback_params.get("langfuse_secret_key"), langfuse_host=dynamic_callback_params.get("langfuse_host"), allow_env_credentials=dynamic_callback_params.get("langfuse_host") is None, + ssl_verify=litellm.ssl_verify, ) langfuse_prompt_client = self._get_prompt_from_id( langfuse_prompt_id=prompt_id, @@ -247,6 +256,7 @@ class LangfusePromptManagement(LangFuseLogger, PromptManagementBase, CustomLogge langfuse_secret_key=dynamic_callback_params.get("langfuse_secret_key"), langfuse_host=dynamic_callback_params.get("langfuse_host"), allow_env_credentials=dynamic_callback_params.get("langfuse_host") is None, + ssl_verify=litellm.ssl_verify, ) langfuse_prompt_client = self._get_prompt_from_id( langfuse_prompt_id=prompt_id,