Skip to main content

Auto mode

When using auto_mode, LlamaParse will first parse documents using the standard mode, and if some condition are met will reparse specific pages of document in premium_mode=true.

To activate auto_mode you need to set it to true

In Python:
parser = LlamaParse(
  auto_mode=True
)
Using the API:
curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  --form 'auto_mode="true"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

Trigger on table

If you want to upgrade parsing of page to premium_mode when there is table in the page, set the boolean auto_mode_trigger_on_table_in_page to true.

In Python:
parser = LlamaParse(
  auto_mode_trigger_on_table_in_page=True
)
Using the API:
curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  --form 'auto_mode_trigger_on_table_in_page="true"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

Trigger on image

If you want to upgrade parsing of page to premium_mode when there is some images in the page, set the boolean auto_mode_trigger_on_image_in_page to true.

In Python:
parser = LlamaParse(
  auto_mode_trigger_on_image_in_page=True
)
Using the API:
curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  --form 'auto_mode_trigger_on_image_in_page="true"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

Trigger on regexp

If you want to upgrade parsing of page to premium_mode when a specific regexp is true on the content of the page, set the regexp in auto_mode_trigger_on_regexp_in_page. The regexp are in the ECMA262 format.

In Python:
parser = LlamaParse(
  auto_mode_trigger_on_regexp_in_page="/((total cost)|(tax))/g"
)
Using the API:
curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  --form 'auto_mode_trigger_on_regexp_in_page="true"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

Trigger on text

If you want to upgrade parsing of page to premium_mode when a specific text exist in the content of the page, set auto_mode_trigger_on_text_in_page to the desired value.

In Python:
parser = LlamaParse(
  auto_mode_trigger_on_text_in_page="total"
)
Using the API:
curl -X 'POST' \
  'https://api.cloud.llamaindex.ai/api/parsing/upload'  \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
  --form 'auto_mode_trigger_on_text_in_page="total"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'