A simple Persian-language chatbot based on the Retrieval-Augmented Generation (RAG) architecture. It combines:
- A model to retrieve relevant information from a small knowledge base
- A language model to generate natural language responses
- Supports Persian language queries and responses
- Uses Hugging Face Transformers for text generation
- Employs Sentence Transformers for semantic similarity
- Simple and educational structure for learning RAG concepts
transformers
(for GPT-2 or compatible models)sentence-transformers
(for sentence embeddings)scikit-learn
(for cosine similarity)PyTorch
(for model execution)
- Retrieve relevant knowledge from a simple knowledge base using semantic similarity.
- Build a context prompt using the retrieved information and the user query.
- Generate a response using a causal language model (e.g., GPT-2).
pip install torch transformers sentence-transformers scikit-learn numpy