Replies: 1 comment
-
Hey @snopoke! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's work on tackling this issue together. To handle multiple API keys in a multi-tenant environment with Langfuse, you can continue using the Regarding the deprecation of Here's an example of how you can customize the Langfuse client instance for each execution: from langfuse.callback import CallbackHandler
langfuse_handler = CallbackHandler()
trace_name = "langchain_trace_name"
session_id = "random-session"
user_id = "random-user"
tags = ["random-tag-1", "random-tag-2"]
# Your existing Langchain code to create the chain
# Pass config to the chain invocation to be parsed as Langfuse trace attributes
chain.invoke(
{"animal": "dog"},
config={
"callbacks": [langfuse_handler],
"run_name": trace_name,
"tags": tags,
"metadata": {
"langfuse_session_id": session_id,
"langfuse_user_id": user_id,
},
},
) This approach allows you to maintain flexibility and ensure that each client's data is handled separately. If you need further customization or encounter issues with deprecated methods, checking the latest Langfuse documentation or updates might provide additional insights or alternatives [1]. |
Beta Was this translation helpful? Give feedback.
-
I'm building a multi-tenant bot platform where I'm supporting multiple tracing agents including langfuse. The model we're using is that clients bring their own API key so that the trace data goes into their account.
The way we're doing this now is to create a
CallbackHandler
with the client's auth for each chain execution:We can't use the
observe
decorator because the is no way to customise the langfuse client for each execution (since it uses a global client instance).I'm creating this issue because while the callback handler approach is working I notice that the
get_trace_url
andget_trace_id
methods are deprecated and marked for removal.Is there a better way for us to approach this?
Beta Was this translation helpful? Give feedback.
All reactions