Closed FrancisVarga closed 1 week ago
You can add tracing from the current workflow into the custom tools workflow using the LangFuseDataTrace
class. Here's how you can do it:
Instantiate LangFuseDataTrace
:
langfuse_data_trace = LangFuseDataTrace(langfuse_config)
Create a ToolTraceInfo
object with the necessary information:
tool_trace_info = ToolTraceInfo(
tool_name="custom_tool_name",
tool_inputs={"input_key": "input_value"},
tool_outputs={"output_key": "output_value"},
message_id="unique_message_id",
start_time=datetime.now(),
end_time=datetime.now() + timedelta(seconds=5),
metadata={"additional": "metadata"},
error=None # or provide an error message if there was an error
)
Call the tool_trace
method to add the trace:
langfuse_data_trace.tool_trace(tool_trace_info)
This will add a trace for the custom tool execution within the workflow. The tool_trace
method constructs a LangfuseSpan
object with the provided information and calls self.add_span
to add the span to the trace [1].
For more detailed steps and visual aids, you can refer to the Langfuse integration guide which provides comprehensive instructions on setting up and using Langfuse for monitoring and tracing in Dify [2][3].
To continue talking to Dosu, mention @dosu.
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Created custom tools to manage easier complex workflows.
2. Additional context or comments
There is no tracing from the current workflow into the tools workflow
3. Can you help us with this feature?