fix(mlflow): call model_dump() instead of passing method reference in _add_chunk_events

choice.delta.model_dump (without parens) passes the bound method object to
json.dumps instead of calling it, causing _add_chunk_events to always raise
an exception silently. This prevents _end_span_or_trace from being called,
so zero MLflow traces are recorded for streaming responses.

Fixes: streaming traces not appearing in MLflow experiment tne-costs
This commit is contained in:
Rich Tong 2026-06-13 14:07:58 -07:00
parent 84c1414aef
commit 0b7e609795

View file

@ -157,7 +157,7 @@ class MlflowLogger(CustomLogger):
SpanEvent(
name="streaming_chunk",
attributes={
"delta": json.dumps(choice.delta.model_dump, default=str)
"delta": json.dumps(choice.delta.model_dump(), default=str)
},
)
)