Skip to content

Commit 6327078

Browse files
committed
update
1 parent d6acf24 commit 6327078

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

eval_protocol/adapters/fireworks_tracing.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __call__(
4646
...
4747

4848

49-
def extract_openai_response(observations: List[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
49+
def extract_otel_attributes(observations: List[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
5050
"""Attempt to extract and parse attributes from raw_gen_ai_request observation. This only works when stored in OTEL format.
5151
5252
Args:
@@ -137,9 +137,14 @@ def convert_trace_dict_to_evaluation_row(
137137

138138
observations = trace.get("observations") or []
139139
# We can only extract when stored in OTEL format.
140-
openai_response = extract_openai_response(observations)
141-
if openai_response:
142-
choices = openai_response.get("llm.openai.choices")
140+
otel_attributes = extract_otel_attributes(observations)
141+
if otel_attributes:
142+
# Find choices from any provider (llm.*.choices pattern)
143+
choices = None
144+
for key, value in otel_attributes.items():
145+
if key.endswith(".choices") and isinstance(value, list):
146+
choices = value
147+
break
143148
if choices and len(choices) > 0:
144149
execution_metadata.finish_reason = choices[0].get("finish_reason")
145150

0 commit comments

Comments
 (0)