Configuration Options
Overview of configuration options for LlamaExtract, including extraction modes, system prompts, and extraction targets.
When creating a new extraction configuration, the schema is the most important part. However, there are a few other options that can significantly impact the extraction process.
Schema Alignment and Extraction Target
Section titled “Schema Alignment and Extraction Target”These options determine how your schema is applied to the document:
-
Extraction Target: Determines the scope and granularity of extraction. Available options:
per_doc(default): Schema is applied to the entire document, returns a single JSON objectper_page: Schema is applied to each page independently, returns an array of JSON objects (one per page)per_table_row: Schema is applied to each entity in an ordered list (table rows, bulleted lists, etc.), returns an array of JSON objects (one per entity)
See the Core Concepts page for detailed guidance on when to use each mode.
Important Settings
Section titled “Important Settings”Extract tiers determine how much effort LlamaExtract puts into producing structured data from a document.
Agentic Plus provides the highest extraction quality across document types, including short or straightforward documents. Use it when you want the best result and can accept higher cost and latency. It may take longer on long or complex documents as it puts more iterative effort into the result. It also supports the largest schemas (up to 3,200 fields); schemas above 200 fields incur a per-page credit multiplier — see pricing.
Agentic balances quality, cost, and latency across a broad range of documents, including mixed layouts and tables.
Cost Effective prioritizes lower cost and latency for straightforward extraction, especially at high volume. It works best when fields and layouts are predictable and ambiguity is limited.
Each extract tier has a default parse tier chosen to balance cost and quality. You can override the parse tier in Advanced Settings when your workload needs lower parsing cost or higher-quality document interpretation. See pricing for the default combinations and additive costs.
Versions
Section titled “Versions”All tiers use the same version convention. Use latest while evaluating changes, then pin the resolved date in production. latest selects the newest version compatible with the requested options, while a date selects the newest release for that tier on or before the date.
Advanced Settings
Section titled “Advanced Settings”Under Advanced Settings in the UI you can fine-tune how extraction runs:
- Parse tier: Select the parsing tier used to interpret the input document before extraction. This uses the same v2 parse tiers as LlamaParse (for example,
cost_effective,agentic, andagentic_plus). See Tiers for details. - Cite sources: Enable cite sources to attach citations to extracted fields so you can trace every value back to its origin in the document.
- Confidence scores: Enable confidence scores to get per-field confidence signals alongside extracted output.
- System prompt: Provide a system prompt to globally guide the extractor (for example, “Prefer the most recent fiscal year if multiple are present”, or “Return numbers as plain numerals without currency symbols”).
System Prompt
Section titled “System Prompt”- System Prompt: Any additional system level instructions for the extraction. Note that you should use the schema descriptions to pass field-level instructions, few-shot examples, formatting instructions, etc.
Page Range and Context Window
Section titled “Page Range and Context Window”-
Page Range: Specify which pages to extract from by providing comma-separated page numbers or ranges (1-based indexing). For example, use
1,3,5-7,9to extract pages 1, 3, pages 5 through 7, and page 9. You can also use ranges like1-3,8-10to extract the first three pages and pages 8 through 10. Page numbers are 1-based, meaning the first page is page 1. This option is useful when you only need to extract data from specific sections of large documents. -
Context Window: Number of pages to pass as context for long document extraction. This is useful when extracting from large documents where you need context from surrounding pages. This is configurable via the extraction tier and system prompt. Larger values keep more of the surrounding document intact, which helps when you need to see multi-page tables or invoices in one pass. Smaller values advance through the file more aggressively and are better when you need exhaustive coverage of dense lists.
Metadata Extensions
Section titled “Metadata Extensions”For additional extraction features that provide enhanced metadata and insights, see the Metadata Extensions page which covers:
- Citations: Source tracing for extracted fields
- Confidence Scores: Quantitative confidence measures
These extensions return additional metadata in the extract_metadata field but may impact processing time.
Setting Configuration Options
Section titled “Setting Configuration Options”You can configure these options when creating an extraction job using either the REST API or Python SDK.
First, install the Python SDK:
pip install llama-cloud>=2.1Here’s how to set various configuration options:
import timefrom llama_cloud import LlamaCloud, AsyncLlamaCloud
client = LlamaCloud(api_key="your_api_key")
schema = { "type": "object", "properties": { "company_name": {"type": "string", "description": "Name of the company"}, "revenue": {"type": "number", "description": "Annual revenue in USD"} }}
file_obj = client.files.create(file="path/to/your/document.pdf", purpose="extract")file_id = file_obj.id
job = client.extract.create( file_input=file_id, configuration={ "data_schema": schema, "extraction_target": "per_doc", # per_doc, per_page, per_table_row "tier": "agentic", # cost_effective, agentic, agentic_plus "version": "2026-03-31", # Pin behavior to the latest release available on this date "system_prompt": "Focus on the most recent financial data", "target_pages": "1-5,10-15", # Extract from specific pages "cite_sources": True, # Enable citations "confidence_scores": True, # Enable confidence scores },)
# Poll for completionwhile job.status not in ("COMPLETED", "FAILED", "CANCELLED"): time.sleep(2) job = client.extract.get(job.id)First, install the TypeScript SDK:
npm install @llamaindex/llama-cloud zodHere’s how to set various configuration options:
import fs from 'fs';import LlamaCloud from '@llamaindex/llama-cloud';
const client = new LlamaCloud({ apiKey: 'your_api_key',});
const schema = { type: 'object', properties: { company_name: { type: 'string', description: 'Name of the company' }, revenue: { type: 'number', description: 'Annual revenue in USD' }, },};
const fileObj = await client.files.create({ file: fs.createReadStream('path/to/your/document.pdf'), purpose: 'extract',});const fileId = fileObj.id;
let job = await client.extract.create({ file_input: fileId, configuration: { data_schema: schema, extraction_target: 'per_doc', // per_doc, per_page, per_table_row tier: 'agentic', // cost_effective, agentic, agentic_plus version: '2026-03-31', // Pin behavior to the latest release available on this date system_prompt: 'Focus on the most recent financial data', target_pages: '1-5,10-15', // Extract from specific pages cite_sources: true, // Enable citations confidence_scores: true, // Enable confidence scores },});
// Poll for completionwhile (!['COMPLETED', 'FAILED', 'CANCELLED'].includes(job.status)) { await new Promise((r) => setTimeout(r, 2000)); job = await client.extract.get(job.id);}First, install the Go SDK:
go get github.com/run-llama/llama-parse-goHere’s how to set various configuration options:
package main
import ( "context" "fmt" "log" "os" "time"
llamacloud "github.com/run-llama/llama-parse-go")
func main() { ctx := context.Background() client := llamacloud.NewClient()
// Define schema as a JSON Schema literal dataSchema := map[string]*llamacloud.ExtractConfigurationDataSchemaUnionParam{ "type": {OfString: llamacloud.String("object")}, "properties": {OfAnyMap: map[string]any{ "company_name": map[string]any{"type": "string", "description": "Name of the company"}, "revenue": map[string]any{"type": "number", "description": "Annual revenue in USD"}, }}, }
f, err := os.Open("path/to/your/document.pdf") if err != nil { log.Fatal(err) } defer f.Close()
fileObj, err := client.Files.New(ctx, llamacloud.FileNewParams{ File: f, Purpose: "extract", }) if err != nil { log.Fatal(err) }
job, err := client.Extract.New(ctx, llamacloud.ExtractNewParams{ ExtractV2JobCreate: llamacloud.ExtractV2JobCreateParam{ FileInput: fileObj.ID, Configuration: llamacloud.ExtractConfigurationParam{ DataSchema: dataSchema, ExtractionTarget: llamacloud.ExtractConfigurationExtractionTargetPerDoc, // per_doc, per_page, per_table_row Tier: llamacloud.ExtractConfigurationTierAgentic, // cost_effective, agentic Version: llamacloud.String("2026-03-31"), // Pin behavior to the latest release available on this date SystemPrompt: llamacloud.String("Focus on the most recent financial data"), TargetPages: llamacloud.String("1-5,10-15"), // Extract from specific pages CiteSources: llamacloud.Bool(true), // Enable citations ConfidenceScores: llamacloud.Bool(true), // Enable confidence scores }, }, }) if err != nil { log.Fatal(err) }
// Poll for completion for job.Status != "COMPLETED" && job.Status != "FAILED" && job.Status != "CANCELLED" { time.Sleep(2 * time.Second) job, err = client.Extract.Get(ctx, job.ID, llamacloud.ExtractGetParams{}) if err != nil { log.Fatal(err) } }
fmt.Println(job.ExtractResult.RawJSON())}First, install the Java SDK:
implementation("ai.llamaindex:llama-cloud:1.3.0")Here’s how to set various configuration options:
import ai.llamaindex.llamacloud.client.LlamaCloudClient;import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClient;import ai.llamaindex.llamacloud.core.JsonValue;import ai.llamaindex.llamacloud.models.extract.ExtractConfiguration;import ai.llamaindex.llamacloud.models.extract.ExtractCreateParams;import ai.llamaindex.llamacloud.models.extract.ExtractGetParams;import ai.llamaindex.llamacloud.models.extract.ExtractV2Job;import ai.llamaindex.llamacloud.models.extract.ExtractV2JobCreate;import ai.llamaindex.llamacloud.models.files.FileCreateParams;import ai.llamaindex.llamacloud.models.files.FileCreateResponse;import java.nio.file.Paths;import java.util.HashMap;import java.util.Map;
LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv();
// Define schema as a JSON Schema literalMap<String, Object> companyNameField = new HashMap<>();companyNameField.put("type", "string");companyNameField.put("description", "Name of the company");
Map<String, Object> revenueField = new HashMap<>();revenueField.put("type", "number");revenueField.put("description", "Annual revenue in USD");
Map<String, Object> properties = new HashMap<>();properties.put("company_name", companyNameField);properties.put("revenue", revenueField);
ExtractConfiguration.DataSchema dataSchema = ExtractConfiguration.DataSchema.builder() .putAdditionalProperty("type", JsonValue.from("object")) .putAdditionalProperty("properties", JsonValue.from(properties)) .build();
// Upload a file to extract fromFileCreateResponse fileObj = client.files().create( FileCreateParams.builder() .file(Paths.get("path/to/your/document.pdf")) .purpose("extract") .build());
ExtractV2Job job = client.extract().create( ExtractCreateParams.builder() .extractV2JobCreate( ExtractV2JobCreate.builder() .fileInput(fileObj.id()) .configuration( ExtractConfiguration.builder() .dataSchema(dataSchema) .extractionTarget(ExtractConfiguration.ExtractionTarget.PER_DOC) .tier(ExtractConfiguration.Tier.AGENTIC) .version("2026-03-31") .systemPrompt("Focus on the most recent financial data") .targetPages("1-5,10-15") .citeSources(true) .confidenceScores(true) .build()) .build()) .build());
// Poll for completionwhile (!job.status().equals("COMPLETED") && !job.status().equals("FAILED") && !job.status().equals("CANCELLED")) { Thread.sleep(2000); job = client.extract().get(ExtractGetParams.builder().jobId(job.id()).build());}
System.out.println(job.extractResult());First, install the CLI:
go install github.com/run-llama/llama-parse-cli/cmd/llp@latestHere’s how to set various configuration options:
# Define schema as a JSON Schema literalDATA_SCHEMA='{ "type": "object", "properties": { "company_name": {"type": "string", "description": "Name of the company"}, "revenue": {"type": "number", "description": "Annual revenue in USD"} }}'
# Upload a file to extract fromFILE_ID=$(llp files create --file path/to/your/document.pdf --purpose extract | jq -r '.id')
# Set various configuration optionsJOB_ID=$(llp extract create \ --file-input "$FILE_ID" \ --configuration "{\"data_schema\": $DATA_SCHEMA, \"extraction_target\": \"per_doc\", \"tier\": \"agentic\", \"version\": \"2026-03-31\", \"system_prompt\": \"Focus on the most recent financial data\", \"target_pages\": \"1-5,10-15\", \"cite_sources\": true, \"confidence_scores\": true}" \ | jq -r '.id')
# Poll for completionwhile true; do JOB=$(llp extract get --job-id "$JOB_ID") STATUS=$(echo "$JOB" | jq -r '.status') case "$STATUS" in COMPLETED|FAILED|CANCELLED) break ;; esac sleep 2done
echo "$JOB" | jq '.extract_result'REST API
Section titled “REST API”You can configure these options using the REST API when creating an extraction job:
curl -X 'POST' \ 'https://api.cloud.llamaindex.ai/api/v2/extract?project_id={PROJECT_ID}' \ -H 'accept: application/json' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "file_input": "{FILE_ID}", "configuration": { "data_schema": { "type": "object", "properties": { "company_name": {"type": "string", "description": "Name of the company"}, "revenue": {"type": "number", "description": "Annual revenue in USD"} } }, "extraction_target": "per_doc", "tier": "agentic", "version": "2026-03-31", "system_prompt": "Focus on the most recent financial data", "target_pages": "1-5,10-15", "cite_sources": true, "confidence_scores": true } }'Configuration Reference
Section titled “Configuration Reference”| Option | Type | Default | Description |
|---|---|---|---|
| Schema Alignment | |||
extraction_target | string | ”per_doc” | Extraction scope: per_doc, per_page, per_table_row. Agentic Plus supports per_doc only. |
| Tier | |||
tier | string | ”agentic” | Extraction tier: cost_effective, agentic (default), agentic_plus |
version | string | ”latest” | Extract algorithm version. Use “latest” during development or pin to a date in YYYY-MM-DD format for stable production behavior. |
| System Prompt | |||
system_prompt | string | null | Additional system-level instructions |
| Page Range and Context | |||
target_pages | string | null | Comma-separated page numbers or ranges to process (1-based, e.g., “1,3,5-7”). Pages are processed in the order listed, so “3,1,2” feeds page 3 first, then 1, then 2. |
max_pages | integer | null | Maximum number of pages to process |
| Metadata Extensions | |||
cite_sources | boolean | false | Enable source citations |
confidence_scores | boolean | false | Enable confidence scores |