mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-30 01:52:18 +00:00
fix(langfuse): pass ssl_verify to Langfuse httpx client
This commit is contained in:
parent
5be0797d24
commit
aac6636277
2 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue