LLMs for structured input validation
5 comments
You might want to try Instructor with llm_validator, where you can have natural language clauses to check against in a loop:
https://python.useinstructor.com/blog/2023/10/23/good-llm-va...
With Pydantic too of course!
What would be the advantage of using an LLM here? As opposed to parsing/validating the input using any other technique (of it's a well defined format, where you have e.g. a grammar).
Agree with this. Just use Pydantic.
Depends on how fuzzy your definition of template is. If it's really structured, a simpler algorithm might work better. Otherwise maybe try https://github.com/Unstructured-IO/unstructured
If the input doc / text doesn't adhere to the specific template, I'd like LLMs to point our the inconsistencies.