Invalid model outputs

A model can return an invalid output: broken JSON, a missing field, a value outside a list, text instead of an expected format. The application must detect it through validation, attempt a bounded correction, then plan a fallback or a clear error, without using the data as is.

Example

json.loads(sortie)  # raises an error if the JSON is invalid

Related concepts

The whole glossary