Skip to content

Commit 92cd5e1

Browse files
Merge pull request #34562 from JetterMcTedder/main
Doc updates for incorrect syntax
2 parents 2caa3b0 + ed29986 commit 92cd5e1

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

docs/t-sql/functions/ai-generate-chunks-transact-sql.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: The ai_generate_chunks table-valued function creates text chunks.
44
author: jettermctedder
55
ms.author: bspendolini
66
ms.reviewer: randolphwest
7-
ms.date: 06/09/2025
7+
ms.date: 06/27/2025
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: "reference"
@@ -42,9 +42,9 @@ To change the compatibility level of a database, refer to [View or change the co
4242
```syntaxsql
4343
AI_GENERATE_CHUNKS (source = text_expression
4444
, 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 ]
4848
)
4949
```
5050

@@ -64,15 +64,15 @@ Accepted values for this release:
6464

6565
#### *chunk_size*
6666

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`.
6868

6969
#### *overlap*
7070

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`).
7272

7373
#### *enable_chunk_set_id*
7474

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.
7676

7777
## Return types
7878

@@ -81,10 +81,10 @@ An **int** or **bit** expression that serves as a flag to enable or disable the
8181
| Column name | Data type | Description |
8282
| --- | --- | --- |
8383
| `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. |
8686
| `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. |
8888

8989
### Return example
9090

docs/t-sql/statements/create-external-model-transact-sql.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: CREATE EXTERNAL MODEL (Transact-SQL) for creating an external model
44
author: jettermctedder
55
ms.author: bspendolini
66
ms.reviewer: randolphwest
7-
ms.date: 06/03/2025
7+
ms.date: 06/27/2025
88
ms.service: sql
99
ms.subservice: t-sql
1010
ms.topic: "reference"
@@ -89,10 +89,10 @@ Indicate which `DATABASE SCOPED CREDENTIAL` object is used with the AI model inf
8989

9090
### PARAMETERS
9191

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:
9393

94-
```json
95-
'{"Dimensions" : 1536}'
94+
```text
95+
'{ "Dimensions": 1536 }'
9696
```
9797

9898
## Permissions
@@ -126,24 +126,24 @@ GO
126126

127127
## Retry count
128128

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.
130130

131-
```JSON
132-
{"sql_rest_options":{"retry_count":NUMBER_OF_RETRIES}}
131+
```text
132+
{ "sql_rest_options": { "retry_count": <number_of_retries> } }
133133
```
134134

135-
For example, to set the `retry count` to 3, you would write the following JSON string:
135+
For example, to set the `retry_count` to 3, you would write the following JSON string:
136136

137-
```JSON
138-
{"sql_rest_options":{"retry_count":3}}
137+
```json
138+
{ "sql_rest_options": { "retry_count": 3 } }
139139
```
140140

141141
### Retry count with other parameters
142142

143143
Retry count can also be combined with other parameters as long as it's a valid JSON string.
144144

145-
```JSON
146-
{"Dimensions":725,"sql_rest_options":{"retry_count":5}}
145+
```json
146+
{ "Dimensions": 725, "sql_rest_options": { "retry_count": 5 } }
147147
```
148148

149149
## Remarks
@@ -179,10 +179,15 @@ For more information on creating embedding endpoints, use these links for the ap
179179
The created `DATABASE SCOPED CREDENTIAL` used by an `EXTERNAL MODEL` must adhere to specific following rules:
180180

181181
- Must be a valid URL
182+
182183
- The URL domain must be one of those domains included in the allowlist
184+
183185
- The URL must not contain a query string
186+
184187
- Protocol + Fully Qualified Domain Name (FQDN) of the called URL must match Protocol + FQDN of the credential name
188+
185189
- Each part of the called URL path must match completely with the respective part of URL path in the credential name
190+
186191
- 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`
187192

188193
#### 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
194199
1. Check if the URL and credential match using the RFC, which means:
195200
- Check the scheme and host using a case-insensitive collation (`Latin1_General_100_CI_AS_KS_WS_SC`)
196201
- Check all other segments of the URL are compared in a case-sensitive collation (`Latin1_General_100_BIN2`)
202+
197203
1. Check that the URL and credential match using the database collation rules (and without doing any URL encoding).
198204

199205
### Managed Identity
@@ -202,13 +208,12 @@ To use [Managed Identity](/entra/identity/managed-identities-azure-resources/ove
202208

203209
```sql
204210
EXECUTE sp_configure 'allow server scoped db credentials', 1;
205-
206211
RECONFIGURE WITH OVERRIDE;
207212
```
208213

209214
### SCHEMABINDING
210215

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`.
212217

213218
## Catalog View
214219

@@ -222,10 +227,10 @@ SELECT * FROM sys.external_models;
222227

223228
### Create an EXTERNAL MODEL with Azure OpenAI using Managed Identity
224229

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.
226231

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).
229234
230235
```sql
231236
-- Create access credentials to Azure OpenAI using a managed identity:
@@ -247,7 +252,7 @@ WITH (
247252

248253
### Create an EXTERNAL MODEL with Azure OpenAI using API keys and parameters
249254

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.
251256

252257
```sql
253258
-- Create access credentials to Azure OpenAI using a key:
@@ -310,8 +315,8 @@ WITH (
310315
- [ALTER EXTERNAL MODEL (Transact-SQL)](alter-external-model-transact-sql.md)
311316
- [DROP EXTERNAL MODEL (Transact-SQL)](drop-external-model-transact-sql.md)
312317
- [AI_GENERATE_EMBEDDINGS (Transact-SQL)](../functions/ai-generate-embeddings-transact-sql.md)
313-
- [AI_GENERATE_CHUNKS (Transact-SQL)](../functions/ai-generate-chunks-transact-sql.md)
318+
- [AI_GENERATE_CHUNKS (Transact-SQL) (Preview)](../functions/ai-generate-chunks-transact-sql.md)
314319
- [sys.external_models](../../relational-databases/system-catalog-views/sys-external-models-transact-sql.md)
315-
- [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource)
320+
- [Create and deploy an Azure OpenAI in Azure AI Foundry Models resource](/azure/ai-services/openai/how-to/create-resource)
316321
- [Server configuration options](../../database-engine/configure-windows/server-configuration-options-sql-server.md)
317322
- [Role-based access control for Azure OpenAI in Azure AI Foundry Models](/azure/ai-services/openai/how-to/role-based-access-control)

0 commit comments

Comments
 (0)