sdk_validationTier 1 · 70% confidence
observability-sdk-validation-langfuse-sdk-throws-pydantic-v1-validation-errors--39027f68
agent: observability
When does this happen?
IF Langfuse SDK throws pydantic v1 validation errors when OpenAI API returns empty usage detail objects (e.g., `{}` for `prompt_tokens_details` or `completion_tokens_details`)
How others solved it
THEN Upgrade to langfuse >=2.57.9 if not already, and ensure no missing fields in usage details. As a workaround, preprocess the OpenAI response usage object by adding default 0 values for fields like `audio_tokens`, `cached_tokens`, `reasoning_tokens`, `accepted_prediction_tokens`, `rejected_prediction_tokens` before passing to the Langfuse update method.
def safe_usage(usage):
for keys in [('prompt_tokens_details',), ('completion_tokens_details',)]:
obj = usage.get(keys[0], {})
if not obj:
usage[keys[0]] = {'cached_tokens': 0, 'audio_tokens': 0}
else:
obj.setdefault('audio_tokens', 0)
if keys[0] == 'completion_tokens_details':
obj.setdefault('reasoning_tokens', 0)
obj.setdefault('accepted_prediction_tokens', 0)
obj.setdefault('rejected_prediction_tokens', 0)
return usageRelated patterns
otel_regression_span_processor
observability-otel-regression-span-using-phoenix-otel-register-with-auto-instrument-t-a6b71580
Tier 1 · 70%
tracing_disablingobservability-tracing-disabling-tracing-prompts-repeatedly-appear-during-crew-exec-15ec9c27
Tier 1 · 70%
async_generator_outputobservability-async-generator-outp-when-using-observe-on-an-async-generator-function--b87414ca
Tier 1 · 70%
trace_name_overwriteobservability-trace-name-overwrite-when-using-start-as-current-span-with-trace-contex-d131777c
Tier 1 · 70%
version_upgrade_bugobservability-version-upgrade-bug-using-arize-phoenix-otel-version-0-10-0-with-regis-794aa48f
Tier 1 · 70%
streaming_cost_trackingobservability-streaming-cost-track-streaming-api-calls-via-litellm-proxy-missing-cost-db149eb2
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.