There is a need for a custom chatbot that can process multiple PDF files and URLs, allowing users to ask questions related to the content of these documents. The chatbot should provide answers with references and save the conversation history to a PostgreSQL database.
Solution Flowchart:
Solution:
We developed a custom chatbot that accepts PDF files and URLs as input, extracts the text content, and splits it into smaller chunks. These chunks are then embedded using OpenAI embeddings and stored in a vector database (Chroma) for efficient retrieval based on similarity. When a user queries the chatbot, the system retrieves relevant text chunks and generates a response using the OpenAI API, providing references to the source documents. The conversation flow is managed by LangChain, which synchronizes history and context. All conversation history is stored in a PostgreSQL database for future reference and analysis.
Results:
Users can interact with the chatbot to query content from multiple PDFs and URLs.
The chatbot provides accurate answers with references to the source documents.
Conversation history is saved in PostgreSQL, enabling future analysis and review.