Skip to content
LlamaParse 文档版本 跟随上游 源快照 3afdae65 更新于 2026-10-17

已弃用

本页记录的是已弃用的 Parse v1 API。新的接入请使用 Parse v2;改造已有的 v1 代码请见v1 到 v2 迁移指南。

在 llamaParse API 上结构化输出已弃用,请改用 LlamaExtract API。

关于结构化输出

结构化输出让你在解析阶段就直接从文档里抽出结构化数据(例如 JSON),从而省掉所需的时间与成本。

结构化输出目前只与我们的默认解析模式兼容,可通过在 API 里设 structured_output=True 来启用。

  • Python
  • API
parser = LlamaParse(
  structured_output=True
)

终端窗口

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 'structured_output="true"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

随后你需要提供下面二者之一:

  • 一份 JSON schema,放在 structured_output_json_schema 这个 API 变量里,它将用于按你想要的格式抽取数据
  • 或者把我们某个预定义 schema 的名字放在 structured_output_json_schema_name 变量里
  • Python(Schema)
  • API(Schema)
  • Python(Preset)
  • API(Preset)
parser = LlamaParse(
  structured_output_json_schema='A JSON SCHEMA'
)

终端窗口

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 'structured_output_json_schema="A JSON SCHEMA"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'
parser = LlamaParse(
  structured_output_json_schema_name="invoice"
)

终端窗口

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 'structured_output_json_schema_name="invoice"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

支持的预定义 schema

imFeelingLucky

通配 schema,让 LlamaParse 自行推断输出格式

  • API

终端窗口

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 'structured_output_json_schema_name="imFeelingLucky"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

Invoice

标准的发票 schema,含行项目、税额与合计

  • API
  • Invoice Schema

终端窗口

  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 'structured_output_json_schema_name="invoice"' \
    -F 'file=@/path/to/your/file.pdf;type=application/pdf'

结构化输出:Invoice Schema

类型:object

属性

  • invoiceNumber required

    • 发票的唯一标识
    • 类型:string
  • invoiceDate required

    • 发票的开具日期(ISO 格式)
    • 类型:string
    • 字符串格式必须是 “date”
  • dueDate

    • 付款到期日(ISO 格式)
    • 类型:string
    • 字符串格式必须是 “date”
  • billingAddress required

    • 账单地址详情

    • 类型:object

    • 属性

      • name required
        • 类型:string
      • street required
        • 类型:string
      • city required
        • 类型:string
      • state
        • 类型:string
      • postalCode required
        • 类型:string
      • country required
        • 类型:string
  • shippingAddress

    • 收货地址详情

    • 类型:object

    • 属性

      • name required
        • 类型:string
      • street required
        • 类型:string
      • city required
        • 类型:string
      • state
        • 类型:string
      • postalCode required
        • 类型:string
      • country required
        • 类型:string
  • items required

    • 发票所包含的行项目列表

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • description required

          • 该项目的描述
          • 类型:string
        • quantity required

          • 该项目的数量
          • 类型:number
          • 范围:≥ 1
        • unitPrice required

          • 该项目的单价
          • 类型:number
          • 范围:≥ 0
        • totalPrice required

          • 该项目的总价
          • 类型:number
          • 范围:≥ 0
  • subTotal required

    • 所有项目的合计小计
    • 类型:number
    • 范围:≥ 0
  • tax required

    • 税务详情

    • 类型:object

    • 属性

      • rate required

        • 以百分比表示的税率
        • 类型:number
        • 范围:≥ 0
      • amount required

        • 税额合计
        • 类型:number
        • 范围:≥ 0
  • total required

    • 应付总额(小计 + 税)
    • 类型:number
    • 范围:≥ 0
  • notes

    • 发票的附加说明或指示
    • 类型:string
  • status required

    • 发票当前的付款状态

    • 类型:string

    • 取值被限定为下面几种:

      1. “Paid”
      2. “Unpaid”
      3. “Overdue”

Resume

遵循 JSON Resume 标准

  • API
  • Resume Schema

终端窗口

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 'structured_output_json_schema_name="resume"' \
  -F 'file=@/path/to/your/file.pdf;type=application/pdf'

结构化输出:Resume Schema

基于 https://github.com/jsonresume/resume-schema

类型:object

属性

  • basics

    • 类型:object

    • 属性

      • name

        • 类型:string
      • label

        • 例如 网页开发者
        • 类型:string
      • image

        • 指向 JPEG 或 PNG 图片的 URL(依 RFC 3986)
        • 类型:string
      • email

      • phone

        • 电话号码以字符串保存,因此格式随意,例如 712-117-2923
        • 类型:string
      • url

        • 指向你网站的 URL(依 RFC 3986),例如个人主页
        • 类型:string
        • 字符串格式必须是 “uri”
      • summary

        • 写一段两三句话的个人简介
        • 类型:string
      • location

        • 类型:object

        • 属性

          • address

            • 类型:string
          • postalCode

            • 类型:string
          • city

            • 类型:string
          • countryCode

            • 按 ISO-3166-1 ALPHA-2 的代码,例如 US、AU、IN
            • 类型:string
          • region

            • 你所在的大致区域,例如美国的一个州或一个省
            • 类型:string
      • profiles

        • 指定你参与的任意多个社交网络

        • 类型:array

          • 元素

          • 类型:object

          • 该 schema 接受额外属性。

          • 属性

  • work

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • name

          • 例如 Facebook
          • 类型:string
        • location

          • 例如 Menlo Park, CA
          • 类型:string
        • description

          • 例如 Social Media Company
          • 类型:string
        • position

          • 例如 Software Engineer
          • 类型:string
        • url

        • startDate

        • endDate

        • summary

          • 概述你在这家公司承担的职责
          • 类型:string
        • highlights

          • 列出多项成果

          • 类型:array

            • 元素
            • 例如 通过病毒式广告让 2011-2012 年的利润增长 20%
            • 类型:string
  • volunteer

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • organization

          • 例如 Facebook
          • 类型:string
        • position

          • 例如 Software Engineer
          • 类型:string
        • url

        • startDate

        • endDate

        • summary

          • 概述你在这家公司承担的职责
          • 类型:string
        • highlights

          • 列出成果与成就

          • 类型:array

            • 元素
            • 例如 通过病毒式广告让 2011-2012 年的利润增长 20%
            • 类型:string
  • education

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • institution

          • 例如 Massachusetts Institute of Technology
          • 类型:string
        • url

        • area

          • 例如 艺术
          • 类型:string
        • studyType

          • 例如 学士
          • 类型:string
        • startDate

        • endDate

        • score

          • 平均绩点,例如 3.67/4.0
          • 类型:string
        • courses

          • 列出有分量的课程或科目

          • 类型:array

            • 元素
            • 例如 H1302 - 美国史导论
            • 类型:string
  • awards

    • 列出你的职业生涯中获得的全部奖项

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • title

          • 例如 本世纪百大最强大脑之一
          • 类型:string
        • date

        • awarder

          • 例如 Time Magazine
          • 类型:string
        • summary

          • 例如 因量子物理方面的工作而获得
          • 类型:string
  • certificates

    • 列出你的职业生涯中获得的全部证书

    • 类型:array

      • 元素

      • 类型:object

      • 该 schema 接受额外属性。

      • 属性

        • name

          • 例如 Certified Kubernetes Administrator
          • 类型:string
        • date

        • url

        • issuer

          • 例如 CNCF
          • 类型:string
  • publications

  • skills

    • 列出你的专业技能

    • 类型:array

      • 元素

      • 类型:object

      • 该 schema 接受额外属性。

      • 属性

        • name

          • 例如 网页开发
          • 类型:string
        • level

          • 例如 精通
          • 类型:string
        • keywords

          • 列出与该技能相关的若干关键词

          • 类型:array

            • 元素
            • 例如 HTML
            • 类型:string
  • languages

    • 列出你会说的其他语言

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • language

          • 例如 英语、西班牙语
          • 类型:string
        • fluency

          • 例如 流利、入门
          • 类型:string
  • interests

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • name

          • 例如 哲学
          • 类型:string
        • keywords

          • 类型:array

            • 元素
            • 例如 Friedrich Nietzsche
            • 类型:string
  • references

    • 列出你获得过的推荐

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • name

          • 例如 Timothy Cook
          • 类型:string
        • reference

          • 例如 “Joe blogs 是一位出色的员工,每周至少来上一次班。在什么都不干这件事上,他的表现远超我的预期。”
          • 类型:string
  • projects

    • 列出职业期间的项目

    • 类型:array

      • 元素

      • 类型:object

      • 属性

        • name

          • 例如 The World Wide Web
          • 类型:string
        • description

          • 项目的简短摘要。例如 2017 年作品合集。
          • 类型:string
        • highlights

          • 列出多项特性

          • 类型:array

            • 元素
            • 例如 Directs you close but not quite there
            • 类型:string
        • keywords

          • 列出涉及的特别要素

          • 类型:array

            • 元素
            • 例如 AngularJS
            • 类型:string
        • startDate

        • endDate

        • url

        • roles

          • 说明你在这个项目或公司里的角色

          • 类型:array

            • 元素
            • 例如 团队负责人、讲师、作者
            • 类型:string
        • entity

          • 说明相关的公司或组织归属,例如 ‘greenpeace’、‘corporationXYZ’
          • 类型:string
        • type

          • _例如 ‘volunteering’、‘presentation’、‘talk’、‘application’、‘conference’_
          • 类型:string

BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。