You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid pre-serializing Pydantic AI values in tracing helpers. Keep
integration-side shaping focused on readable span payloads and
materializing binary content into Braintrust attachments, while leaving
general serialization to Braintrust logging.
Update private helper names and tests from serialize_* to shape_* to
reflect the narrower responsibility.
```
I did a quick local microbenchmark against an approximation of the previous helper behavior using the pydantic-ai latest nox env.
Results:
┌────────────────────────────────────┬──────────┬─────────┬────────────────────────┐
│ case │ old │ new │ speedup │
├────────────────────────────────────┼──────────┼─────────┼────────────────────────┤
│ binary message shaping │ 24.83 µs │ 5.45 µs │ 4.6x │
├────────────────────────────────────┼──────────┼─────────┼────────────────────────┤
│ text messages x5 │ 51.79 µs │ 7.31 µs │ 7.1x │
├────────────────────────────────────┼──────────┼─────────┼────────────────────────┤
│ nested binary content part │ 15.01 µs │ 4.86 µs │ 3.1x │
├────────────────────────────────────┼──────────┼─────────┼────────────────────────┤
│ model response text │ 13.84 µs │ 1.94 µs │ 7.1x │
├────────────────────────────────────┼──────────┼─────────┼────────────────────────┤
│ model settings copy vs passthrough │ 0.79 µs │ ~0 µs │ effectively eliminated │
└────────────────────────────────────┴──────────┴─────────┴────────────────────────┘
```
0 commit comments