ai_summarize
函式
適用於: Databricks SQL
函 ai_summarize()
式可讓您叫用最先進的產生 AI 模型,以使用 SQL 產生指定文字的摘要。 此函式會使用 Databricks Foundation Model API 所提供的端點的聊天模型。
需求
重要
目前可能使用的基礎模型會根據 Apache 2.0 授權或 Llama 2 社群授權來授權。 Databricks 建議檢閱這些授權,以確保符合任何適用的條款。 如果模型在未來根據 Databricks 的內部基準檢驗而表現更好,Databricks 可能會變更模型(以及此頁面提供的適用授權清單)。
目前, Mixtral-8x7B 指示 是支持這些 AI 函式的基礎模型。
- 此函式僅適用於基礎模型 API 支援的每個令牌付費區域工作區。
- Azure Databricks SQL 傳統無法使用此函式。
- 檢查 Databricks SQL 定價頁面。
語法
ai_summarize(content[, max_words])
引數
content
STRING
:表達式,要摘要的文字。max_words
:選擇性的非負整數數值表達式,代表傳回摘要文字中最費力的目標字數。 預設值為 50。 如果設定為 0,則沒有字限制。
傳回
STRING
。
如果 content
為 NULL
,則結果為 NULL
。
範例
> SELECT ai_summarize(
'Apache Spark is a unified analytics engine for large-scale data processing. ' ||
'It provides high-level APIs in Java, Scala, Python and R, and an optimized ' ||
'engine that supports general execution graphs. It also supports a rich set ' ||
'of higher-level tools including Spark SQL for SQL and structured data ' ||
'processing, pandas API on Spark for pandas workloads, MLlib for machine ' ||
'learning, GraphX for graph processing, and Structured Streaming for incremental ' ||
'computation and stream processing.',
20
)
"Apache Spark is a unified, multi-language analytics engine for large-scale data processing
with additional tools for SQL, machine learning, graph processing, and stream computing."