Google Cloud의 Vertex AI PaLM API를 통해 Generative AI를 사용하는 고객 서비스 챗봇의 데모입니다. 또한 이 앱은 MongoDB Atlas Search를 활용하여 MongoDB Atlas 데이터베이스에서 관련 답변을 찾습니다. 마지막으로 앱은 감정 분석을 통해 불만족한 고객을 감지할 수 있습니다.
MongoDB Atlas 설정
Atlas 계정에 새 MongoDB 데이터베이스 클러스터를 배포합니다. 이 데모에서는 무료 M0 계층을 사용할 수 있습니다.
XYZ-Corp
데이터베이스를 만듭니다.
XYZ-Corp
데이터베이스에 Customer
컬렉션을 생성하고 다음 문서를 삽입합니다.
{
"customer_id" : " 111 " ,
"conversation" :[],
"Name" : " Venkatesh Shanbhag "
}
XYZ-Corp
데이터베이스에 Insurance
컬렉션을 생성하고 다음 문서를 삽입합니다.
{
"context" : " You are a Customer support agent with name Sara working for XYZ-corp. n It does provides property Insurance. Sara will not reply for any queries regarding other types of insurance. n The company covers insurance of properties like - Hospitals, offices, shops, apartments. n Max insurance covered will decline over period of time. n XYZ-Corp only covers Fire and Earthquake hazard insurance. n You are allowed to provide only the details regarding the company itself. n Do not repond with sentiment in any of the responses. " ,
"type" : " Intro "
}
XYZ-Corp
데이터베이스에 Claims
컬렉션을 생성하고 다음 문서를 삽입합니다.
{
"claim_number" : " 12345 " ,
"Name" : " Venkatesh Shanbhag " ,
"Claim_amount" :{ "$numberLong" : " 10000 " },
"Currency" : " USD " ,
"Claim_status" : " In progress " , "customer_id" : " 111 "
}
기본 설정을 사용하여 Claims
컬렉션에 default
이름으로 Atlas Search 색인을 만듭니다. Atlas 검색 문서(https://www.mongodb.com/docs/atlas/atlas-search/create-index/)를 따르세요.
채팅 검색 컬렉션에서 작은 지식 기반을 사용할 수 있습니다. MongoDB에 아래 문서를 삽입합니다. 실제 장면에서는 텍스트 대신 벡터가 텍스트 임베딩으로 저장되고 검색은 벡터를 기반으로 수행됩니다.
{ "question" : " claim " , "Answer" : " Please provide 5 digit claim number " }
{ "question" : " Not resolved " , "Answer" : " Do you want to connect to an Agent for further assistence " }
{ "question" : " status of a claim " , "Answer" : " Please provide 5 digit claim number " }
{"question":"Company Policy","Answer":"1. Architects fees / Debris clearancenFollowing a valid claim for damage undernbuildings Causes below, we will also pay:n• Architects, surveyors, consulting engineersnand legal fees, but not fees for preparing anclaim;n• the cost of clearing debris from the site orndemolishing or shoring up the buildings;n• the cost to comply with government or localnauthority requirements but not if the ordernpredates the loss or damage.n2. Emergency services forced entrynLoss or damage to the buildings caused whennthe fire, police or ambulance service has to forcenan entry to the buildings because of annemergency or perceived emergency involvingnyou or your family.n3. Moving HomenIf you have entered into a contract to sell thenhome, the person buying it will have the fullnprotection of your policy for the buildings up tonthe date of completion of the purchase, as longnas the home is not covered by any otherninsurance.n4. Keys & locksnIf your keys are lost or stolen we will pay up tonthe limit for any one claim for the cost ofnreplacing keys and locks or lock mechanisms to:n• external doors and windows of the homen(but not to a garage or outbuildings);n• a safe within the home;n• an alarm protecting the home.nLimit – please refer to your schedulen5. Alternative AccommodationnWe will pay you up to the limit for any one claimnfor the reasonable cost of alternativenaccommodation for you, your family and yourndomestic pets when your home cannot be livednin due to loss or damage covered by this policy..nLimit – please refer to your schedule"}
{ "question" : " Proof of income " , "Answer" : " This document may become necessary whenever the sum n proposed is very high. Normally a sum proposed which is seven n to eight times of the declared income is acceptable for n insurance. But proposals do come to the insurer when the n known source of income of the proposer is much less compared n to the amount of insurance desired. A service holder normally n does not face this problem as his sources of income are n verifiable. n In case of business people, the assessed income is at times n much less compared to what is a desirable income for the n amount of insurance desired. In such cases the insurer at n times calls for assessed income tax returns, or Chartered n Accountant’s certificate etc. Such precautions are necessary n to eliminate the possibility of moral hazard. " }
{ "question" : " Not good " , "Answer" : " Do you want to connect via call to a Customer care representative? " }
{ "question" : " bad experience " , "Answer" : " Do you want to connect via call to a Customer care representative? " }
Google 클라우드 설정
Google Cloud 프로젝트 이름을 설정합니다.
gcloud config set project <PROJECT_ID>
저장소를 복제합니다.
git clone https://github.com/mongodb-developer/Google-Cloud-Generative-AI-Chatbot.git
main.py
에서 MongoDB Atlas 데이터베이스 연결 문자열과 Google Cloud 프로젝트 이름을 업데이트합니다.
응용 프로그램을 실행하십시오.
python3 main.py
벤카테시 샨바그 |
사용에 따른 책임은 본인에게 있습니다. 지원되는 MongoDB 제품이 아닙니다.