File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,19 @@ def __init__(
104104 Args:
105105 public_key: Optional Langfuse public key. If not provided, will use the default client configuration.
106106 update_trace: Whether to update the Langfuse trace with the chains input / output / metadata / name. Defaults to False.
107+ trace_context: Optional context for connecting to an existing trace (distributed tracing) or
108+ setting a custom trace id for the root LangChain run. Pass a `TraceContext` dict, e.g.
109+ `{"trace_id": "<trace_id>"}` (and optionally `{"parent_span_id": "<span_id>"}`) to link
110+ the trace to an upstream system.
111+
112+ Example:
113+ Use a custom trace id without context managers:
114+
115+ ```python
116+ from langfuse.langchain import CallbackHandler
117+
118+ handler = CallbackHandler(trace_context={"trace_id": "my-trace-id"})
119+ ```
107120 """
108121 self .client = get_client (public_key = public_key )
109122 self .run_inline = True
You can’t perform that action at this time.
0 commit comments