Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Snowflake Cortex AI Chat with File

Snowflake Cortex AI Chat with File

Prerequisites

Prerequisites

To use the Snowflake Cortex AI Chat with File recipe, the following prerequisites must be met:
You must create a stage in the Snowflake Web UI with the Snowflake server-side encryption enabled and upload your files to the stage.
To create a stage in Snowflake Web UI, use the following snippet in the Snowflake worksheet:
CREATE STAGE <stage_name> DIRECTORY = ( ENABLE = true ) ENCRYPTION = ( TYPE = 'SNOWFLAKE_SSE' );
To upload a file to the Snowflake stage, you can perform one of the following steps:
  • Using the Snowflake Web UI.
    1. Open the stage where you want to upload a file.
    2. Click
      Files
      Browse
      and select the file from your local machine.
    3. Click
      Upload
      .
  • Using the PUT command at the command prompt.
    To upload a document to the stage, you must use the following query in the terminal window:
    snowsql -a <your accountIdentifier> -u <username> -d<database> -s <schema>
    Enter the password. After that use the following PUT command to add the file to the Snowflake stage:
    PUT 'file:path' @stage AUTO_COMPRESS = FALSE;
    Ensure that you use
    AUTO_COMPRESS = FALSE
    . Otherwise, the file will be compressed.
The file appears in the
Stage Files
tab of the Snowflake stage.
After uploading the file, you must get the stage path to invoke the process.
To get the stage path, perform the following steps:
  1. In the Snowflake Web UI, go to
    Data
    Databases
    and select the database.
  2. In the
    Schemas
    tab, select the schema.
  3. In the
    Stages
    tab, select the stage where you have uploaded the file.
  4. Click the
    Actions
    menu corresponding to the file and click
    Copy path
    as shown in the following sample image:
This image shows the stage files and an option to copy the file
                                        path.
In this image,
DEMO
is the database,
LOCATION
is the schema, and
INPUT_STAGE
is the stage.
When you copy the path as shown in the above sample image, you will get the path as
'@"DEMO"."LOCATION"."INPUT_STAGE"/collation.pdf'
, where stage path is
@DEMO.LOCATION.input_stage
and the file name is
collation.pdf
. You'll need these values while invoking the process.

0 COMMENTS

We’d like to hear from you!