|
4 | 4 | from dspy.adapters import Image as dspy_Image |
5 | 5 | from dspy.signatures import Signature as dspy_Signature |
6 | 6 | from dspy.utils.callback import BaseCallback |
7 | | -from langfuse import Langfuse, LangfuseGeneration, LangfuseSpan, get_client |
| 7 | +from langfuse import Langfuse, LangfuseGeneration, LangfuseTool, get_client |
8 | 8 | from langfuse.types import TraceContext |
9 | 9 | from litellm.cost_calculator import completion_cost |
10 | 10 | from loguru import logger as log |
@@ -61,7 +61,7 @@ def __init__(self, signature: type[dspy_Signature]) -> None: |
61 | 61 | self.input_field_values = contextvars.ContextVar[dict[str, Any]]( |
62 | 62 | "input_field_values" |
63 | 63 | ) |
64 | | - self.current_tool_span = contextvars.ContextVar[LangfuseSpan | None]("current_tool_span") |
| 64 | + self.current_tool_span = contextvars.ContextVar[LangfuseTool | None]("current_tool_span") |
65 | 65 | # Initialize Langfuse client |
66 | 66 | self.langfuse: Langfuse = Langfuse() |
67 | 67 | self.input_field_names = signature.input_fields.keys() |
@@ -404,7 +404,7 @@ def on_tool_start( # noqa |
404 | 404 | trace_context["parent_span_id"] = parent_observation_id |
405 | 405 | tool_span = self.langfuse.start_observation( |
406 | 406 | name=f"tool:{tool_name}", |
407 | | - as_type="span", |
| 407 | + as_type="tool", |
408 | 408 | input=tool_args, |
409 | 409 | trace_context=trace_context, |
410 | 410 | metadata={ |
|
0 commit comments