探索抽象式摘要
抽象式摘要
抽象式摘要依賴生成式 AI 語言模型 (例如 Azure OpenAI) 的自然語言處理功能,來建立擷取原始內容主要意思的原始句子。 它會透過釋義和改寫原始內容來產生摘要的句子。 此方法可提供更多的彈性和創造力,並擷取重要的資訊,同時可以簡潔表達。
抽象式摘要是透過 azure_ai
延伸模組的 azure_cognitive
結構描述中找到的 summarize_abstractive()
函式來完成的。 azure_cognitive
結構描述包含 summarize_abstractive()
函式的三個多載。 三個函式多載預期的引數清單包括:
Argument | 類型 | 預設 | 描述 |
---|---|---|---|
text | text 或 text[] |
應該產生摘要的文字。 | |
language_text | text 或 text[] |
語言代碼 (或語言代碼陣列),代表要總結的文字的語言。 請檢閱支援的語言清單以擷取必要的語言代碼。 | |
sentence_count | integer |
3 | 要產生的摘要句子數目。 |
batch_size | integer |
25 | 僅適用於預期輸入為 text[] 的兩個多載。 指定要一次處理的記錄數目。 |
disable_service_logs | boolean |
false | 指出是否關閉服務記錄的旗標。 |
timeout_ms | integer |
NULL | 逾時 (以毫秒為單位),此時間後停止作業。 |
throw_on_error | boolean |
true | 指出函式是否應該在錯誤時擲回例外狀況從而導致包裝交易復原的旗標。 |
max_attempts | integer |
1 | 在發生失敗時重試對 Azure OpenAI 服務的呼叫次數。 |
retry_delay_ms | integer |
1000 | 嘗試重試呼叫 Azure OpenAI 服務端點之前要等待的時間量 (以毫秒為單位)。 |
每個函式多載都會傳回包含所產生之摘要的句子陣列 (text[]
)。
產生屬性描述的抽象式摘要
作為 Margie's Travel 的開發人員,您想要評估可透過 azure_ai
延伸模組和 Azure AI 服務存取的抽象式技術,並評估該方法對冗長屬性描述產生簡潔、自然語言摘要的能力,例如該資料庫中第一個清單中的以下描述:
"Make yourself at home in this charming one-bedroom apartment, centrally located on the west side of Queen Anne Hill. This elegantly decorated, private apartment (bottom unit of a duplex) has an open floor plan, bamboo floors, a fully equipped kitchen, a TV, DVD player, basic cable, and a cozy bedroom with a queen-size bed. The unit sleeps up to four (two in the bedroom and two on the comfortable fold-out couch, linens included) and includes free Wi-Fi and laundry. The apartment opens onto a private deck, complete with its own barbecue, overlooking a garden and a forest of black bamboo. The Apartment is perfectly located just one block from the bus lines where you can catch a bus and be downtown Seattle in 15 minutes or historic Ballard in 10. A quick five-minute walk brings you to a natural grocery store and coffee shops. Or just take a fifteen-minute walk to the top of Queen Anne Hill where you find various eclectic stores, bars, and restaurants."
您可以使用下列查詢來要求上述屬性描述的兩個句子摘要:
SELECT
azure_cognitive.summarize_abstractive(description, 'en', 2) AS abstractive_summary
FROM listings
WHERE id = 1;
抽象式摘要會傳回兩個產生的句子:
{
"The document describes a one-bedroom apartment located on the west side of Queen Anne Hill. The apartment, which is the bottom unit of a duplex, features an open floor plan, bamboo floors, a fully equipped kitchen, a queen-size bed, and a private deck with a BBQ. It is conveniently located near bus lines, historic Ballard, a grocery store, coffee shops, and various shops and restaurants."
}