Trích xuất câu trả lời

Giới thiệu về Generative AI trong Snowflake

James Cha-Earley

Senior Developer Advocate, Snowflake

Vì sao dùng trích xuất câu trả lời?

$$

  • Xác định khiếu nại
  • Trích xuất phản hồi về tiện nghi
  • Trả lời câu hỏi từ tài liệu dài

Một tài liệu có dấu hỏi, xung quanh là các emoji mặt cười và buồn, cho thấy ta không biết mỗi đánh giá nói về điều gì

Giới thiệu về Generative AI trong Snowflake

Bài toán kinh doanh thường gặp

review = """
The property needs updating and management needs to hire more staff. 
The staff does everything they can but it is not enough for the number of guests. 
The rooms look old as well as everything in the bathrooms. 
Definitely better options in the hotel zone.
"""
  • Snowflake Cortex sẽ hỗ trợ!
Giới thiệu về Generative AI trong Snowflake

Trích xuất câu trả lời

from snowflake.cortex import extract_answer

response = extract_answer( from_text=review, question="What did the guest complain about?" )
Giới thiệu về Generative AI trong Snowflake

Kết quả

print(response)
[
    {
    "answer": "Quản lý cần tuyển thêm nhân sự.",
    "score": 0.8013839254
    }
]
  • Điểm từ 0 đến 1
Giới thiệu về Generative AI trong Snowflake

Xây dựng quy trình làm việc

SELECT DESCRIPTION
FROM HOTELS.REVIEWS
WHERE RATING < 6
    AND DATE = '2023-08-23';
Giới thiệu về Generative AI trong Snowflake

Kết quả SQL

I will never book a vacation through Expedia not only did I pay over 5;000 dollars
but they false advertise the resort; in my reservation It clearly stated that
breakfast and dinner was included. When I got to the resort they informed me that 
these issues have happed before with Expedia because the resort does not offer an
all exclusive. After flighting practically all day I called Expedia and they had me
on hold for 45min and nothing got resolved. I ended up spending over 1000.00 more
just on food. I am beyond me they are not only false advertising but refused to
take any responsibility on their part for the issues they caused me and my family.  Again I will never chose Expedia to plan a vacation!!!
Giới thiệu về Generative AI trong Snowflake

Đặt câu hỏi

negative_review = cell1.to_pandas()['DESCRIPTION'].iloc[0]

response = extract_answer( from_text=negative_review, question="What was the primary issue that the guest mentioned?" ) print(response)
Giới thiệu về Generative AI trong Snowflake

Xem lại phản hồi

[
    {
    "answer" : "Expedia đã quảng cáo sai rằng bao gồm bữa ăn, nhưng
                khu nghỉ không có gói trọn gói.",
    "score": 0.75829312442
    }
]
Giới thiệu về Generative AI trong Snowflake

Hạn chế

$$

  • Có thể trả về cụm từ không đầy đủ hoặc mơ hồ
  • Tốt nhất dùng cho đoạn văn, không phải tài liệu đa chủ đề
  • Luôn rà soát kết quả quan trọng

Biển cảnh báo

Giới thiệu về Generative AI trong Snowflake

Vamos praticar!

Giới thiệu về Generative AI trong Snowflake

Preparing Video For Download...