Yea certainly an interesting problem!
My gut reaction, you would need some kind of normalization step -- get the contract into some kind of expected structure, so that comparisons can be done piece by piece
https://docs.llamaindex.ai/en/stable/examples/query_engine/pydantic_query_engine.htmlWe recently added pydnatic outputs to query engines (thanks @bmax β€οΈ )
So if you can think of some structure to normalize a contract to, this could work quite well. It could fill out the structure as it iterates over the contract