SnowPro Specialty: Gen AI Question 147
Single answerCORTEX_PARSE_DOCUMENTA financial services team stores quarterly statement PDFs in an internal stage and wants to extract the text so it can be chunked and embedded for RAG in Snowflake. They need a solution that runs directly in Snowflake SQL without building a custom OCR pipeline or moving files to another platform. Which approach best meets this requirement using CORTEX_PARSE_DOCUMENT?
- A
Call SNOWFLAKE.CORTEX.PARSE_DOCUMENT on each staged PDF file and use the returned extracted content as the source for downstream chunking and embedding.
- B
Use SNOWFLAKE.CORTEX.COMPLETE to read each PDF directly from the stage and return structured text for chunking.
- C
Convert the PDFs to vectors first with SNOWFLAKE.CORTEX.EMBED_TEXT_768, then reconstruct the document text from the embeddings for RAG.
- D
Create an external function that sends every PDF to a third-party OCR service, because CORTEX_PARSE_DOCUMENT cannot process staged documents in Snowflake.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use SNOWFLAKE.CORTEX.PARSE_DOCUMENT on files stored in a Snowflake stage, then feed the extracted output into later RAG steps such as chunking and embedding. This is the most direct and maintainable approach when the goal is to keep document extraction inside Snowflake and avoid custom preprocessing services. In Snowflake Cortex, parsing and generation are separate concerns: PARSE_DOCUMENT handles document extraction, COMPLETE handles LLM generation, and EMBED_TEXT_* functions create vectors from already-available text. This distinction is important in real implementations and is consistent with Snowflake best practices for building in-platform GenAI pipelines.
- A. Correct.
Correct. CORTEX_PARSE_DOCUMENT is intended to parse supported document files, such as PDFs, from a Snowflake stage and return extracted content that can then be used in downstream GenAI workflows like chunking, embedding, and retrieval. This matches the requirement to keep processing in Snowflake SQL and avoid a separate OCR pipeline.
- B. Incorrect.
Incorrect. SNOWFLAKE.CORTEX.COMPLETE is a text generation function for prompting language models; it is not the function used to parse a staged PDF document into extracted text. A common misconception is to treat COMPLETE as a catch-all ingestion tool, but document parsing should be done first with the dedicated parsing capability.
- C. Incorrect.
Incorrect. Embedding functions convert text into vector representations; they do not parse binary PDF files or recreate readable source text from vectors. This option reflects a misunderstanding of the purpose of embeddings in a RAG pipeline.
- D. Incorrect.
Incorrect. While external OCR services are sometimes used in broader architectures, this does not best meet the stated requirement. CORTEX_PARSE_DOCUMENT is specifically designed so teams can parse supported staged documents directly in Snowflake without building a custom external OCR workflow.