Conversational Chatbot with Intent, Chat history context using LLM API

0
117

Simple code I wrote a while back to build a conversational chatbot using any LLM API which uses historic conversation for context and intent

Uses standard RAG model with cosine similarity, SQLite for history, FAISS for vectordb, html chatbot served using REST API

Uses Cosine similarity threshold for intent matching to determine if the user query matches a predefined intent in the FAISS vector database

Chat history is summarized in reverse chronological order

Just to show how easy it is to build these apps PoC MVP, functionality using LLMs and coding tools. I used OpenAI API, Grok and Gemini for coding

Done before Cursor, Claude and other AI coding IDE’s existed, so even more easier now with just prompting them to write the entire code and deploy. Doesn’t always work fully so requires manual installation, stitching together code, etc

Code in repo – https://github.com/datawisdomx1/conversationalchatbot

Hope it helps to give some basic ideas and code logic for PoC and MVP