Created
August 23, 2025 15:21
-
-
Save jeanmidevacc/3b65780548ecaf2e1479beae63514570 to your computer and use it in GitHub Desktop.
snapshot from the dfatabricks documentation to build function on top of ai_query https://docs.databricks.com/aws/en/sql/language-manual/functions/ai_query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE FUNCTION correct_grammar(text STRING) | |
| RETURNS STRING | |
| RETURN ai_query( | |
| 'databricks-meta-llama-3-3-70b-instruct', | |
| CONCAT('Correct this to standard English:\n', text)); | |
| > GRANT EXECUTE ON correct_grammar TO ds; | |
| - DS fixes grammar issues in a batch. | |
| > SELECT | |
| * EXCEPT text, | |
| correct_grammar(text) AS text | |
| FROM articles; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment