ai_analyze_sentiment
function
Applies to: Databricks SQL
Important
This feature is in Public Preview.
In the preview,
- The underlying language model can handle several languages, however these functions are tuned for English.
- There is rate limiting for the underlying Foundation Model APIs, see Foundation Model APIs limits to update these limits.
The ai_analyze_sentiment()
function allows you to invoke a state-of-the-art generative AI model to perform sentiment analysis on input text using SQL.
Requirements
Important
The underlying models that might be used at this time are licensed under the Apache 2.0 license or Llama 2 community license. Databricks recommends reviewing these licenses to ensure compliance with any applicable terms. If models emerge in the future that perform better according to Databricks’s internal benchmarks, Databricks may change the model (and the list of applicable licenses provided on this page).
Currently, Mixtral-8x7B Instruct is the underlying model that powers these AI functions.
- This function is only available on workspaces in Foundation Model APIs pay-per-token supported regions.
- This function is not available on Azure Databricks SQL Classic.
- Check the Databricks SQL pricing page.
Syntax
ai_analyze_sentiment(content)
Arguments
content
: ASTRING
expression, the text to be analyzed.
Returns
A STRING
. The value is chosen from 'positive'
, 'negative'
, 'neutral'
, or 'mixed'
. Returns null
if the sentiment cannot be detected.
Examples
> SELECT ai_analyze_sentiment('I am happy');
positive
> SELECT ai_analyze_sentiment('I am sad');
negative
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for