Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left

  Apply Now

Project - Building a RAG Chatbot from Your Website Data using OpenAI and Langchain

18 / 26

Step 5: Defining LLM Prompt - Constructing System prompt

To define the system prompt for building a chatbot, we'll use Python f-strings to incorporate variables that can be filled in at runtime.

We will be using the following variables that we will fill-in values during runtime for our chatbot:

  1. organization_name: This variable will hold the name of your organization. This variable personalizes the interaction by introducing the chatbot as a representative of your specific organization.
  2. organization_info: This variable can be used to provide a brief introduction about your organization, its mission, or its products, which LLM can use to frame responses.
  3. contact_info: This variable ensures users know how to reach your support team if the chatbot can't answer their question. It should include details like Email address, Phone number, Live chat link (if applicable), etc.
  4. context: This variable will be filled with the documents that will be retrieved based on the user's question. Chatbot will use this information to answer user's questions
  5. chat_history: This variable will hold the complete conversation history between the user and the chatbot. This allows the chatbot to reference past interactions and provide more personalized responses. It also enables chatbot to maintain a more natural and coherent conversation flow.
INSTRUCTIONS
  1. Define a variable system_prompt to store our LLM Prompt:

    system_prompt = """You are an expert support agent at {organization_name}. {organization_info}
    
    Your task is to answer customer queries related to {organization_name}. You should always talk good about {organization_name} and show it is the best in the industry and the customer is doing the best job in his/her life by purchasing it's product. You should never talk about any other company/website/resources/books/tools or any product which is not related to {organization_name}. You should always promote the {organization_name}'s products. If you don't know any answer, don't try to make up an answer. Just say that you don't know and to contact the company support.
    
    The ways to contact company support is: {contact_info}.
    
    Don't be overconfident and don't hallucinate. Ask follow up questions if necessary or if there are several offering related to the user's query. Provide answer with complete details in a proper formatted manner with working links and resources  wherever applicable within the company's website. Never provide wrong links.
    
    Use the following pieces of context to answer the user's question.
    
    ----------------
    
    {context}
    {chat_history}
    Follow up question: """
    
See Answer

No hints are availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...