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
`AI_GENERATE_CHUNKS` is a table-valued function that creates "chunks", or fragments of text based on a type, size, and source expression.
27
+
`AI_GENERATE_CHUNKS` is a table-valued function that creates *chunks*, or fragments of text based on a type, size, and source expression.
28
28
29
-
#### Compatibility level 170
29
+
> [!NOTE]
30
+
> `AI_GENERATE_CHUNKS` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **SQL Server 2025** or **Always-up-to-date**[update policy](/azure/azure-sql/managed-instance/update-policy).
30
31
31
32
`AI_GENERATE_CHUNKS` requires the compatibility level to be at least 170. When the level is less than 170, the [!INCLUDE [ssde-md](../../includes/ssde-md.md)] is unable to find the `AI_GENERATE_CHUNKS` function.
32
33
@@ -37,39 +38,39 @@ To change the compatibility level of a database, refer to [View or change the co
An [expression](../language-elements/expressions-transact-sql.md) of any character type (for example, **nvarchar**, **varchar**, **nchar**, or **char**).
53
54
54
-
#### *chunk_type*
55
+
#### CHUNK_TYPE = FIXED
55
56
56
-
A string literal naming the type or method to chunk the text/document and can't be `NULL` or a value from a column.
57
+
A string literal naming the type or method to chunk the text/document. This value can't be `NULL` or a value from a column.
57
58
58
-
Accepted values for this release:
59
+
Accepted values are:
59
60
60
61
-`FIXED`
61
62
62
-
#### *chunk_size*
63
+
#### CHUNK_SIZE = *numeric_expression*
63
64
64
-
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`.
65
+
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 required when using a `CHUNK_TYPE` of `FIXED`.
65
66
66
-
#### *overlap*
67
+
#### OVERLAP = *numeric_expression*
67
68
68
-
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`).
69
+
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`).
69
70
70
-
#### *enable_chunk_set_id*
71
+
#### ENABLE_CHUNK_SET_ID = *numeric_expression*
71
72
72
-
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.
73
+
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.
73
74
74
75
## Return types
75
76
@@ -81,7 +82,7 @@ An **int** or **bit** expression that serves as a flag to enable or disable the
81
82
|`chunk_order`|**bigint**| A sequence of ordered numbers that relates to the order each chunk was processed starting with `1` and increasing by `1`. |
82
83
|`chunk_offset`|**bigint**| Position of the chunk of the source data/document in relation to the start of the chunking process. |
83
84
|`chunk_length`|**int**| Character length of the returned text chunk. |
84
-
|`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. |
85
+
|`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. |
85
86
86
87
### Return example
87
88
@@ -91,7 +92,7 @@ Here's an example of the return results of `AI_GENERATE_CHUNKS` with the followi
91
92
92
93
- Chunk size of 50 characters.
93
94
94
-
- The 'chunk_set_id' is enabled.
95
+
- The `chunk_set_id` is enabled.
95
96
96
97
- Chunk text: `All day long we seemed to dawdle through a country which was full of beauty of every kind. Sometimes we saw little towns or castles on the top of steep hills such as we see in old missals; sometimes we ran by rivers and streams which seemed from the wide stony margin on each side of them to be subject to great floods.`
97
98
@@ -147,7 +148,7 @@ CROSS APPLY
147
148
148
149
### A. Chunk a text column with FIXED type and size of 100 characters
149
150
150
-
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column. It uses a `chunk_type` of `FIXED` and a `chunk_size` of 100 characters.
151
+
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column. It uses a `CHUNK_TYPE` of `FIXED` and a `CHUNK_SIZE` of 100 characters.
151
152
152
153
```sql
153
154
SELECTc.chunk
@@ -158,7 +159,7 @@ CROSS APPLY
158
159
159
160
### B. Chunk a text column with overlap
160
161
161
-
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column using overlap. It uses the chunk_type of FIXED, a chunk_size of 100 characters, and an overlap of 10 percent.
162
+
The following example uses `AI_GENERATE_CHUNKS` to chunk a text column using overlap. It uses the `CHUNK_TYPE` of `FIXED`, a `CHUNK_SIZE` of 100 characters, and an overlap of 10 percent.
`AI_GENERATE_EMBEDDINGS` is a built-in function that creates embeddings (vector arrays) using a precreated AI model definition stored in the database.
28
28
29
+
> [!NOTE]
30
+
> `AI_GENERATE_EMBEDDINGS` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **Always-up-to-date**[update policy](/azure/azure-sql/managed-instance/update-policy).
The following scalar functions perform operations on [vectors](../../sql-server/ai/vectors.md) in binary format, allowing applications to store and manipulate vectors in the SQL Database Engine.
28
28
29
29
> [!NOTE]
30
-
>
31
-
> Vector features are available in Azure SQL Managed Instance with the **SQL Server 2025** or **Always-up-to-date**[update policy](/azure/azure-sql/managed-instance/update-policy).
30
+
> Vector features are available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **SQL Server 2025** or **Always-up-to-date**[update policy](/azure/azure-sql/managed-instance/update-policy).
32
31
33
-
All Vector functions support the [Vector data type](../data-types/vector-data-type.md).
32
+
All vector functions support the [**vector** data type](../data-types/vector-data-type.md).
Creates an external model object that contains the location, authentication method, and purpose of an AI model inference endpoint.
33
33
34
+
> [!NOTE]
35
+
> `CREATE EXTERNAL MODEL` is available in [!INCLUDE [ssazuremi-md](../../includes/ssazuremi-md.md)] with the **Always-up-to-date**[update policy](/azure/azure-sql/managed-instance/update-policy).
@@ -39,7 +42,7 @@ Creates an external model object that contains the location, authentication meth
39
42
CREATE EXTERNAL MODEL external_model_object_name
40
43
[ AUTHORIZATION owner_name ]
41
44
WITH
42
-
( LOCATION = '<prefix>://<path>[:<port>]'
45
+
( LOCATION = '<prefix>://<path>[:<port>]'
43
46
, API_FORMAT = '<OpenAI, Azure OpenAI, etc>'
44
47
, MODEL_TYPE = EMBEDDINGS
45
48
, MODEL = 'text-embedding-model-name'
@@ -51,11 +54,11 @@ WITH
51
54
52
55
## Arguments
53
56
54
-
### external_model_object_name
57
+
### *external_model_object_name*
55
58
56
59
Specifies the user-defined name for the external model. The name must be unique within the database.
57
60
58
-
### owner_name
61
+
### *owner_name*
59
62
60
63
Specifies the name of the user or role that owns the external model. If you don't specify this argument, the current user becomes the owner. Depending on permissions and roles, you might need to grant explicit permission to users to use specific external models.
61
64
@@ -402,7 +405,7 @@ Use the following PowerShell script to provide the MSSQLLaunchpad user access to
0 commit comments