Code Monkey home page Code Monkey logo

google-cloud-generative-ai-chatbot's Introduction

Generative AI Customer Service Chatbot

This is a demo of a customer service chatbot using Generative AI through Google Cloud's Vertex AI PaLM APIs. The app also leverages MongoDB Atlas Search to look for relevant answers in a MongoDB Atlas database. Finally, the app can detect dissatisfied customers with sentiment analysis.

Screenshot of the ‘Customer Service Chatbot’ app showing the sentiment analysis of a customer request

Quickstart

  1. MongoDB Atlas setup

    • Deploy a new MongoDB database cluster in your Atlas account. You can use the free M0 tier for this demo.

    • Create a XYZ-Corp database.

    • Create a Customer collection in the XYZ-Corp database and insert the following document.

      {
        "customer_id":"111",
        "conversation":[],
        "Name":"Venkatesh Shanbhag"
      } 
    • Create an Insurance collection in the XYZ-Corp database and insert the following document.

      {
        "context":"You are a Customer support agent with name Sara working for XYZ-corp.\nIt does provides property Insurance. Sara will not reply for any queries regarding other types of insurance.\nThe company covers insurance of properties like - Hospitals, offices, shops, apartments.\nMax insurance covered will decline over period of time.\nXYZ-Corp only covers Fire and Earthquake hazard insurance. \nYou are allowed to provide only the details regarding the company itself.\nDo not repond with sentiment in any of the responses.",
        "type":"Intro"
      }
    • Create a Claims collection in the XYZ-Corp database and insert the following document.

      {
        "claim_number":"12345",
        "Name":"Venkatesh Shanbhag",
        "Claim_amount":{"$numberLong":"10000"},
        "Currency":"USD",
        "Claim_status":"In progress","customer_id":"111"
      }
    • Create an Atlas Search index with the name default on the Claims collection using the default settings. Follow the Atlas Search documentation: https://www.mongodb.com/docs/atlas/atlas-search/create-index/.

    • A small knowledge base is available on chat-search collection. Insert below documents to MongoDB. In real life scenerio instead of text vectors are stored of the text embeddings and search is performed based in vector.

        {"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 clearance\nFollowing a valid claim for damage under\nbuildings Causes below, we will also pay:\n• Architects, surveyors, consulting engineers\nand legal fees, but not fees for preparing a\nclaim;\n• the cost of clearing debris from the site or\ndemolishing or shoring up the buildings;\n• the cost to comply with government or local\nauthority requirements but not if the order\npredates the loss or damage.\n2. Emergency services forced entry\nLoss or damage to the buildings caused when\nthe fire, police or ambulance service has to force\nan entry to the buildings because of an\nemergency or perceived emergency involving\nyou or your family.\n3. Moving Home\nIf you have entered into a contract to sell the\nhome, the person buying it will have the full\nprotection of your policy for the buildings up to\nthe date of completion of the purchase, as long\nas the home is not covered by any other\ninsurance.\n4. Keys & locks\nIf your keys are lost or stolen we will pay up to\nthe limit for any one claim for the cost of\nreplacing keys and locks or lock mechanisms to:\n• external doors and windows of the home\n(but not to a garage or outbuildings);\n• a safe within the home;\n• an alarm protecting the home.\nLimit – please refer to your schedule\n5. Alternative Accommodation\nWe will pay you up to the limit for any one claim\nfor the reasonable cost of alternative\naccommodation for you, your family and your\ndomestic pets when your home cannot be lived\nin 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\nproposed is very high. Normally a sum proposed which is seven\nto eight times of the declared income is acceptable for\ninsurance. But proposals do come to the insurer when the\nknown source of income of the proposer is much less compared\nto the amount of insurance desired. A service holder normally\ndoes not face this problem as his sources of income are\nverifiable.\nIn case of business people, the assessed income is at times\nmuch less compared to what is a desirable income for the\namount of insurance desired. In such cases the insurer at\ntimes calls for assessed income tax returns, or Chartered\nAccountant’s certificate etc. Such precautions are necessary\nto 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?"} 
  2. Google Cloud setup

    • Set the Google Cloud project name.

      gcloud config set project <PROJECT_ID>
      
    • Clone the repository.

      git clone https://github.com/mongodb-developer/Google-Cloud-Generative-AI-Chatbot.git
      
    • Update the MongoDB Atlas database connection string and the Google Cloud project name in main.py.

    • Run the application.

      python3 main.py
      

Contributors ✨


Venkatesh Shanbhag

Disclaimer

Use at your own risk; not a supported MongoDB product

google-cloud-generative-ai-chatbot's People

Contributors

sis0k0 avatar theshanbhag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

domminique

google-cloud-generative-ai-chatbot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.