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?
ABeautifulSoup, selecting the article element of each page
Bai_parse_document on the HTML files after reading them with binaryFile
Cpytesseract on screenshots rendered from each page
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.
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?
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
BCreate the index on the volume path first, then parse and chunk the files into it as they arrive
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
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.
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?
AdescriptionElementTypes set to an empty string
BimageOutputPath set to a volume
CdescriptionElementTypes set to figure so that only figures are described
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.
In ai_parse_document output (schema version 2.0), how is the content of a table element represented?
AAs CSV text
BAs HTML
CAs a nested Delta table
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.