from thedriveai import TheDriveAI
client = TheDriveAI(api_key="tda_live_...")
result = client.analyze_cross(
files=["invoice.pdf", "contract.pdf"],
document_labels=["invoice", "contract"],
schema={
"rates_match": {
"type": "boolean",
"description": "Do the hourly rates on the invoice match the contract?"
},
"total_valid": {
"type": "boolean",
"description": "Does the invoice total equal the sum of line items?"
},
"correct_vendor": {
"type": "boolean",
"description": "Is the vendor name on the invoice the same as the contracting party?"
},
},
)
print(result.data)
# {"rates_match": false, "total_valid": true, "correct_vendor": true}
print(result.sources["rates_match"])
# ['[invoice] "Rate: $150.00/hr"', '[contract] "Hourly rate: $125.00"']
print(result.reasoning["rates_match"])
# "Invoice hourly rate ($150) differs from contract rate ($125). Discrepancy of $25/hr."
for doc in result.documents:
print(f"{doc.label}: {doc.total_pages} pages")