QuestionQ106

Context Management & Reliability

You are developing a structured data-extraction system with Claude. The system pulls information from unstructured documents, validates its output with JavaScript Object Notation (JSON) schemas, and preserves high accuracy. It must gracefully handle edge cases and integrate with downstream systems.

Monitoring indicates that 12% of extractions fail Pydantic validation with specific errors such as "expected float for quantity, got '2 to 3'". Retrying these requests unchanged results in the same failures.

What is the most effective method to recover from these validation failures?

Explanation

Validation-error feedback provides the model with the precise violated constraint and lets it correct its prior structured output. An unchanged retry is unlikely to fix a deterministic type or interpretation error such as returning a quantity range where the schema requires a float.

Community Discussion

No comments yet. Be the first to start the discussion!