import os
from pathlib import Path
from eigenpal import EigenpalClient, EigenpalValidationError
client = EigenpalClient(api_key=os.environ["EIGENPAL_API_KEY"])
# Pass a Path / file handle / { content, filename, mime_type }. The SDK uploads
# the request as multipart/form-data, no base64 needed. `wait_for_completion`
# holds the request open (up to N seconds) and returns the finished run.
result = client.run(
"workflows.extract-invoice",
input={"contract_document": Path("contract.pdf")},
wait_for_completion=60,
)
print(result["finished"], result["output"])