All Products
Search
Document Center

MaxCompute:AI_SUMMARIZE

Last Updated:Jul 25, 2026

AI_SUMMARIZE adalah fungsi AI di MaxCompute yang memanggil model untuk menghasilkan ringkasan dari teks input.

Sintaksis

STRING AI_SUMMARIZE(
  STRING <model_name>,
  STRING <version_name>,
  STRING <input>
  [, BIGINT <max_words>]
  [, STRING <model_parameters>]
);

Parameter

  • model_name: Wajib. STRING yang menentukan nama model. Untuk informasi lebih lanjut, lihat fungsi AI SQL.

  • version_name: Wajib. STRING yang menentukan versi model. Untuk memanggil versi default, Anda dapat menentukan DEFAULT_VERSION.

  • input: Wajib. STRING yang menentukan teks yang akan diringkas.

  • max_words: Opsional. Bilangan bulat yang menentukan jumlah maksimum kata yang dapat dihasilkan oleh model besar. Nilai default-nya adalah 50. Jika parameter ini diatur ke 0, tidak ada batasan yang diberlakukan, tetapi output tetap dibatasi oleh model itu sendiri dan parameter max_tokens. Jika batas terlampaui, output akan dipotong.

  • model_parameters: Opsional. STRING yang menentukan parameter model seperti max_tokens, temperature, dan top_p. Formatnya berupa string JSON:

    '{"max_tokens": 500, "temperature": 0.6, "top_p": 0.95}'.

    • max_tokens: Jumlah maksimum token yang dihasilkan dalam satu panggilan model. Untuk model publik MaxCompute, nilai default-nya adalah 4.096.

    • temperature: Nilai antara 0 dan 1 yang mengontrol tingkat keacakan output. Nilai yang lebih tinggi menghasilkan output yang lebih kreatif dan beragam, sedangkan nilai yang lebih rendah menghasilkan output yang lebih deterministik dan konservatif.

    • top_p: Nilai antara 0 dan 1 yang membatasi rentang label kandidat yang dapat dipilih oleh model. Nilai yang lebih tinggi memungkinkan rentang yang lebih luas dan hasil yang lebih beragam, sedangkan nilai yang lebih rendah mempersempit rentang dan menghasilkan output yang lebih fokus.

Nilai kembalian

Mengembalikan STRING yang berisi ringkasan dari teks input. Error dikembalikan jika:

  • input bukan STRING.

  • max_words bernilai NULL.

Contoh

Contoh 1: Ringkasan dengan batas kata default

Panggil model publik qwen3.7-max untuk menghasilkan ringkasan teks dengan batas default 50 kata.

SET odps.namespace.schema=true;

SELECT AI_SUMMARIZE(
  bigdata_public_modelset.default.`qwen3.7-max`, 
  default_version, 
  'MaxCompute provides the SQL AI function, which supports AI inference by calling built-in large language models, user-imported models, or remote PAI-EAS models through SQL.') AS info;
-- Hasil berikut dikembalikan:
+------+
| info |
+------+
| MaxCompute provides the SQL AI function, supporting inference by calling built-in large language models, user-imported models, or remote PAI-EAS models via SQL. |
+------+

Contoh 2: Ringkasan dengan batas kata yang ditentukan

Panggil model publik deepseek-v4-pro untuk menghasilkan ringkasan secara batch untuk beberapa artikel dengan batas 30 kata.

-- Data contoh
CREATE TABLE articles (
    article STRING
);

INSERT INTO articles VALUES
    ('Artificial intelligence is reshaping the global economy. Industries from healthcare to finance are adopting AI solutions to automate processes, reduce costs, and improve decision-making. Machine learning models can analyze massive datasets to identify patterns that are difficult for humans to detect. However, the rapid adoption of AI has also raised concerns about job displacement, data privacy, and algorithmic bias. Governments and organizations are actively developing ethical guidelines and regulatory frameworks to ensure the healthy development of AI.'),
    ('Cloud computing has become a key infrastructure for modern businesses. Through cloud migration, companies can reduce capital expenditure on hardware, achieve elastic scaling of resources on demand, and use cutting-edge technologies with low upfront investment. Major cloud service providers like Alibaba Cloud, AWS, and Azure offer a rich set of services covering computing, storage, databases, and AI capabilities. The rise of cloud-native architecture has also driven the widespread adoption of technologies such as microservices, containers, and Serverless.');

-- Hasilkan ringkasan untuk artikel dalam tabel secara batch
SET odps.namespace.schema=true;

SELECT
    AI_SUMMARIZE(
        bigdata_public_modelset.default.`deepseek-v4-pro`,
        DEFAULT_VERSION,
        article,
        30
    ) AS summary,
    article
FROM articles;


-- Hasil berikut dikembalikan:
+------------------------------------------------------+--------------------------------------------------------------------+
|summary                                               |article                                                        |
+------------------------------------------------------+--------------------------------------------------------------------+
| AI is driving automation and data analysis across industries but also raises ethical and regulatory concerns. |Artificial intelligence is reshaping the global economy. Industries from healthcare to finance are adopting AI solutions to automate processes, reduce costs, and improve decision-making. Machine learning models can analyze massive datasets to identify patterns that are difficult for humans to detect. However, the rapid adoption of AI has also raised concerns about job displacement, data privacy, and algorithmic bias. Governments and organizations are actively developing ethical guidelines and regulatory frameworks to ensure the healthy development of AI.    |
| Cloud computing reduces business costs and provides easy access to elastic resources and cutting-edge technologies.        |Cloud computing has become a key infrastructure for modern businesses. Through cloud migration, companies can reduce capital expenditure on hardware, achieve elastic scaling of resources on demand, and use cutting-edge technologies with low upfront investment. Major cloud service providers like Alibaba Cloud, AWS, and Azure offer a rich set of services covering computing, storage, databases, and AI capabilities. The rise of cloud-native architecture has also driven the widespread adoption of technologies such as microservices, containers, and Serverless.              |
+-------------------------------------------------------+--------------------------------------------------------------------+

FAQ

Penyelesaian masalah umum pada model publik

Gejala: Memanggil model publik yang didukung oleh layanan komputasi model mengembalikan error berikut:

FAILED: ODPS-0130071:[1,8] Semantic analysis exception - inference quota status check failed, error message: region cn-shanghai not found in inference quota

Penyebab: Layanan komputasi model tidak aktif di wilayah proyek Anda, misalnya China (Shanghai), sehingga mencegah panggilan ke sumber daya Inferensi AI.

Solusi: Buka Konsol Alibaba Cloud dan aktifkan layanan komputasi model untuk wilayah proyek Anda. Untuk petunjuk lengkap, lihat Pembelian dan penggunaan layanan komputasi model MaxCompute.