> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chunkr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Usage Patterns

> Optimize Chunkr configuration for your use case

Chunkr AI is designed to be configurable, so there probably exists a configuration that will work for your use case.
Here are some examples to get you started.

## Complex Documents with Extended Context

For documents with complex layouts where elements need surrounding context (such as tables with separate legends, charts with explanatory text, or images that need page context), enable extended context processing:

<CodeGroup>
  ```python Python theme={"system"}
  from chunkr_ai import Chunkr
  from chunkr_ai.models import (
      Configuration,
      GenerationConfig,
      GenerationStrategy,
      SegmentProcessing,
      SegmentFormat
  )

  chunkr = Chunkr()

  config = Configuration(
      segment_processing=SegmentProcessing(
          Table=GenerationConfig(
              format=SegmentFormat.MARKDOWN,
              strategy=GenerationStrategy.LLM,
              extended_context=True
          ),
          Picture=GenerationConfig(
              format=SegmentFormat.HTML,
              strategy=GenerationStrategy.LLM,
              extended_context=True
          ),
          Formula=GenerationConfig(
              format=SegmentFormat.MARKDOWN,
              strategy=GenerationStrategy.LLM,
              extended_context=True
          )
      )
  )

  chunkr.upload("path/to/file", config)

  ```

  ```bash cURL theme={"system"}
  curl -X POST https://api.chunkr.ai/api/v1/task/parse \
    -H "Authorization: YOUR_API_KEY" \
    -F file=@path/to/file \
    -F 'segment_processing={
        "Table": {
          "format": "Markdown",
          "strategy": "LLM",
          "extended_context": true
        },
        "Picture": {
          "format": "Html",
          "strategy": "LLM",
          "extended_context": true
        },
        "Formula": {
          "format": "Markdown",
          "strategy": "LLM",
          "extended_context": true
        }
      };type=application/json'
  ```
</CodeGroup>

## Pre-signed URLs and Base64 Alternatives

When retrieving tasks, Chunkr generates pre-signed URLs for accessing:

* Images
* Input File
* PDF File

These URLs expire after 10 minutes.
For longer persistence or storage, you can request base64-encoded URLs instead:

<CodeGroup>
  ```python Python theme={"system"}
  from chunkr_ai import Chunkr

  chunkr = Chunkr()

  # Get task with base64-encoded URLs instead of pre-signed URLs
  task = chunkr.get_task("task_123", base64_urls=True)
  ```

  ```bash cURL theme={"system"}
  curl -X GET "https://api.chunkr.ai/api/v1/task/{task_id}?base64_urls=true" \
    -H "Authorization: YOUR_API_KEY"
  ```
</CodeGroup>
