logo
March 31, 2023

Chat with Your Product Manual: Simplify Your Life with LangChain and ChatGPT?

How to use ChatGPT to help you easier to use an extreme long product manual
Introduction

Every time you buy a new product, the manufacturers will give you a ton of guidelines.

For instance, let's say we purchase a car like the Honda CR-V, we often receive a lengthy owner's manual. Oh, we have 8 hundred pages to read and that can be overwhelming to me.

A visual depiction of what is being written about

How can we make life easier?

Inspired by @mayowaoshin’s project. I want to try it with my extremely long product manual also.

To make it easier for users to search for the information they need, I decided to explore how to use LangChain and ChatGPT API to create a chatbot that could extract relevant information from the manual and respond to user queries in a conversational way.

A visual depiction of what is being written about

The code is based on this repository

https://github.com/mayooear/gpt4-pdf-chatbot-langchain

How it works

To create the application, I used LangChain, a framework that simplifies the process of building scalable AI/LLM apps and chatbots.

The flow is

  • First, I extracted the text from the PDF file of the Honda CR-V owner's manual and pre-processed it to cleanse the data.
  • Then, converted the text into vector form using Pinecone, a vector store for storing embeddings and text.
  • Finally, I used ChatGPT API to build the chatbot functionality, which allowed users to send messages asking questions about the manual.
  • Place my PDF file here

    bash
    docs/manual/
    ls docs/manual
    ATLA1919OM.pdf

    Ingest the PDF data by command

    bash
    pnpm ingest
    > gpt4-langchain-pdf-chatbot@0.1.0 ingest /Volumes/Backup/workspace/gpt4-pdf-chatbot-langchain
    > tsx -r dotenv/config scripts/ingest-data.ts
    load pdf file docs/manual...
    creating vector store...
    ingestion complete

    It may take us about 5 minutes for a PDF file with 675 pages

    Run the web application

    bash
    pnpm run dev
    > gpt4-langchain-pdf-chatbot@0.1.0 dev /Volumes/Backup/workspace/gpt4-pdf-chatbot-langchain
    > next dev
    ready - started server on 0.0.0.0:3000, url: http://localhost:3000
    info - Loaded env from /Volumes/Backup/workspace/gpt4-pdf-chatbot-langchain/.env
    event - compiled client and server successfully in 8.3s (173 modules)
    Did it work?

    I retrieved some questions about the manual and the chatbot replied to me.

    Demo video here

    Youtube link:

    https://youtu.be/C5VMB8fgIIs

  • How many airbags?
  • How can I connect to the Car play app?
  • How can I adjust the front head restraints?
  • How can I connect a smartphone?
  • How can I replace the tire?
  • How to use the seatbelt?
  • How can i keep my small child safe
  • How I enable the idle stop mode?
  • How can I turn on the audio system?
  • I also tried some Vietnamese questions, it seems ok.

  • Làm thế nào để tôi khởi dộng xe?
  • Làm thế nào để tôi kết nối smartphone?
  • Làm thế nào để tôi thay lốp xe?
  • Results

    The chatbot proved to be accurate and effective in responding to user queries, providing a conversational way to access information from the manual. For example, users could ask questions like "How do I change the oil on my Honda CR-V?" or "What does the check engine light on the Honda CR-V mean?" and the chatbot would provide relevant answers.

    The potential implications of this work are significant, as it has the potential to make the complex technical information more accessible to users. By using LangChain and ChatGPT API to build a chatbot that can converse with users in a natural way, we can streamline the process of finding information in manuals, making it easier for users to understand and use their electronic products.

    How to improve

    This could have broader implications for the field of natural language processing, as developers look for ways to build conversational interfaces that can provide more personalized and effective support to users.

    I think we can do some optimization work to improve the accuracy of the chatbot.

  • Preprocess the text: Now I’m using the raw text data extracted from the PDF file without any pre-processing ex, cleansing data, …
  • Collect more manuals data to help the response more comprehensive
  • For UI, we can add some images to Chatbot’s responses to make it easy for end users.

    Conclusion

    Overall, my exploration into creating a chatbot that could extract information from the Honda CR-V owner's manual using LangChain and ChatGPT API was a success.

    The chatbot proved to be an effective way for users to search for information and get their questions answered in a conversational way. While there is still room for improvement, this application has the potential to simplify the way we interact with product manuals and make the complex technical information more accessible to users.

    I pushed my code to this repo

    https://github.com/tuantranf/gpt4-pdf-chatbot-langchain/tree/feature/read-pdf-manual

    References:

  • LangChain: https://github.com/hwchase17/langchain
  • PipeCone: https://app.pinecone.io/
  • Code base: https://github.com/mayooear/gpt4-pdf-chatbot-langchain
  • Thank you for reading this blog post. I hope you found it informative and interesting!