Skip to content

Mahajan-Sachin/ai_companion

Repository files navigation

AI Companion – Retrieval Augmented Conversational AI

AI Companion is a context-aware conversational AI system that simulates emotionally intelligent dialogue. The system uses a Retrieval-Augmented Generation (RAG) architecture to remember past conversations and generate more personalized responses over time.

The application combines a Django backend, a vector database for memory storage, and an LLM-powered response system to create a companion-style chatbot capable of multi-turn conversations.

image

Features

Context-aware conversational AI using Retrieval-Augmented Generation (RAG)

Long-term memory using ChromaDB vector database

Semantic search using Sentence Transformer embeddings

Emotion-aware responses using a transformer-based classifier

Short-term conversation history + long-term semantic memory

Dynamic chat interface with message bubbles, avatars, and typing simulation

Multi-language conversational support (English, Hindi, Hinglish)


System Architecture

User Message

Emotion Detection (Transformer Model)

Semantic Retrieval from Vector Database (ChromaDB)

Conversation History + Retrieved Context

LLM Response Generation (Groq – Llama 3.1)

Memory Storage (Vector + Chat History)


Tech Stack

Backend

Python

Django

AI / LLM

LangChain (LCEL)

Groq API (Llama 3.1)

Vector Database

ChromaDB

NLP / ML

Sentence Transformers

HuggingFace Transformers

PyTorch

Scikit-learn

Frontend

HTML

CSS

JavaScript

Other Tools

python-dotenv

SQLite


Key Concepts Implemented

Retrieval-Augmented Generation (RAG)

Semantic search using vector embeddings

Conversational memory systems

Emotion-aware dialogue generation

Context retention across multi-turn conversations

Project Structure image


How It Works

User sends a message through the chat interface.

The system detects the user's emotional tone.

The message is converted into embeddings using Sentence Transformers.

Relevant past memories are retrieved from ChromaDB using semantic similarity.

Retrieved context + conversation history are passed to the LLM.

The LLM generates a contextual and emotionally aware response.

The interaction is stored in both short-term and long-term memory.


Future Improvements

Streaming responses (token-by-token generation)

User profiles and persistent conversation sessions

Voice interaction support

Mobile-responsive UI

Advanced memory summarization


Author

Sachin Mahajan

About

No description, website, or topics provided.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors