共用方式為


ai_summarize函式

適用於: 核取記號為「是」Databricks SQL 核取記號為「是」Databricks Runtime

重要

這項功能處於公開預覽狀態

在預覽中:

  • 基礎語言模型可以處理數種語言,不過這些函數會針對英文進行調整。
  • 基礎的 Foundation Model API 有速率限制。 請參閱<Foundation Model API 限制>以更新這些限制。

ai_summarize() 函數可讓您叫用最先進的生成式 AI 模型,以使用 SQL 產生指定文字的摘要。 此函數會使用 Databricks Foundation Model API 所提供之端點的聊天模型。

需求

重要

目前可能使用的基礎模型是在 Apache 2.0 授權或 Llama 2 社群授權之下獲得授權。 Databricks 建議檢閱這些授權,以確保符合任何適用的條款。 如果模型在未來根據 Databricks 的內部基準而表現更好,Databricks 可能會變更模型 (以及此頁面提供的適用授權清單)。

目前 Mixtral-8x7B Instruct 是支援這些 AI 函數的基礎模型。

注意

在 Databricks Runtime 15.1 和更新版本中,Databricks 筆記本支援此函數,包括在 Databricks 工作流程中作為任務執行的筆記本。

語法

ai_summarize(content[, max_words])

引數

  • contentSTRING 運算式,要摘要的文字。
  • max_words:選用的非負整數數值運算式,代表傳回之摘要文字中最佳的目標字數。 預設值為 50。 如果設定為 0,則沒有字數限制。

傳回

STRING

如果 contentNULL,結果就是 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."