You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/marketplace/platform-supported-content/modules/snowflake/snowflake-ai-data-connector.md
+50-12Lines changed: 50 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ The Snowflake AI Data Connector supports the following:
36
36
*[EMBED_TEXT_768](https://docs.snowflake.com/en/sql-reference/functions/embed_text-snowflake-cortex) – Given a piece of text, returns a vector embedding of 768 dimensions that represents that text.
37
37
*[EMBED_TEXT_1024](https://docs.snowflake.com/en/sql-reference/functions/embed_text_1024-snowflake-cortex) – Given a piece of text, returns a vector embedding of 1024 dimensions that represents that text.
38
38
39
-
* Use [Snowflake Cortex Analyst](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst) – This Snowflake Cortex feature is used to get information/insights out of structured data sets using natural language instead of sql.
39
+
* Use [Snowflake Cortex Analyst](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst) – This Snowflake Cortex feature is used to get information/insights out of structured data sets using natural language instead of sql. Cortex Analyst works with semantic models or semantic model views that define how your data should be interpreted.
40
40
* Synchronous execution of calls
41
41
* Query your Cortex Search services
42
42
@@ -68,13 +68,33 @@ After you install the connector, you can find it in the **App Explorer**, in the
68
68
69
69
### Configuring Snowflake Authentication
70
70
71
-
To use the capabilities of Snowflake in a Mendix app with the Snowflake AI Data Connector, you must use either OAUTH authentication or RSA key-pair authentication.
71
+
To use the capabilities of Snowflake in a Mendix app with the Snowflake AI Data Connector, you must configure one of the supported authentication methods:
To find out how configure the OAUTH Authentication method, see [Role-based Access Control](/appstore/modules/snowflake/snowflake-rbac/).
76
80
77
-
When using an OAuth token to authenticate REST calls, use the **JWT_GetCreate** microflow from the Utils folder to get or create a JWT object and set your OAuth token and expiration date on the Token and ExpirationDate attributes of the returned JWT object. In the **POST_v1_ExecuteStatement** and **CortexAnalyst** operations, the JWT is retrieved from the **ConnectionDetails** and used for authentication. Be aware that **GET_v1_RetrievePartition** should be edited when using OAuth for authentication. Further instructions on what to change are included in the microflow annotations.
81
+
When using an OAuth token to authenticate REST calls, use the **BearerToken_GetCreate** microflow from the *Utils* folder to get or create a **BearerToken** object. Set your OAuth token and expiration date on the **Token** and **ExpirationDate** attributes of the returned object.
82
+
83
+
In the **POST_v1_ExecuteStatement** and **CortexAnalyst** operations, the token is retrieved from the **ConnectionDetails** and used for authentication. Be aware that **GET_v1_RetrievePartition** should be edited when using OAuth for authentication. Further instructions on what to change are included in the microflow annotations.
You can use Programmatic Access Tokens (PATs) to authenticate Snowflake REST API calls without configuring OAuth or key-pair authentication.
88
+
89
+
Use the **BearerToken_GetCreate** microflow from the *Utils* folder to get or create a **BearerToken** object. Set the PAT value on the **Token** attribute and configure the **ExpirationDate** according to the lifetime of the token.
90
+
91
+
The token is retrieved from **ConnectionDetails** during execution of operations such as **POST_v1_ExecuteStatement** and **CortexAnalyst** and is used as a bearer token for Snowflake API authentication.
92
+
93
+
{{% alert color="info" %}} Snowflake enforces a maximum validity period for authentication tokens. Even if you configure a longer expiration when generating or storing a token, Snowflake will enforce its own upper limit and the token will not remain valid beyond that limit.
94
+
95
+
Because this limit is defined by Snowflake and may change over time, you should always verify the current maximum supported token lifetime in the official Snowflake documentation. For more information, see the Snowflake documentation on [Authenticating to the SQL API](https://docs.snowflake.com/en/developer-guide/sql-api/authenticating). {{% /alert %}}
96
+
97
+
When configuring the **ExpirationDate** of a **BearerToken**, make sure it aligns with the token lifetime supported by Snowflake to avoid authentication failures caused by expired tokens.
78
98
79
99
#### Configuring Key-Pair Authentication in Snowflake {#setup-key-pair-snowflake}
80
100
@@ -233,7 +253,7 @@ Activities define the actions that are executed in a microflow or a nanoflow.
233
253
234
254
#### ExecuteStatement {#execute-statement}
235
255
236
-
The `ExecuteStatement` activity allows you to execute a command in Snowflake using the SQL statement and the configuration details given in a`Statement` and `ConfigurationDetails` objects and returns a list of `HttpResponse` objects. Make sure that a JWT object containing your KEYPAIR_JWT or OAuth token is associated to your connection details before using the `ExecuteStatement` activity.
256
+
The `ExecuteStatement` activity allows you to execute a command in Snowflake using the SQL statement and the configuration details provided in the`Statement` and `ConnectionDetails` objects. The activity returns a list of `HttpResponse` objects. Make sure that a `BearerToken` object containing your KEYPAIR_JWT, OAuth token, or Programmatic Access Token (PAT) is associated with your `ConnectionDetails`.
237
257
238
258
The input and output for this service are shown in the table below:
239
259
@@ -285,24 +305,41 @@ This statement returns data from a Snowflake table with the columns named as spe
285
305
[Snowflake Cortex Analyst](/appstore/modules/genai/snowflake-cortex/) is a fully-managed, LLM-powered Snowflake Cortex feature that helps you create applications capable of reliably answering business questions based on your structured data in Snowflake.
286
306
287
307
{{% alert color="info" %}}
288
-
Snowflake Cortex Analyst is currently in open preview. For more information, refer to the [Snowflake Cortex Analyst documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst).
308
+
Snowflake Cortex Analyst is now generally available. For more information, refer to the [Snowflake Cortex Analyst documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst).
289
309
{{% /alert %}}
290
310
291
311
### Prerequisites
292
312
293
313
* Make sure that you have access to Cortex Analyst. For more information, refer to the [Snowflake Cortex Analyst documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst).
294
-
* Create the semantic model for Cortex Analyst. For more information, refer to [Creating Semantic Models for Snowflake Cortex Analyst](https://developers.snowflake.com/solution/creating-semantic-models-for-snowflakes-cortex-analyst/) in the Snowflake Cortex Analyst documentation.
314
+
* Create a semantic model, semantic model view, or inline semantic model for Cortex Analyst. For more information, refer to:
315
+
*[Creating Semantic Models for Snowflake Cortex Analyst](https://developers.snowflake.com/solution/creating-semantic-models-for-snowflakes-cortex-analyst/)
316
+
*[Using Semantic Model Views](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst#understanding-semantic-views)
295
317
* Set up one of the following supported authentication methods for Cortex Analyst:
296
318
* OAUTH
297
319
* KEYPAIR_JWT
320
+
* PAT (Programmatic Access Token)
298
321
299
322
### Configuration
300
323
301
324
To configure your Mendix app for Snowflake Cortex Analyst, perform the following steps:
302
325
303
326
1. Create a microflow and retrieve your **ConnectionDetails** object.
304
-
2. When using KEYPAIR_JWT as your authentication type use the **Generate JWT** action from the **Toolbox** to generate a JWT object. When using OAuth as authentication type please use the **Get or Create JWT** action from the **Toolbox** to create a JWT object and set your OAuth token and expiration date on that object.
305
-
3. Add the **Cortex Analyst: Create Request** action from the **Toolbox**, and then configure the **Request** to contain the path to the Snowflake semantic model file and your question/prompt for the model.
327
+
2. Configure authentication based on the authentication type set in **ConnectionDetails**:
328
+
* When using **KEYPAIR_JWT**, use the **Generate JWT** action from the **Toolbox** to generate a JWT token.
329
+
* When using **OAuth** or **PAT**, use the **BearerToken_GetCreate** microflow from the **Utils** folder to get or create a **BearerToken** object. Set the **Token** and **ExpirationDate** attributes accordingly.
330
+
3. Add the **Cortex Analyst: Create Request** action from the **Toolbox**, and configure the **Request**.
331
+
The request is based on the **AbstractCortexAnalystRequest** entity, which has two implementations depending on whether you want to use a single semantic model or multiple models:
332
+
333
+
***CortexAnalystRequest** – Use this for single-model requests. Configure one of the following attributes:
334
+
***Semantic_Model_File** – Provide the path to a semantic model YAML file stored in Snowflake.
335
+
***Semantic_View** – Provide the name of the semantic model view that Cortex Analyst should use. For more information, refer to the [Using Semantic Model Views](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst#understanding-semantic-views) section of the Snowflake documentation.
336
+
***Semantic_Model** – Provide the semantic model definition as a YAML string. This allows you to define the semantic model inline instead of uploading it to Snowflake.
337
+
***CortexAnalystMultiModelRequest** – Use this when working with multiple semantic models. This allows Cortex Analyst to select the most relevant model when answering a question.
338
+
Each **SemanticModel** object can contain one of the following:
339
+
***Semantic_Model_File** – Provide the path to a semantic model YAML file stored in Snowflake.
340
+
***Semantic_View** – Provide the name of the semantic model view that Cortex Analyst should use. For more information, refer to the [Using Semantic Model Views](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst#understanding-semantic-views) section of the Snowflake documentation.
341
+
***Inline_Semantic_Model** – Provide the semantic model definition as a YAML string. This allows you to define the semantic model inline instead of uploading it to Snowflake.
342
+
The user prompt is stored in the **CortexAnalystMessage** object. Set the question for Cortex Analyst in the **Content** attribute of this entity.
306
343
4. Add the **Snowflake Cortex Analyst** action from the Toolbox and provide the following information:
307
344
***ConnectionDetails** – The connection details that you configured
308
345
***Request** – The request that you configured for the **Cortex Analyst: Create Request** action
@@ -312,8 +349,6 @@ To configure your Mendix app for Snowflake Cortex Analyst, perform the following
312
349
***SQLText** – The returned SQL suggestion
313
350
6. To get the Cortex Analyst Response entity, add the **Response: Get Cortex Analyst Response** action from the Toolbox, and then add the **Response** entity as a parameter. The response contains the following information:
@@ -323,16 +358,19 @@ Snowflake Cortex Search is a fully-managed, ML-powered Snowflake Cortex feature
323
358
324
359
* Make sure that you have access to Cortex Search. For more information, refer to the [Snowflake Cortex Search documentation](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-search/cortex-search-overview).
325
360
* Create the Cortex Search service. For more information, refer to [Creating Snowflake Cortex Search service](https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-search/cortex-search-overview#create-the-service) in the Snowflake Cortex Search documentation.
326
-
* Set up one of the following supported authentication methods for Cortex Analyst:
361
+
* Set up one of the following supported authentication methods for Cortex Search:
327
362
* OAUTH
328
363
* KEYPAIR_JWT
364
+
* PAT (Programmatic Access Token)
329
365
330
366
### Configuration
331
367
332
368
To configure your Mendix app for Snowflake Cortex Search, perform the following steps:
333
369
334
370
1. Create a microflow and retrieve your **ConnectionDetails** object.
335
-
2. When using KEYPAIR_JWT as your authentication type use the **Generate JWT** action from the **Toolbox** to generate a JWT object. When using OAuth as authentication type please use the **Get or Create JWT** action from the **Toolbox** to create a JWT object and set your OAuth token and expiration date on that object.
371
+
2. Configure authentication based on the authentication type set in **ConnectionDetails**:
372
+
* When using **KEYPAIR_JWT**, use the **Generate JWT** action from the **Toolbox** to generate a JWT token.
373
+
* When using **OAuth** or **PAT**, use the **BearerToken_GetCreate** microflow from the **Utils** folder to get or create a **BearerToken** object. Set the **Token** and **ExpirationDate** attributes accordingly.
336
374
3. Create a **CortexSearchRequest** object, and then configure the **Request** to contain the path to the Snowflake Cortex Search service, your query/prompt for the model and what indexed columns the Cortex Search service should return.
337
375
4. Add the **Snowflake Cortex Search** action from the Toolbox and provide the following information:
338
376
***ConnectionDetails** – The connection details that you configured
0 commit comments