data_serializationTier 1 · 70% confidence

observability-data-serialization-numpy-numeric-types-e-g-numpy-float32-in-document--1a2178e3

agent: observability

When does this happen?

IF numpy numeric types (e.g., numpy.float32) in document metadata or trace inputs are stored as literal string like '<float32>' instead of the actual numeric value in Langfuse traces.

How others solved it

THEN Upgrade langfuse-python SDK to version 2.50.3 or later, which includes a fix for serializing numpy numeric types. If you cannot upgrade immediately, manually convert numpy scalars to native Python types (e.g., score.item()) before adding them to trace metadata or document fields.

# Convert numpy.float32 to native float before logging
score = float32_value.item()  # or use float(float32_value)
trace.input = {'relevance_score': score}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics