ai_summarize 函数

适用于:勾选“是” Databricks SQL 勾选标记为“是” Databricks Runtime

重要

此功能目前以公共预览版提供。

在预览期间,基础语言模型可以处理多种语言,但此 AI 函数针对英语进行了优化。

ai_summarize() 函数允许调用最先进的生成式 AI 模型,使用 SQL 生成给定文本的摘要。 此函数使用由 Databricks 基础模型 API 提供的聊天模型服务端点。

要求

重要

目前可能使用的基础模型根据 Apache 2.0 许可证及版权 © Apache Software Foundation,或根据 LLAMA 3.3 社区许可证 及版权 © Meta Platforms, Inc. 获得许可。保留所有权利。 客户需负责确保遵守适用的模型许可条款。

Databricks 建议查看这些许可证,以确保遵守任何适用的条款。 如果模型在未来根据 Databricks 的内部基准表现更好,Databricks 可能会更改模型(以及本页中提供的适用许可证列表)。

语法

ai_summarize(content[, max_words])

争论

  • content:一个 STRING 表达式,即要汇总的文本。
  • 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."