Document Processing Playground

The Document Processing Playground provides a user interface for exploring the AI_EXTRACT and AI_PARSE_DOCUMENT functions. You can upload your own documents from stage, ask questions to extract information using AI_EXTRACT, and preview both the layout and OCR results generated by AI_PARSE_DOCUMENT. The playground lets you explore how the functions process your documents, and copy the corresponding SQL queries for further use in worksheets.

For more information, see AI_EXTRACT and AISQL AI_PARSE_DOCUMENT.

Required privileges

Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role. For information about granting this privilege, see Cortex LLM privileges.

Get started with the Document Processing Playground

To access the Document Processing Playground:

  1. Sign in to Snowsight.

  2. In the navigation menu, select AI & ML » Studio. The Document Processing Playground appears among the other Studio functions.

  3. To open the Document Processing Playground, select Try.

Upload your documents from a stage

  1. Select Add from stage.

    A dialog appears.

  2. Select the database, schema, and stage that contains your documents.

  3. Select the document files that you want to add to the playground.

    Note

    You can select up to 10 documents.

  4. Select Open playground.

    The playground appears.

The Document Processing Playground interface displays a preview of a document on the right and a prompt area on the left where you can enter prompts.

Tip

To change the document that you are previewing, select the document name, and then select another document from the list.

The Document Processing Playground interface consists of the following tabs:

  • Extraction: The view where you can ask questions to extract information from the document.

  • Markdown: The view where you can see the markdown representation of the document. It’s the LAYOUT mode output from AI_PARSE_DOCUMENT.

  • Text: The view where you can see the text representation of the document. It’s the OCR mode output from AI_PARSE_DOCUMENT.

Extract information by asking questions

You can ask questions to extract information from the document.

  1. Select the Extraction tab.

  2. Create key and question pairs, for example:

    • Key: company

    • Question: What is the name of the company?

  3. To confirm, select Add Prompt.

Preview the markdown and text versions of the document

The Markdown and the Text tabs display the results of the AI_PARSE_DOCUMENT function.

  • To see the Layout mode results, select the Markdown tab.

  • To see the OCR mode results, select the Text tab.

Get the code snippets to use in worksheets

After you ask at least one question, the playground creates SQL queries that use the AI_EXTRACT and AI_PARSE_DOCUMENT functions to process your documents. To preview and copy the SQL queries:

  1. In the top right corner of the interface, select Code Snippets.

  2. To open the snippets in worksheets, select Open in Worksheet.

    A new worksheet opens with the SQL code snippets.

Limitations

Limitations of the AI_EXTRACT and AI_PARSE_DOCUMENT functions apply to the Document Processing Playground. For more information, see AI_EXTRACT and AISQL AI_PARSE_DOCUMENT.