Correct grammar, spelling, and punctuation per row via a registered chat model, preserving meaning and tone.
AI_FIX_GRAMMAR(model_name, text)
AI_FIX_GRAMMAR(text USE MODEL model_name)
## Overview Task sugar over AI_GENERATE: instructs the model to return only the corrected text, preserving meaning and tone, composed after the model's SYSTEM_PROMPT. Shares AI_GENERATE's batching, dedup, response memo, and error semantics. The USE MODEL sugar form is accepted and rewritten to the leading-model-argument form.
| Name | Type | Description |
|---|---|---|
model_name | The registry name of a MODEL_TYPE = CHAT model. Must be constant within a query. | |
text | The text to correct. NULL produces NULL without calling the provider. |
SELECT id, AI_FIX_GRAMMAR('gpt5', user_comment) AS cleaned_comment
FROM community.bronze.comments;