|
| 1 | +--- |
| 2 | +title: "Bring Your Own Snowflake LLM" |
| 3 | +url: /appstore/modules/snowflake/bring-your-own-snowflake-llm/ |
| 4 | +description: "Describes the steps required to use a Snowflake-managed MCP server with a Mendix AI agent." |
| 5 | +weight: 81 |
| 6 | +--- |
| 7 | + |
| 8 | +## Introduction |
| 9 | + |
| 10 | +You can leverage a LLM (Large Language Model) from your Snowflake account in your Mendix application for GenAI functionality. In Snowflake this is known as BYOK (Bring your own Key). For a list of available LLM models, refer to the Snowflake documentation. |
| 11 | + |
| 12 | +Using a Snowflake BYOK has the following advantages: |
| 13 | + |
| 14 | +* Easy - Offers unified integration with model provider capacity and multi-cloud resilience |
| 15 | +* Trusted - Leverage the Snowflake Secure Data Boundary |
| 16 | +* Cost-efficient - Benefit from unified billing and Snowflake committed spend draw down |
| 17 | + |
| 18 | +### Typical Use Cases |
| 19 | + |
| 20 | +* Chat interfaces in natural language |
| 21 | +* Usage by Mendix AI Agents |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +* Snowflake user, preferable of the Service type, with a PAT (Programmatic Access Token) in your Snowflake account. This user must have the authorization to invoke Cortex REST API. |
| 26 | +* Network rule and policy assigned to this user, which allow-lists the IP addresses from where the Mendix application will invoke the API at runtime. |
| 27 | + |
| 28 | + For applications running locally in Studio Pro, you can retrieve your own IP address from [whatismyipaddress.com](https://whatismyipaddress.com/). For applications running in Mendix Cloud, see [Mendix IP Addresses: Mendix Cloud](/developerportal/deploy/mendix-ip-addresses/#mendix-cloud). |
| 29 | + |
| 30 | +* [OpenAI Connector](/appstore/modules/genai/reference-guide/external-connectors/openai/) in your Mendix application |
| 31 | + |
| 32 | +## Configuring the Snowflake LLM in the OpenAI Connector |
| 33 | + |
| 34 | +Because Snowflake conforms to the API specification of OpenAI, you can use the OpenAI connector to configure the connection to the Snowflake Cortex API. |
| 35 | + |
| 36 | +1. In OpenAI Connector, create a new configuration by performing the following steps: |
| 37 | + |
| 38 | + 1. Click **New**. |
| 39 | + 2. Enter an identifying name. |
| 40 | + 3. For API type, select **OpenAI**. |
| 41 | + 4. For **Endpoint**, enter your Snowflake account URL with the `/api/v2/cortex/v1/` suffix. |
| 42 | + |
| 43 | + For example, the URL may look like the following: `https:/<snowflake_accountname>.snowflakecomputing.com/api/v2/cortex/v1/`. |
| 44 | + |
| 45 | + 5. Save your changes. |
| 46 | + |
| 47 | + {{< figure src="/attachments/appstore/platform-supported-content/modules/snowflake-byok/save-changes.png" >}} |
| 48 | + |
| 49 | +2. Add a Large Language Model by performing the following steps: |
| 50 | + |
| 51 | + 1. Hover over the **three dots** icon and select **Manage deployed models** from the pop-up menu. |
| 52 | + |
| 53 | + {{< figure src="/attachments/appstore/platform-supported-content/modules/snowflake-byok/managed-deployed-models.png" >}} |
| 54 | + |
| 55 | + 2. Click **Add new model** to add an LLM from the list of available LLMs in your Snowflake account. |
| 56 | + |
| 57 | + {{< figure src="/attachments/appstore/platform-supported-content/modules/snowflake-byok/new-deployed-model.png" >}} |
| 58 | + |
| 59 | + Alternatively, you can log into your Snowflake account with Snowsight and select **AI & ML > AI Studio > Cortex Playground**. The list in the top middle of the screen lists all available models. |
| 60 | + |
| 61 | + The **Model name** field in the Deployed Model configuration in Mendix must match exactly with the model name in Snowflake. |
| 62 | + |
| 63 | + 3. Complete the configuration for your model. |
| 64 | + 4. Save your changes. |
| 65 | + |
| 66 | +3. Test the configuration by performing the following steps: |
| 67 | + |
| 68 | + 1. Hover over the **three dots** icon and select **Test** from the pop-up menu. |
| 69 | + |
| 70 | + {{< figure src="/attachments/appstore/platform-supported-content/modules/snowflake-byok/test-option.png" >}} |
| 71 | + |
| 72 | + 2. Select your deployed model from the drop-down list. |
| 73 | + 3. Click **Test**. |
| 74 | + |
| 75 | + {{< figure src="/attachments/appstore/platform-supported-content/modules/snowflake-byok/test.png" >}} |
0 commit comments