Skip to main content
Public preview This page outlines the steps that are required to build a Docker image that can be deployed into Snowpark Container Services and used with Snowpark Container Prompt component.

Prerequisites

Review the Snowflake prerequisites to confirm you meet the requirements for creating an app.

Instructions

  1. You may wish to set up a security integration and make sure that the role you use to set up the Snowpark Container Services app has the BIND SERVICE ENDPOINT PERMISSION. For example:
  2. Create a Snowflake compute pool (if not created). This is the pool of virtual machine nodes on which your service will run.
  3. Check your compute pool is running:
  4. Create a Snowflake stage to store your service specification files:
  5. Create an image repository on your Snowflake account. This is where you push images to, and where Snowflake will pull images from:
The Snowpark Container Prompt component generates a user-defined function (UDF) at runtime with the signature. udf(systemPrompt VARCHAR, userPrompt VARCHAR, inputValues VARIANT, metadata VARIANT) inputValues is a JSON object containing the { columnName: columnValue } of all of your inputs selected in the component. Metadata is also a JSON object, containing any key:value pairs specified in the metadata parameters. The UDF is invoked by the Snowpark Container Prompt component and translated into JSON, which is what your app will receive. This looks as below:
Your service response must look like this:
If the Output Format parameter in the Snowpark Container Prompt component is set to JSON, your service must respond with valid JSON, otherwise your output rows will all error.

Build and deploy your Docker image

In the code blocks below, my_service is an example service name. Replace it with your own service name.
  1. Build and push a Docker image to the repo:
    Your service will be selectable in the Snowpark Container Prompt component within the Service property.
  2. Create your Snowpark Container Services service:
    Your endpoint will be selectable in the Snowpark Container Prompt component within the Endpoint property.
  3. Check service details: