Skip to content
Lucas Lessa
Voltar para as notícias
DatabricksAtualizaçãoImpacto: Médio

ai_parse_document function now extracts chart data as structured JSON

The ai_parse_document function now extracts chart values from unstructured documents as structured JSON detailing series, legends, and axes.

O que mudou

The ai_parse_document function converts unstructured documents into VARIANT-formatted elements. Chart elements identified as figures now also return chart data as structured JSON within the content, making it easier to use in search and AI agents.

Use cases

Imagine you have PDF reports with financial performance charts and need to feed a search database with those numbers.

  • Extract series data, legends, and axes from charts inside documents.
  • Integrate visual chart information with search and AI agents.
  • Process files such as PDF, DOCX, and images in Databricks pipelines.

How to use

Below is an example of applying the function to binary files stored in a Unity Catalog volume:

SELECT
  path,
  ai_parse_document(
    content,
    map(
      'version', '2.0',
      'imageOutputPath', '/Volumes/catalog/schema/volume/directory/',
      'descriptionElementTypes', '*'
    )
  ) as parsed_doc
FROM READ_FILES('/Volumes/data/documents/', format => 'binaryFile');

What happens in this code:

  1. Reads binary files from the specified directory using the READ_FILES function.
  2. Applies the ai_parse_document function specifying schema version 2.0.
  3. Saves rendered page images into the specified Unity Catalog volume.
  4. Returns the full document structure in VARIANT format, including charts converted to JSON.

Limitations and requirements

  • Requires Databricks Runtime 17.3 or higher.
  • If using serverless compute, the serverless environment version must be set to 3 or higher.
  • Available only in selected regions with AI function support.
  • Input files must be stored as binary data (BINARY), such as reads from volumes using the binaryFile format.
Ver nota oficial do Databricks

ai_parse_document now extracts chart data as JSON

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas