You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current environment variables LANGFUSE_SECRET_KEY / LANGFUSE_API_KEY, LANGFUSE_PUBLIC_KEY, and LANGFUSE_HOST may not be sufficient for tracing in Langfuse.
To address this, please update the wrapper in haystack_integrations.components.connectors.langfuse.LangfuseConnector to accept httpx_client as a parameter.
The code fix would only affect the lines
Tried locally to overwrite the LangfuseConnector in this way:
class LangfuseConnector:
def __init__(self, name: str, public: bool = False, httpx_client: Optional[httpx.Client] = None):
self.name = name
self.tracer = LangfuseTracer(
tracer=Langfuse(httpx_client=httpx_client or httpx.Client(verify=os.getenv('LANGFUSE_PATH_TO_CERTIFICATE')))
)
tracing.enable_tracing(self.tracer)
@component.output_types(name=str, trace_url=str)
def run(self, invocation_context: Optional[Dict[str, Any]] = None):
logger.debug(
"Langfuse tracer invoked with the following context: '{invocation_context}'",
invocation_context=invocation_context,
)
return {"name": self.name, "trace_url": self.tracer.get_trace_url()}
and it solved the certification related issue that is usually showed as Unexpected error occurred. Please check your request and contact support: https://langfuse.com/support.
The current environment variables
LANGFUSE_SECRET_KEY
/LANGFUSE_API_KEY
,LANGFUSE_PUBLIC_KEY
, andLANGFUSE_HOST
may not be sufficient for tracing in Langfuse.For example, the following code:
might return an error:
However, this works correctly if the env variables are set correctly:
To address this, please update the wrapper in
haystack_integrations.components.connectors.langfuse.LangfuseConnector
to accepthttpx_client
as a parameter.The code fix would only affect the lines
haystack-core-integrations/integrations/langfuse/src/haystack_integrations/components/connectors/langfuse/langfuse_connector.py
Line 108 in 61ac2f4
self.tracer = LangfuseTracer(tracer=Langfuse(), name=name, public=public)
->
tracer=Langfuse(httpx_client=httpx_client or httpx.Client(verify=os.getenv('LANGFUSE_PATH_TO_CERTIFICATE')))
def __init__(self, name: str, public: bool = False, httpx_client: Optional[httpx.Client] = None)
Thanks!
The text was updated successfully, but these errors were encountered: