主题
已弃用
本页记录的是已弃用的 Parse v1 API。新的接入请使用 Parse v2;改造已有的 v1 代码请见v1 到 v2 迁移指南。
LlamaParse 提供多种解析模式与预设,以适应你的场景。
Cost-effective
cost-effective 模式很适合日常文档 —— 里面图片、表格与文字混杂,而它无需任何额外配置就能给出可靠的排版。
背后的机制
cost-effective 是为更标准的文档(版式简单)设计的,也适合输出准确度并非关键的海量文档批处理。它让你在保住整体效果的同时,把 credit 省下来用在别的任务上。
要用 cost-effective,请设置以下参数:
- Python
- API
parser = LlamaParse(
api_key="<you-api-key>", # See how to get your API key at https://developers.llamaindex.ai/llamaparse/general/api_key/
parse_mode="parse_page_with_llm", # The parsing mode
high_res_ocr=True, # Whether to use high resolution OCR (slower but more precise)
adaptive_long_table=True, # Adaptive long table. LlamaParse will try to detect long table and adapt the output
outlined_table_extraction=True, # Whether to try to extract outlined tables
output_tables_as_HTML=True, # Whether to output tables as HTML in the markdown output
)终端窗口
curl -X POST 'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'parse_mode="parse_page_with_llm"' \
--form 'high_res_ocr="true"' \
--form 'adaptive_long_table="true"' \
--form 'outlined_table_extraction="true"' \
--form 'output_tables_as_HTML="true"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'Agentic
agentic 模式为多数含示意图与图片的文档而设计。它在绝大多数文档上能以合理的价格给出很好质量,但面对复杂版式或图表可能会吃力。
背后的机制
agentic 模式会做 OCR、抽取图片,并识别表格与标题等结构元素。它还会把公式以 LaTeX 输出、把示意图转换成 Mermaid 语法,便于进一步分析与可视化。
要用 agentic,请设置以下参数:
- Python
- API
parser = LlamaParse(
api_key="<you-api-key>", # See how to get your API key at https://developers.llamaindex.ai/llamaparse/general/api_key
parse_mode="parse_page_with_agent", # The parsing mode
model="gemini-2.5-flash", # The model to use
high_res_ocr=True, # Whether to use high resolution OCR (slower but more precise)
adaptive_long_table=True, # Adaptive long table. LlamaParse will try to detect long table and adapt the output
outlined_table_extraction=True, # Whether to try to extract outlined tables
output_tables_as_HTML=True, # Whether to output tables as HTML in the markdown output
)终端窗口
curl -X POST 'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'parse_mode="parse_page_with_agent"' \
--form 'model="gemini-2.5-flash"' \
--form 'high_res_ocr="true"' \
--form 'adaptive_long_table="true"' \
--form 'outlined_table_extraction="true"' \
--form 'output_tables_as_HTML="true"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'Agentic Plus
Agentic Plus 模式为复杂、高度排版的文档而生 —— 例如扫描的财务报告、科研论文,以及任何含图表、表格与示意图的文档。它给出最准确、最结构化的结果。
背后的机制
Agentic Plus 在 agentic 的全部能力之上结合了更强的处理能力与更好的模型,能应付最棘手的文档版式,在复杂表格、图表与多栏版式上提供更佳的准确度。
要用 agentic plus,请设置以下参数:
- Python
- API
parser = LlamaParse(
api_key="<you-api-key>", # See how to get your API key at https://developers.llamaindex.ai/llamaparse/general/api_key
parse_mode="parse_page_with_agent", # The parsing mode
model="anthropic-sonnet-4.5", # The model to use
high_res_ocr=True, # Whether to use high resolution OCR (slower but more precise)
adaptive_long_table=True, # Adaptive long table. LlamaParse will try to detect long table and adapt the output
outlined_table_extraction=True, # Whether to try to extract outlined tables
output_tables_as_HTML=True, # Whether to output tables as HTML in the markdown output
)终端窗口
curl -X POST 'https://api.cloud.llamaindex.ai/api/v1/parsing/upload' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--form 'parse_mode="parse_page_with_agent"' \
--form 'model="anthropic-sonnet-4.5"' \
--form 'high_res_ocr="true"' \
--form 'adaptive_long_table="true"' \
--form 'outlined_table_extraction="true"' \
--form 'output_tables_as_HTML="true"' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'按场景的预设
按场景的预设是有版本的。用 -latest 后缀调用、或直接不带后缀调用,都能拿到该预设的最新版。
发票
面向发票与收据。在 API 上设 preset="invoice"。当前版本是 invoice-v-1。
科研论文
面向科研论文。在 API 上设 preset="scientific"。当前版本是 scientific-v-1。
技术文档
面向含原理图的技术文档。在 API 上设 preset="technicalDocumentation"。当前版本是 technicalDocumentation-v-1。
把文档中存在的原理图按下面这种 XML 格式输出到 markdown 里:
<schematic>
<bbox>0.1,0.1,0.9,0.9</bbox>
<caption>Caption of the schematic (if present)</caption>
<schematic_elements>
<element>
<type>Type of the element (e.g. resistor, capacitor, etc.)</type>
<value>Value of the element (e.g. 10k, 100uF, etc.)</value>
<position>x,y</position>
<label>Label of the element (if present)</label>
</element>
<!-- Repeat for each element in the schematic -->
</schematic_elements>
</schematic>表单
面向表单与问卷。在 API 上设 preset="forms"。当前版本是 forms-v-1。
把表单字段以表格输出到 markdown,列为 Field Name、Field Type、Field Value。
| Field Name | Field Type | Field Value |
| ------------------------------ | ------------ | ---------------------------------------- |
| A checkbox | Checkbox | Unchecked |
| Another checkbox | Checkbox | Checked |
| Number of Thin | Text | 1 |
| Name of tool | Text | LlamaParse |
| Date review | Date | 24/06/2024 |
| Contractor | Signature | John Doe |
| Available | Radio | Yes |