Schema extraction allows you to define the exact structure of data you want to extract from documents. Instead of getting raw text, you receive structured JSON that matches your specified schema, making it perfect for automated workflows and database integration.
result = client.extract( file_path="document.pdf", schema=schema, schema_prompt="This is a German invoice. Extract amounts in EUR. Pay special attention to VAT calculations")
try: result = client.extract(file_path="doc.pdf", schema=invalid_schema)except Exception as e: if "Invalid schema" in str(e): print("Schema validation failed")