from thedriveai import TheDriveAI
client = TheDriveAI(api_key="tda_live_...")
result = client.analyze(
file="contract.pdf",
schema={
"total_value": {
"type": "number",
"description": "Total contract value (sum all payment amounts)"
},
"auto_renews": {
"type": "boolean",
"description": "Does this contract auto-renew?"
},
"termination_notice_days": {
"type": "integer",
"description": "How many days notice required to terminate?"
},
"risk_level": {
"type": "string",
"enum": ["low", "medium", "high"],
"description": "Overall legal risk level"
},
},
)
print(result.data)
# {"total_value": 250000, "auto_renews": true, "termination_notice_days": 90, "risk_level": "medium"}
print(result.reasoning["auto_renews"])
# "Section 8.2 states 'This agreement shall automatically renew for successive one-year terms
# unless either party provides written notice of non-renewal at least 90 days prior...'"
print(result.sources["total_value"])
# ["Year 1: $100,000 (Section 4.1)", "Year 2: $150,000 (Section 4.2)"]