Skip to content

Commit 0c2f7db

Browse files
committed
refactor(tracing): drop span_name from Fireworks adapter
Follow-up to the previous commit: instead of accepting span_name and raising NotImplementedError, just remove the parameter. Each /v1/traces row is one LLM call with no nested span structure, so span_name has no meaningful semantics here. Callers that still pass span_name now get a clear TypeError at call time. Removed from TraceDictConverter.__call__, convert_trace_dict_to_evaluation_row, extract_messages_from_trace_dict, and FireworksTracingAdapter.get_evaluation_rows. Langfuse adapter is unaffected (it defines its own TraceDictConverter). Made-with: Cursor
1 parent a692e20 commit 0c2f7db

1 file changed

Lines changed: 5 additions & 46 deletions

File tree

eval_protocol/adapters/fireworks_tracing.py

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ def __call__(
3333
self,
3434
trace: Dict[str, Any],
3535
include_tool_calls: bool,
36-
span_name: Optional[str],
3736
) -> Optional[EvaluationRow]:
3837
"""Convert a trace dictionary to an EvaluationRow.
3938
4039
Args:
4140
trace: The trace dictionary to convert
4241
include_tool_calls: Whether to include tool calling information
43-
span_name: Optional span name to extract messages from
4442
4543
Returns:
4644
EvaluationRow or None if the trace should be skipped
@@ -49,34 +47,20 @@ def __call__(
4947

5048

5149
def convert_trace_dict_to_evaluation_row(
52-
trace: Dict[str, Any], include_tool_calls: bool = True, span_name: Optional[str] = None
50+
trace: Dict[str, Any], include_tool_calls: bool = True
5351
) -> Optional[EvaluationRow]:
5452
"""Convert a trace dictionary (from proxy API) to EvaluationRow format.
5553
5654
Args:
5755
trace: Trace dictionary from Fireworks proxy API
5856
include_tool_calls: Whether to include tool calling information
59-
span_name: Not supported by this converter. Each row returned by the
60-
Fireworks tracing endpoint is a single LLM call, so there is no
61-
nested-span structure to walk. Pass a custom ``TraceDictConverter``
62-
via ``get_evaluation_rows(..., converter=...)`` if you need
63-
span-specific extraction logic.
6457
6558
Returns:
6659
EvaluationRow or None if conversion fails
67-
68-
Raises:
69-
NotImplementedError: If ``span_name`` is provided.
7060
"""
71-
if span_name:
72-
raise NotImplementedError(
73-
"span_name is not supported by the default Fireworks tracing converter. "
74-
"Each trace row is already a single LLM call; provide a custom "
75-
"TraceDictConverter to get_evaluation_rows() for span-aware logic."
76-
)
7761
try:
7862
# Extract messages from trace input and output
79-
messages = extract_messages_from_trace_dict(trace, include_tool_calls, span_name)
63+
messages = extract_messages_from_trace_dict(trace, include_tool_calls)
8064

8165
# Extract tools if available. `Input` carries the request payload,
8266
# which optionally includes a `tools` array when tool-calling is used.
@@ -135,9 +119,7 @@ def convert_trace_dict_to_evaluation_row(
135119
return None
136120

137121

138-
def extract_messages_from_trace_dict(
139-
trace: Dict[str, Any], include_tool_calls: bool = True, span_name: Optional[str] = None
140-
) -> List[Message]:
122+
def extract_messages_from_trace_dict(trace: Dict[str, Any], include_tool_calls: bool = True) -> List[Message]:
141123
"""Extract messages from a Fireworks trace row.
142124
143125
The Fireworks tracing endpoint returns one row per LLM call with the
@@ -147,22 +129,10 @@ def extract_messages_from_trace_dict(
147129
Args:
148130
trace: Trace dictionary from proxy API
149131
include_tool_calls: Whether to include tool calling information
150-
span_name: Not supported. Pass a custom ``TraceDictConverter`` to
151-
``FireworksTracingAdapter.get_evaluation_rows`` if you need
152-
span-specific extraction.
153132
154133
Returns:
155134
List of Message objects
156-
157-
Raises:
158-
NotImplementedError: If ``span_name`` is provided.
159135
"""
160-
if span_name:
161-
raise NotImplementedError(
162-
"span_name is not supported by extract_messages_from_trace_dict for "
163-
"Fireworks traces; each row is already a single LLM call."
164-
)
165-
166136
messages: List[Message] = []
167137
try:
168138
# `Input` carries the request messages; `Output` carries the
@@ -364,7 +334,6 @@ def get_evaluation_rows(
364334
include_tool_calls: bool = True,
365335
sleep_between_gets: float = 0.1,
366336
max_retries: int = 3,
367-
span_name: Optional[str] = None,
368337
converter: Optional[TraceDictConverter] = None,
369338
) -> List[EvaluationRow]:
370339
"""Pull traces from Langfuse via proxy and convert to EvaluationRow format.
@@ -387,9 +356,6 @@ def get_evaluation_rows(
387356
include_tool_calls: Whether to include tool calling traces
388357
sleep_between_gets: Sleep time between polling attempts (default: 2.5s)
389358
max_retries: Max retry attempts used by proxy (default: 3)
390-
span_name: Only supported when a custom ``converter`` is supplied.
391-
The default Fireworks converter does not walk nested spans
392-
(each trace row is already a single LLM call).
393359
converter: Optional custom converter implementing TraceDictConverter protocol.
394360
If provided, this will be used instead of the default conversion logic.
395361
@@ -398,18 +364,11 @@ def get_evaluation_rows(
398364
399365
Raises:
400366
ValueError: If tags list is empty or no ``rollout_id`` tag is present.
401-
NotImplementedError: If ``span_name`` is provided without a custom ``converter``.
402367
"""
403368
# Validate that tags are provided
404369
if not tags or len(tags) == 0:
405370
raise ValueError("At least one tag is required to fetch traces")
406371

407-
if span_name and converter is None:
408-
raise NotImplementedError(
409-
"span_name is not supported by the default Fireworks tracing converter. "
410-
"Pass a custom converter=TraceDictConverter(...) if you need span-aware logic."
411-
)
412-
413372
# Pull out rollout_id only, since that is the task-level id needed to fetch traces.
414373
rollout_id = next(
415374
(t.split(":", 1)[1] for t in tags if t.startswith("rollout_id:")),
@@ -483,9 +442,9 @@ def get_evaluation_rows(
483442
for trace in traces:
484443
try:
485444
if converter:
486-
eval_row = converter(trace, include_tool_calls, span_name)
445+
eval_row = converter(trace, include_tool_calls)
487446
else:
488-
eval_row = convert_trace_dict_to_evaluation_row(trace, include_tool_calls, span_name)
447+
eval_row = convert_trace_dict_to_evaluation_row(trace, include_tool_calls)
489448
if eval_row:
490449
eval_rows.append(eval_row)
491450
except (AttributeError, ValueError, KeyError) as e:

0 commit comments

Comments
 (0)