- Published on
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.
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.
The code is based on this repository
https://github.com/mayooear/gpt4-pdf-chatbot-langchain
To create the application, I used LangChain, a framework that simplifies the process of building scalable AI/LLM apps and chatbots.
The flow is
Place my PDF file here
bashdocs/manual/✗ ls docs/manualATLA1919OM.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.tsload 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 devready - started server on 0.0.0.0:3000, url: http://localhost:3000info - Loaded env from /Volumes/Backup/workspace/gpt4-pdf-chatbot-langchain/.envevent - compiled client and server successfully in 8.3s (173 modules)
I retrieved some questions about the manual and the chatbot replied to me.
Demo video here
Youtube link:
I also tried some Vietnamese questions, it seems ok.
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.
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.
For UI, we can add some images to Chatbot’s responses to make it easy for end users.
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:
Thank you for reading this blog post. I hope you found it informative and interesting!
- Published on