Overview of trustcall
maintrustcall is a library designed to help LLMs handle large JSON blobs more effectively. Instead of asking an LLM to generate or modify an entire JSON object at once, trustcall instructs the LLM to generate JSON patch operations.
This approach provides several benefits:
- Efficiency: Faster and cheaper generation of structured output.
- Resilience: Robust retrying of validation errors, even for complex, nested schemas (supporting Pydantic models, schema dictionaries, or regular Python functions).
- Accuracy: Precise updates to existing schemas that avoid accidental deletions.
It is suitable for workflows involving extraction, LLM routing, and multi-step agent tool use.