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: docs/t-sql/functions/ai-generate-chunks-transact-sql.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: The ai_generate_chunks table-valued function creates text chunks.
4
4
author: jettermctedder
5
5
ms.author: bspendolini
6
6
ms.reviewer: randolphwest
7
-
ms.date: 06/09/2025
7
+
ms.date: 06/27/2025
8
8
ms.service: sql
9
9
ms.subservice: t-sql
10
10
ms.topic: "reference"
@@ -42,9 +42,9 @@ To change the compatibility level of a database, refer to [View or change the co
42
42
```syntaxsql
43
43
AI_GENERATE_CHUNKS (source = text_expression
44
44
, chunk_type = FIXED
45
-
[ [ , ] chunk_size = numeric_expression ]
46
-
[ [ , ] overlap = numeric_expression ]
47
-
[ [ , ] enable_chunk_set_id = numeric_expression]
45
+
[ , chunk_size = numeric_expression ]
46
+
[ , overlap = numeric_expression ]
47
+
[ , enable_chunk_set_id = numeric_expression]
48
48
)
49
49
```
50
50
@@ -64,15 +64,15 @@ Accepted values for this release:
64
64
65
65
#### *chunk_size*
66
66
67
-
When `chunk_type` is `FIXED`, this parameter sets the character/word count size of each chunk specified as a variable, a literal, or a scalar expression of type **tinyint**, **smallint**, **int**, or **bigint**. *chunk_size* can't be `NULL`, negative, or zero (`0`).
67
+
When `chunk_type` is `FIXED`, this parameter sets the character count size of each chunk specified as a variable, a literal, or a scalar expression of type **tinyint**, **smallint**, **int**, or **bigint**. *chunk_size* can't be `NULL`, negative, or zero (`0`). This parameter is also **required** when using a `chunk_type` of `FIXED`.
68
68
69
69
#### *overlap*
70
70
71
-
The *overlap* parameter determines the percentage of the preceding text that should be included in the current chunk. This percentage is applied to the `chunk_size` parameter to calculate the size in characters. The *overlap* value can be specified as a variable, a literal, or a scalar expression of type tinyint, smallint, int, or bigint. It must be a whole number between zero (`0`) and 50, inclusive, and cannot be NULL or negative. The default value is zero (`0`).
71
+
The *overlap* parameter determines the percentage of the preceding text that should be included in the current chunk. This percentage is applied to the `chunk_size` parameter to calculate the size in characters. The *overlap* value can be specified as a variable, a literal, or a scalar expression of type tinyint, smallint, int, or bigint. It must be a whole number between zero (`0`) and 50, inclusive, and can't be `NULL` or negative. The default value is zero (`0`).
72
72
73
73
#### *enable_chunk_set_id*
74
74
75
-
An **int** or **bit** expression that serves as a flag to enable or disable the `chunk_set_id` output column; a column that returns a number to help group returned chunks belonging to the same source. A value of 1 enables the column. If *enable_chunk_set_id* is omitted, NULL, or has a value of 0, the `chunk_set_id` column is disabled and not returned.
75
+
An **int** or **bit** expression that serves as a flag to enable or disable the `chunk_set_id` output column; a column that returns a number to help group returned chunks belonging to the same source. A value of `1` enables the column. If *enable_chunk_set_id* is omitted, `NULL`, or has a value of `0`, the `chunk_set_id` column is disabled and not returned.
76
76
77
77
## Return types
78
78
@@ -81,10 +81,10 @@ An **int** or **bit** expression that serves as a flag to enable or disable the
81
81
| Column name | Data type | Description |
82
82
| --- | --- | --- |
83
83
|`chunk`| Same as source expression data type | Returned text that was chunked from the source expression. |
84
-
|`chunk_order`|**int**| A sequence of ordered numbers that relates to the order each chunk was processed starting with `1` and increasing by `1`. |
85
-
|`chunk_offset`|**int**| Position of the chunk of the source data/document in relation to the start of the chunking process. |
84
+
|`chunk_order`|**bigint**| A sequence of ordered numbers that relates to the order each chunk was processed starting with `1` and increasing by `1`. |
85
+
|`chunk_offset`|**bigint**| Position of the chunk of the source data/document in relation to the start of the chunking process. |
86
86
|`chunk_length`|**int**| Character length of the returned text chunk. |
87
-
|`chunk_set_id`|**int**| An *optional column* that contains an ID that groups all the chunks of a source expression, document, or row. If multiple documents or rows are chunked in a single transaction, they're each given a different `chunk_set_id`. Visibility is controlled by the `enable_chunk_set_id` parameter. |
87
+
|`chunk_set_id`|**bigint**| An *optional column* that contains an ID that groups all the chunks of a source expression, document, or row. If multiple documents or rows are chunked in a single transaction, they're each given a different `chunk_set_id`. Visibility is controlled by the `enable_chunk_set_id` parameter. |
Copy file name to clipboardExpand all lines: docs/t-sql/statements/create-external-model-transact-sql.md
+25-20Lines changed: 25 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: CREATE EXTERNAL MODEL (Transact-SQL) for creating an external model
4
4
author: jettermctedder
5
5
ms.author: bspendolini
6
6
ms.reviewer: randolphwest
7
-
ms.date: 06/03/2025
7
+
ms.date: 06/27/2025
8
8
ms.service: sql
9
9
ms.subservice: t-sql
10
10
ms.topic: "reference"
@@ -89,10 +89,10 @@ Indicate which `DATABASE SCOPED CREDENTIAL` object is used with the AI model inf
89
89
90
90
### PARAMETERS
91
91
92
-
A valid JSON string that contains parameters to be appended to the AI model inference endpoint request message. For example:
92
+
A valid JSON string that contains runtime parameters to be appended to the AI model inference endpoint request message. For example:
93
93
94
-
```json
95
-
'{"Dimensions": 1536}'
94
+
```text
95
+
'{"Dimensions": 1536}'
96
96
```
97
97
98
98
## Permissions
@@ -126,24 +126,24 @@ GO
126
126
127
127
## Retry count
128
128
129
-
If the embeddings call encounters HTTP status codes indicating temporary issues, you can configure the request to automatically retry. To specify the number of retries, add the following JSON to the `PARAMETERS` on the `EXTERNAL MODEL`. The **NUMBER_OF_RETRIES** should be a whole number between zero (0) and ten (10), inclusive, and can't be NULL or negative
129
+
If the embeddings call encounters HTTP status codes indicating temporary issues, you can configure the request to automatically retry. To specify the number of retries, add the following JSON to the `PARAMETERS` on the `EXTERNAL MODEL`. The `<number_of_retries>` should be a whole number between zero (`0`) and ten (`10`), inclusive, and can't be `NULL` or negative.
@@ -179,10 +179,15 @@ For more information on creating embedding endpoints, use these links for the ap
179
179
The created `DATABASE SCOPED CREDENTIAL` used by an `EXTERNAL MODEL` must adhere to specific following rules:
180
180
181
181
- Must be a valid URL
182
+
182
183
- The URL domain must be one of those domains included in the allowlist
184
+
183
185
- The URL must not contain a query string
186
+
184
187
- Protocol + Fully Qualified Domain Name (FQDN) of the called URL must match Protocol + FQDN of the credential name
188
+
185
189
- Each part of the called URL path must match completely with the respective part of URL path in the credential name
190
+
186
191
- The credential must point to a path that is more generic than the request URL. For example, a credential created for path `https://northwind.azurewebsite.net/customers` can't be used for the URL `https://northwind.azurewebsite.net`
187
192
188
193
#### Collation and credential name rules
@@ -194,6 +199,7 @@ As there's a collation rule set at the database level, the following logic is ap
194
199
1. Check if the URL and credential match using the RFC, which means:
195
200
- Check the scheme and host using a case-insensitive collation (`Latin1_General_100_CI_AS_KS_WS_SC`)
196
201
- Check all other segments of the URL are compared in a case-sensitive collation (`Latin1_General_100_BIN2`)
202
+
197
203
1. Check that the URL and credential match using the database collation rules (and without doing any URL encoding).
198
204
199
205
### Managed Identity
@@ -202,13 +208,12 @@ To use [Managed Identity](/entra/identity/managed-identities-azure-resources/ove
202
208
203
209
```sql
204
210
EXECUTE sp_configure 'allow server scoped db credentials', 1;
205
-
206
211
RECONFIGURE WITH OVERRIDE;
207
212
```
208
213
209
214
### SCHEMABINDING
210
215
211
-
Dropping views created with `SCHEMABINDING` and referencing an `EXTERNAL MODEL` (such as a SELECT statement using `AI_GENERATE_EMBEDDINGS`) is prevented with the Database Engine raising an error. The view definition itself must first be modified or dropped to remove dependencies referencing an `EXTERNAL MODEL`.
216
+
Dropping views created with `SCHEMABINDING` and referencing an `EXTERNAL MODEL` (such as a `SELECT` statement using `AI_GENERATE_EMBEDDINGS`) is prevented with the Database Engine raising an error. The view definition itself must first be modified or dropped to remove dependencies referencing an `EXTERNAL MODEL`.
212
217
213
218
## Catalog View
214
219
@@ -222,10 +227,10 @@ SELECT * FROM sys.external_models;
222
227
223
228
### Create an EXTERNAL MODEL with Azure OpenAI using Managed Identity
224
229
225
-
This example creates an EXTERNAL MODEL of the EMBEDDINGS type using Azure OpenAI and uses [Managed Identity](/entra/identity/managed-identities-azure-resources/overview) for authentication.
230
+
This example creates an `EXTERNAL MODEL` of the `EMBEDDINGS` type using Azure OpenAI and uses [Managed Identity](/entra/identity/managed-identities-azure-resources/overview) for authentication.
226
231
227
-
> [!IMPORTANT]
228
-
> If using Managed Identity with Azure OpenAI and SQL Server 2025, the [**`Cognitive Services OpenAI Contributor`**](/azure/role-based-access-control/built-in-roles#ai--machine-learning) role must be granted to [SQL Server's system-assigned managed identity by ARC](../../sql-server/azure-arc/managed-identity.md). For more information, see [Role-based access control for Azure OpenAI in Azure AI Foundry Models](/azure/ai-services/openai/how-to/role-based-access-control).
232
+
> [!IMPORTANT]
233
+
> If using Managed Identity with Azure OpenAI and SQL Server 2025, the [Cognitive Services OpenAI Contributor](/azure/role-based-access-control/built-in-roles#ai--machine-learning) role must be granted to [SQL Server's system-assigned managed identity enabled by Azure Arc](../../sql-server/azure-arc/managed-identity.md). For more information, see [Role-based access control for Azure OpenAI in Azure AI Foundry Models](/azure/ai-services/openai/how-to/role-based-access-control).
229
234
230
235
```sql
231
236
-- Create access credentials to Azure OpenAI using a managed identity:
@@ -247,7 +252,7 @@ WITH (
247
252
248
253
### Create an EXTERNAL MODEL with Azure OpenAI using API keys and parameters
249
254
250
-
This example creates an EXTERNAL MODEL of the EMBEDDINGS type using Azure OpenAI and uses API Keys for authentication. The example also uses `PARAMETERS` to set the Dimensions parameter at the endpoint to 725.
255
+
This example creates an `EXTERNAL MODEL` of the `EMBEDDINGS` type using Azure OpenAI and uses API Keys for authentication. The example also uses `PARAMETERS` to set the Dimensions parameter at the endpoint to 725.
251
256
252
257
```sql
253
258
-- Create access credentials to Azure OpenAI using a key:
@@ -310,8 +315,8 @@ WITH (
310
315
-[ALTER EXTERNAL MODEL (Transact-SQL)](alter-external-model-transact-sql.md)
311
316
-[DROP EXTERNAL MODEL (Transact-SQL)](drop-external-model-transact-sql.md)
0 commit comments