Skip to content

Generative AI Engineer Associate · Domain 2: Data Preparation · 14% of the exam

Task 2.3: Choose the appropriate Python package to extract document content from provided source data and format; Define operations and sequence to write given chunked text into Delta Lake tables in Unity Catalog

Parsing PDFs, HTML, Office files and scanned images, ai_parse_document, and the steps from a volume of files to a chunked Delta table with change data feed ready for an AI Search index.

Study it

  • Parsing PDFs, HTML, Office files and images; writing chunks to Delta tables

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the Databricks documentation page that proves it.

Question 1 · choose 1

A help center is exported as thousands of HTML pages with navigation menus, cookie banners and footers around each article. The engineer needs the article body text for chunking. Which tool fits this source format?

  1. ABeautifulSoup, selecting the article element of each page
  2. Bai_parse_document on the HTML files after reading them with binaryFile
  3. Cpytesseract on screenshots rendered from each page
  4. DPyPDF2 after printing each page to a PDF file
Show the answer and why
  • ABeautifulSoup, selecting the article element of each page

    Correct

    HTML parsing libraries such as BeautifulSoup and lxml navigate the page structure and extract the elements you choose.

  • Bai_parse_document on the HTML files after reading them with binaryFile

    Incorrect

    ai_parse_document accepts PDF, image, Word and PowerPoint files; HTML is not among its supported input formats.

  • Cpytesseract on screenshots rendered from each page

    Incorrect

    OCR is for images and scanned documents; rendering HTML to images throws away structure the page already provides.

  • DPyPDF2 after printing each page to a PDF file

    Incorrect

    PyPDF2 reads PDFs; converting HTML to PDF first adds a lossy step and keeps the menus and footers.

Parsing tools depend on the data type: PDF and Word libraries for documents, HTML parsers for web pages, and OCR for images and scans. ai_parse_document covers PDF, JPG, PNG, TIFF, DOC/DOCX and PPT/PPTX.

Question 2 · choose 1

PDF manuals land in a Unity Catalog volume. The team wants a Delta Sync index with Databricks-managed embeddings on a standard AI Search endpoint. Which sequence of operations is correct?

  1. ARead the files with binaryFile, parse with ai_parse_document, chunk, write to a Delta table without a key column, create the index with the text column as primary key
  2. BCreate the index on the volume path first, then parse and chunk the files into it as they arrive
  3. CRead the files with binaryFile, parse with ai_parse_document, chunk with a stable chunk_id, write to a Delta table with change data feed on, create the index on chunk_id
  4. DRead the files with binaryFile, chunk the raw bytes, write to a Delta table with change data feed on, create the index on chunk_id
Show the answer and why
  • ARead the files with binaryFile, parse with ai_parse_document, chunk, write to a Delta table without a key column, create the index with the text column as primary key

    Incorrect

    The primary key must identify each row; chunk text is neither stable nor guaranteed unique, so updates and deletes cannot be synced.

  • BCreate the index on the volume path first, then parse and chunk the files into it as they arrive

    Incorrect

    A Delta Sync index is built from a source table, not a volume path, so the chunks must land in a table first.

  • CRead the files with binaryFile, parse with ai_parse_document, chunk with a stable chunk_id, write to a Delta table with change data feed on, create the index on chunk_id

    Correct

    ai_parse_document takes binary content, the chunk table needs a primary key, and standard endpoints require change data feed on the source table.

  • DRead the files with binaryFile, chunk the raw bytes, write to a Delta table with change data feed on, create the index on chunk_id

    Incorrect

    Raw PDF bytes are not text; parsing has to come before chunking.

Store files in a volume, read them as binary, parse them, chunk them with stable identifiers and write the chunks to a Delta table. For standard endpoints the source table must use change data feed before a Delta Sync index is created.

Question 3 · choose 1

ai_parse_document fails immediately on a 700-page annual report. The team needs only the first 300 pages. What should it set?

  1. Aversion set to 1.0
  2. BdescriptionElementTypes set to *
  3. CpageRange set to 1-300
  4. DimageOutputPath to a volume
Show the answer and why
  • Aversion set to 1.0

    Incorrect

    The output schema version does not change the page limit.

  • BdescriptionElementTypes set to *

    Incorrect

    This controls AI-generated figure descriptions, not page count.

  • CpageRange set to 1-300

    Correct

    pageRange restricts parsing to selected pages, which must stay within the 500-page limit.

  • DimageOutputPath to a volume

    Incorrect

    This saves page images; it does not reduce pages parsed.

If pageRange is omitted and a document exceeds 500 pages, ai_parse_document fails without parsing. pageRange takes single pages and inclusive ranges.

Question 4 · choose 1

A notebook on an older classic cluster cannot call ai_parse_document. What is the minimum Databricks Runtime version required?

  1. A11.3 LTS
  2. B13.3 LTS
  3. C15.4 LTS
  4. D17.3
Show the answer and why
  • A11.3 LTS

    Incorrect

    That version predates the function by several releases.

  • B13.3 LTS

    Incorrect

    This is below the stated requirement.

  • C15.4 LTS

    Incorrect

    15.4 LTS is the minimum for ai_query, not for ai_parse_document.

  • D17.3

    Correct

    ai_parse_document requires Databricks Runtime 17.3 or above.

ai_parse_document needs Databricks Runtime 17.3 or above; on serverless compute the environment version must be 3 or above.

Question 5 · choose 1

Engineering drawings full of figures make ai_parse_document slow and costly, and the team does not need figure descriptions. Which option reduces the cost?

  1. AdescriptionElementTypes set to an empty string
  2. BimageOutputPath set to a volume
  3. CdescriptionElementTypes set to figure so that only figures are described
  4. Dversion set to 2.0
Show the answer and why
  • AdescriptionElementTypes set to an empty string

    Correct

    An empty string generates no descriptions, which reduces compute and cost for documents with many figures.

  • BimageOutputPath set to a volume

    Incorrect

    Saving page images adds output rather than reducing work.

  • CdescriptionElementTypes set to figure so that only figures are described

    Incorrect

    This still generates descriptions for figures, which is the cost driver.

  • Dversion set to 2.0

    Incorrect

    Version 2.0 is the output schema; it does not turn descriptions off.

The descriptionElementTypes option controls AI-generated descriptions; the default * describes all supported elements, figure describes figures, and an empty string generates none.

Question 6 · choose 1

In ai_parse_document output (schema version 2.0), how is the content of a table element represented?

  1. AAs CSV text
  2. BAs HTML
  3. CAs a nested Delta table
  4. DAs an image only
Show the answer and why
  • AAs CSV text

    Incorrect

    The documented table format is HTML, not CSV.

  • BAs HTML

    Correct

    For version 2.0, tables are represented in HTML in the content field.

  • CAs a nested Delta table

    Incorrect

    The function returns a VARIANT value, not a table.

  • DAs an image only

    Incorrect

    Tables are extracted as content; images are for figures.

ai_parse_document returns VARIANT output with layout elements such as text, table, figure and headers. Table content is HTML; chart data in figures can be JSON.

Practice domain 2 →Practice all domains →