Custom Prompt
The custom prompt option allows you to provide custom instructions for AI-powered parsing. This option is only available for agentic tiers (cost_effective, agentic, and agentic_plus).
Configuration
Section titled âConfigurationâUse agentic_options.custom_prompt to configure this option.
Provide a custom prompt to guide the AI model during parsing:
{ "tier": "agentic", "version": "latest", "agentic_options": { "custom_prompt": "Extract all financial data and format tables with currency symbols." }}Examples
Section titled âExamplesâDocument-Specific Instructions
Section titled âDocument-Specific Instructionsâ{ "tier": "agentic_plus", "version": "latest", "agentic_options": { "custom_prompt": "This is a legal contract. Pay special attention to dates, parties involved, and monetary amounts." }}Formatting Instructions
Section titled âFormatting Instructionsâ{ "tier": "cost_effective", "version": "latest", "agentic_options": { "custom_prompt": "Format all headings consistently and preserve the original document hierarchy." }}Complete API Request Example
Section titled âComplete API Request Exampleâcurl -X 'POST' \ 'https://api.cloud.llamaindex.ai/api/v2/parse' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \ --data '{ "file_id": "<file_id>", "tier": "agentic_plus", "version": "latest", "agentic_options": { "custom_prompt": "Extract all tables and ensure numerical data is properly formatted." } }'from llama_cloud import LlamaCloud
client = LlamaCloud(api_key="LLAMA_CLOUD_API_KEY")
result = client.parsing.parse( upload_file="example_file.pdf", tier="agentic_plus", version="latest", agentic_options={ "custom_prompt": "Extract all tables and ensure numerical data is properly formatted." }, expand=["markdown"],)import fs from "fs";import { LlamaCloud } from "@llamaindex/llama-cloud";
const client = new LlamaCloud({ apiKey: "LLAMA_CLOUD_API_KEY",});
const result = await client.parsing.parse({ upload_file: fs.createReadStream('example_file.pdf'), tier: "agentic_plus", version: "latest", agentic_options: { custom_prompt: "Extract all tables and ensure numerical data is properly formatted." }, expand: ["markdown"],});Note: This option is not available for the
fasttier, which does not use AI models.