หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
ฟังก์ชันจะ ai.summarize สรุปข้อความจากคอลัมน์เดียวหรือในคอลัมน์ทั้งหมดในแต่ละแถว
Note
- บทความนี้ครอบคลุม
ai.summarizeเกี่ยวกับแพนด้า สําหรับ PySpark โปรดดู ใช้ ai.summarize กับ PySpark - สําหรับฟังก์ชัน AI และข้อกําหนดเบื้องต้นทั้งหมด โปรดดู ภาพรวมของฟังก์ชัน AI
- เปลี่ยนการกําหนดค่าเริ่มต้นสําหรับฟังก์ชัน AI ด้วยแพนด้า
Overview
ฟังก์ชันนี้ai.summarizeขยายคลาส pandas Series เมื่อต้องการสรุปค่าแต่ละแถวจากคอลัมน์นั้นเพียงอย่างเดียว ให้เรียกใช้ฟังก์ชันบนคอลัมน์ข้อความ Pandass DataFrame คุณยังสามารถเรียก ai.summarize ฟังก์ชันบน DataFrame ทั้งหมดเพื่อสรุปค่าในคอลัมน์ทั้งหมดได้อีกด้วย
ฟังก์ชันส่งกลับ Pandas Series ที่ประกอบด้วยข้อมูลสรุปซึ่งสามารถจัดเก็บไว้ในคอลัมน์ DataFrame ใหม่ได้
วากยสัมพันธ์
df["summaries"] = df["text"].ai.summarize()
พารามิเตอร์
| ชื่อ | คำอธิบาย |
|---|---|
instructions ระบุหรือไม่ก็ได้ |
สตริงที่ให้บริบทเพิ่มเติมสําหรับโมเดล AI เช่น ความยาวเอาต์พุต โทนเสียง ผู้ชม หรือโฟกัส คําแนะนําที่แม่นยํายิ่งขึ้นจะให้ผลลัพธ์ที่ดีขึ้น |
การส่งคืน
ฟังก์ชันนี้ส่งคืนชุด pandas ที่มีข้อมูลสรุปสําหรับแต่ละแถวข้อความที่ป้อนเข้า ถ้าข้อความที่ป้อนเข้าถูก nullผลลัพธ์จะเป็น null
ตัวอย่าง
# This code uses AI. Always review output for mistakes.
df= pd.DataFrame([
("Microsoft Teams", "2017",
"""
The ultimate messaging app for your organization—a workspace for real-time
collaboration and communication, meetings, file and app sharing, and even the
occasional emoji! All in one place, all in the open, all accessible to everyone.
"""),
("Microsoft Fabric", "2023",
"""
An enterprise-ready, end-to-end analytics platform that unifies data movement,
data processing, ingestion, transformation, and report building into a seamless,
user-friendly SaaS experience. Transform raw data into actionable insights.
""")
], columns=["product", "release_year", "description"])
df["summaries"] = df["description"].ai.summarize()
display(df)
Output:
ปรับแต่งข้อมูลสรุปด้วยวิธีการ
ใช้ instructions พารามิเตอร์เพื่อควบคุมน้ําเสียง ความยาว ผู้ชม หรือโฟกัสของบทสรุปที่สร้างขึ้นโดยไม่ต้องเปลี่ยนข้อความต้นฉบับ
# This code uses AI. Always review output for mistakes.
df["executive_summary"] = df["description"].ai.summarize(
instructions="Write one concise sentence for a business executive. Focus on product value and avoid marketing language."
)
display(df)
อินพุตหลายรูปแบบ
เมื่อต้องการสรุปรูปภาพ PDF หรือไฟล์ข้อความ ให้ตั้งค่า column_type="path" เมื่อคอลัมน์อินพุตมีสตริงเส้นทางของไฟล์ สําหรับการตั้งค่า โปรดดู ใช้อินพุตหลายรูปแบบกับฟังก์ชัน AI
# This code uses AI. Always review output for mistakes.
custom_df["summary"] = custom_df["file_path"].ai.summarize(
instructions="Summarize this file in one sentence for a support analyst.",
column_type="path",
)
display(custom_df)
เนื้อหาที่เกี่ยวข้อง
- ใช้ ai.summarize กับ PySpark
- เรียนรู้เพิ่มเติมเกี่ยวกับฟังก์ชัน AI
- ใช้อินพุตแบบหลายรูปแบบกับฟังก์ชัน AI
- เปลี่ยนการกําหนดค่าเริ่มต้นสําหรับฟังก์ชัน AI ด้วยแพนด้า
- ทําความเข้าใจการเรียกเก็บเงินสําหรับ AI Functions