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

25 / 26

Step 8: Demonstration of Chatbot

Now, it's time to interact with the chatbot we have created.

INSTRUCTIONS
  1. Load Your OpenAI API Key. Populate the * below with your API key:

    import os
    os.environ["OPENAI_API_KEY"] = "***********"
    
  2. Now we will be storing the website content. We'll demonstrate the working on the webpage of our course on Hands-on Generative AI with Langchain and Python. Open the webpage once and go through the content to understand what content will be stored so that you can ask relevant questions to test your chatbot:

    store_docs("https://cloudxlab.com/course/204/certificate-course-on-generative-ai")
    

    Make sure not to run the above cell twice as it will store the same documents twice leading to duplicacy issues.

  3. [Optional]. Let's see how the content is being stored in our vector stores.

    vector_store = get_chroma_client()
    lis = vector_store.get(include=['embeddings','metadatas','documents'])
    print("Number of documents:",len(lis['documents']))
    print("Content of the first document:\n",lis['documents'][0])
    print("\n\nMetadata of the first document:", lis['metadatas'][0])
    print("\n\nEmbeddings:", "Length:", len(lis['embeddings'][1]),"\nEmbedding Vector:",lis['embeddings'][1])
    
  4. Setting Up Organization Information:

    organization_name = "CloudxLab"
    
    organization_info = "Cloudxlab is known for providing courses on several technologies such as Machine Learning, Big Data, Deep Learning, Artificial Intelligence, DevOps, MLOps, etc. It's main perk is the gamified cloud lab where users can practice all the tools related to the mentioned technologies which are pre-installed in parallel to learning."
    
    contact_info = """Email: reachus@cloudxlab.com 
    India Phone: +9108049202224
    International Phone: +1 (412) 568-3901.
    Raise a query: https://cloudxlab.com/reach-us-queries
    Forum: https://discuss.cloudxlab.com/"""
    
  5. Get a Response from the Chatbot. As, we have set verbose to True in our LLM and chain, it will also display the additional info that is being used to generate the response. It will include the prompt which is being passed to LLM, and other info.

    response = get_response("What is the duration of the Generative AI course?", organization_name, organization_info, contact_info)
    
    print("Answer:", response)
    

Now go through the webpage at https://cloudxlab.com/course/204/certificate-course-on-generative-ai and try asking questions about different facts mentioned in the course page and share the answers along with questions in the comment section.

See Answer

No hints are availble for this assesment


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

Loading comments...