【Snowflake】Extracting Data from PDFs with AI_EXTRACT
Introduction
Hello.
When you are looking to start using Snowflake Intelligence, the first major hurdle is data preparation.
Working with unstructured data such as PDFs or images is especially challenging, and if you pass them directly to an AI model, it often struggles to fully understand the document’s structure or meaning.
So in this article, we’ll walk through the process of extracting specific fields from unstructured data and converting them into a table.
What Is Snowflake Intelligence?
Let’s take a moment to clarify how Snowflake Intelligence and the AI_EXTRACT function fit within Cortex AI, which is Snowflake’s umbrella framework for its AI and LLM capabilities.

引用:Snowflake公式 Snowflake Cortex AI
In the diagram above, Snowflake Intelligence falls under the “Agent Apps” category.
You can think of it as the interface layer within Cortex AI—the part that enables agents to run and interact with your data.
Meanwhile, the AI_EXTRACT function we’re covering today belongs to the “Document Processing” category.
This part of Cortex AI focuses on extracting the information you need from unstructured files like PDFs and images.
In the previous article, we built a simple chatbot using the GUI, but today’s main topic is the step that comes before that — data preparation. 🌟
To add one more note:
By preparing your data with AI_EXTRACT and then combining it with Snowflake Intelligence, you can build more accurate natural-language queries and smarter agent applications.
Introducing AI_EXTRACT
Snowflake provides several functions for invoking AI and performing document analysis, and this time, we’ll take a look at AI_EXTRACT ― a function designed to extract specific fields from unstructured data.
According to the official documentation, AI_EXTRACT has two main capabilities:
• It can precisely extract targeted information such as “Meeting Date” or “Participants.”
• supports simple QA-style categorization (labeling).
Now, let’s get started.
Extracting Information from a Meeting PDF
For this example, we’ll use a publicly available PDF of meeting minutes from the Consumer Affairs Agency (Japan):
We’ll extract two types of information:
- Extract factual details written in the document, such as “Meeting Name,” “Date,” and “Organizer.”
- Content-based insights that require understanding the document, such as “Issues” and “Proposed Measures.”
Procedural Overview
First, create the database and stage you’ll use.
In this example, we manually uploaded the meeting PDF from our local machine into the stage.
CREATE DATABASE IF NOT EXISTS ai_extract;
USE SCHEMA ai_extract.public;
CREATE OR REPLACE STAGE files_stage
Next, let’s try using AI_EXTRACT.
In this example, we’ll extract values by specifying a column name and its corresponding question in the format: [column name, question]
SELECT
ai_extract(
file => TO_FILE('@files_stage', 'meeting_materials.pdf'),
responseFormat => [
['会議名', 'この資料の会議名は何ですか?'],
['日付', '開催日(発行日)を教えてください。'],
['課題', '資料で指摘されている主要な課題を箇条書きで教えてください。'],
['対策案', '提示されている対策・提言・施策案を箇条書きで教えてください。'],
['実施主体', 'どの省庁が実施していますか']]
) AS qa;
Here are the results:
{
"error": null,
"response": {
"実施主体": "消費者庁",
"会議名": "第3期消費者教育推進会議",
"対策案": [
"① 学校現場において、広く活用を促すため、伝えたいことを凝縮した単ページの教材やプレゼンテーション用ソフトを活用した教材を開発していくべきである。",
"② 消費者庁が運営する消費者教育ポータルサイトについて、消費者教育の実践例の収集と発信及び消費者教育問題等の解説や消費者教育の素材となる情報発信、利用者目線に立ったウェブサイトの構成に留意しながら、同サイトを全面的に見直すべきである。"
],
"日付": "令和元年7月26日",
"課題": [
"若年者の消費者教育",
"消費者の特性に配慮した体系的な消費者教育の推進",
"高度情報通信ネットワーク社会の発展に対応した消費者教育の推進"
]
}
}
The fields like meeting name, date, organizing body, and key issues were extracted perfectly.
On the other hand, fields such as countermeasures contain some awkward phrasing and missing objects in the generated sentences.
AI_EXTRACT seems best suited for straightforward extraction and classification, rather than long-form summarization.
At this stage, it works most effectively when extracting content exactly as written in the source document.
Also, since Snowflake’s LLM operates primarily in English, Japanese text is translated internally during processing.
Some nuances may be lost in this translation step, which can affect accuracy.
Finally, assuming an existing table (MEETING_SUMMARY),
we’ll use INSERT INTO to complete the process—from extracting data from the PDF to storing it as a structured table.
INSERT INTO MEETING_SUMMARY (
"会議名",
"日付",
"課題",
"対策案",
"実施主体"
)
SELECT
result:"response":"会議名" AS "会議名",
result:"response":"日付" AS "日付",
result:"response":"課題" AS "課題",
result:"response":"対策案" AS "対策案",
result:"response":"実施主体" AS "実施主体"
FROM (
SELECT AI_EXTRACT(
file => TO_FILE('@files_stage', 'meeting_materials.pdf'),
responseFormat => [
['会議名', 'この資料の会議名(または部会名)は何ですか?'],
['日付', '開催日(発行日)を教えてください。'],
['課題', '資料で指摘されている主要な課題を、重要度順に3点以内で箇条書きしてください。'],
['対策案', '提示されている対策・提言・施策案は何ですか?箇条書きで。'],
['実施主体', '想定される実施主体(省庁・事業者・消費者など)は誰ですか?']
]
) AS result
) AS t;
SELECT * FROM MEETING_SUMMARY;
Now the extracted content is stored as a structured table in Snowflake,
making future analysis and AI-powered workflows much smoother!
Appendix: Instruction Manuals with Images
Meeting minutes are relatively well-structured documents, so extraction tends to work smoothly.
But we were curious how AI_EXTRACT would handle less-structured manuals ― especially those include diagrams and photos.
So we tried it out using the wildly popular Panasonic NanoCare hair dryer manual!

Let’s extract specific fields using AI-EXTRACT, just like before:
SELECT
ai_extract(
file => TO_FILE('@files_stage', '取扱説明書_EH-NA0K.pdf'),
responseFormat => [
['商品名', 'この説明書の商品名はなんですか?'],
['品番', 'この商品の品番を教えてください'],
['利用方法', '使い方を各ステップごとに整理してください'],
['海外での使用有無', '海外のコンセントで利用可能かどうか記載がある場合は「可」そうでない場合は「不可」と記載してください']
]
) AS qa;
Here’s what we got:
{
"error": null,
"response": {
"利用方法": [
"1 電源スイッチを [ON] にし [強] または風量切替ボタンで [中] を選択し、髪全体に温風をあてる",
"2 9割程度乾いた状態で仕上げを行う",
"3 電源スイッチを [OFF] にして、電源プラグをコンセントから抜く"
],
"品番": "EH-NA0K",
"商品名": "ヘアードライヤー ナノケア",
"海外での使用有無": "不可"
}
}
It extracted the usage instructions almost exactly as written. Even the “overseas usage” field—despite not being clearly defined in the manual—was extracted correctly. 😸
Summary
In this data-preparation-focused walkthrough of Snowflake Intelligence, we learned that:
- AI_EXTRACT excels at fact-based tasks such as extraction and classification.
- It is well suited for long-form summarization, especially in languages other than English.
- And as expected, completing the entire workflow inside Snowflake—from extraction to table storage to downstream use—is a huge advantage. 🌟
Snowflake provides many more functions for working with unstructured data,
so we’re planning to explore additional ones in future articles.
See you next time!
Discussion