AI_SUMMARIZE, MaxCompute içinde bir modeli çağırarak girdi metninin özetini oluşturan bir yapay zeka işlevidir.
Söz dizimi
STRING AI_SUMMARIZE(
STRING <model_name>,
STRING <version_name>,
STRING <input>
[, BIGINT <max_words>]
[, STRING <model_parameters>]
);
Parametreler
model_name: Zorunludur. Modelin adını belirten STRING değeridir. Daha fazla bilgi için bkz. SQL AI işlevi.
version_name: Zorunludur. Modelin sürümünü belirten STRING değeridir. Varsayılan sürümü çağırmak için
DEFAULT_VERSIONbelirtebilirsiniz.input: Zorunludur. Özetlenecek metni belirten STRING değeridir.
max_words: İsteğe bağlıdır. Tamsayıdır. Büyük dil modelinin üretebileceği maksimum kelime sayısını belirtir. Varsayılan değer 50'dir. Bu parametre 0 olarak ayarlandığında herhangi bir sınır uygulanmaz; ancak çıktı yine de modelin kendi yapısı ve
max_tokensparametresi tarafından kısıtlanır. Sınır aşılırsa çıktı kırpılır.-
model_parameters: İsteğe bağlıdır. STRING türündedir.
max_tokens,temperaturevetop_pgibi model parametrelerini belirtir. Biçim JSON dizesi şeklindedir:'{"max_tokens": 500, "temperature": 0.6, "top_p": 0.95}'.max_tokens: Tek bir model çağrısında üretilecek maksimum token sayısıdır. MaxCompute genel modelleri için varsayılan değer 4.096'dır.
temperature: Çıktının rastgeleliğini kontrol eden 0 ile 1 arasında bir değerdir. Daha yüksek bir değer daha yaratıcı ve çeşitli çıktılar üretirken, daha düşük bir değer daha deterministik ve tutucu sonuçlar verir.
top_p: Modelin seçebileceği aday etiketlerin kapsamını sınırlayan 0 ile 1 arasında bir değerdir. Daha yüksek bir değer daha geniş bir yelpaze ve çeşitlilik sağlarken, daha düşük bir değer kapsamı daraltarak daha odaklı sonuçlar üretir.
Dönüş değeri
Girdi metninin özetini içeren bir STRING döndürür. Aşağıdaki durumlarda hata döner:
inputbir STRING değilse.max_wordsNULL ise.
Örnekler
Örnek 1: Varsayılan kelime sınırı ile özet oluşturma
Varsayılan 50 kelimelik sınır ile metin özeti oluşturmak için qwen3.7-max genel modelini çağırın.
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;
-- The following result is returned:
+------+
| 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. |
+------+
Örnek 2: Belirtilen kelime sınırı ile özet oluşturma
30 kelimelik bir sınır ile birden çok makale için toplu şekilde özetler oluşturmak üzere deepseek-v4-pro genel modelini çağırın.
-- Sample data
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.');
-- Generate summaries for the articles in the table in a 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;
-- The following result is returned:
+------------------------------------------------------+--------------------------------------------------------------------+
|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. |
+-------------------------------------------------------+--------------------------------------------------------------------+
SSS
Genel modellerle ilgili yaygın sorunları giderme
Belirti: Model hesaplama hizmeti tarafından desteklenen bir genel modeli çağırdığınızda aşağıdaki hata döner:
FAILED: ODPS-0130071:[1,8] Semantic analysis exception - inference quota status check failed, error message: region cn-shanghai not found in inference quota
Neden: Projenizin bulunduğu bölgede (örneğin Çin (Şanghay)) model hesaplama hizmeti etkin değildir; bu durum AI çıkarım kaynaklarına yapılan çağrıları engeller.
Çözüm: Alibaba Cloud konsoluna gidin ve projenizin bulunduğu bölge için model hesaplama hizmetini etkinleştirin. Ayrıntılı talimatlar için bkz. MaxCompute model hesaplama hizmetini satın alma ve kullanma.