Skip to main content
The Chunkr AI API follows a task-based pattern where you create a task and monitor its progress through polling. The poll() method handles this by automatically checking the task’s status at regular intervals until it transitions out of the Starting or Processing states. After polling completes, it’s important to verify the final task status, which will be one of:
  • Succeeded: Task completed successfully
  • Failed: Task encountered an error
  • Cancelled: Task was manually cancelled

Synchronous Usage

When you have a TaskResponse object, you can poll it. Look at creating and getting a task for more information on how to get a TaskResponse object.

Asynchronous Usage

For async applications, use await:

Error Handling

By default, failed tasks i.e. task.status == "Failed" will not raise exceptions. You can configure this behavior using the raise_on_failure parameter when initializing the client: