답변 추출

Snowflake에서 시작하는 생성형 AI

James Cha-Earley

Senior Developer Advocate, Snowflake

답변 추출을 사용하는 이유는?

$$

  • 불만 사항 파악
  • 편의시설 관련 피드백 추출
  • 긴 문서에서 질문에 답변

물음표가 있는 문서 주위에 웃는 얼굴과 슬픈 얼굴 이모지가 있는 이미지, 각 리뷰의 내용을 알 수 없음을 나타냄

Snowflake에서 시작하는 생성형 AI

흔한 비즈니스 문제

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가 해결해 줍니다!
Snowflake에서 시작하는 생성형 AI

답변 추출하기

from snowflake.cortex import extract_answer

response = extract_answer( from_text=review, question="What did the guest complain about?" )
Snowflake에서 시작하는 생성형 AI

결과물

print(response)
[
    {
    "answer": "Management needs to hire more staff.",
    "score": 0.8013839254
    }
]
  • 0에서 1 사이의 점수
Snowflake에서 시작하는 생성형 AI

워크플로 구성하기

SELECT DESCRIPTION
FROM HOTELS.REVIEWS
WHERE RATING < 6
    AND DATE = '2023-08-23';
Snowflake에서 시작하는 생성형 AI

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!!!
Snowflake에서 시작하는 생성형 AI

질문하기

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

response = extract_answer( from_text=negative_review, question="What was the primary issue that the guest mentioned?" ) print(response)
Snowflake에서 시작하는 생성형 AI

응답 검토하기

[
    {
    "answer" : "Expedia falsely advertised that meals were included, but the
                resort did not offer an all-inclusive package.",
    "score": 0.75829312442
    }
]
Snowflake에서 시작하는 생성형 AI

한계

$$

  • 부분적이거나 모호한 문구를 반환할 수 있음
  • 여러 주제가 섞인 문서보다 단락에 사용하는 것이 적합
  • 중요한 결과물은 항상 검토

주의 표지판

Snowflake에서 시작하는 생성형 AI

연습해 봅시다!

Snowflake에서 시작하는 생성형 AI

Preparing Video For Download...