File size: 2,370 Bytes
edbb0e4
 
 
 
 
 
 
 
 
 
f15bf20
edbb0e4
f15bf20
edbb0e4
f15bf20
edbb0e4
f15bf20
edbb0e4
f15bf20
edbb0e4
f15bf20
edbb0e4
f15bf20
edbb0e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5bf17f
 
edbb0e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Samsung Manual Chatbot

A chatbot built with **LangChain**, **Gradio**, and **Hugging Face Transformers** that allows you to interact with the **Samsung Manual**.  
It uses embeddings + ChromaDB for retrieval and a conversational chain for contextual Q&A.

---

## Project Structure

LLM_chatbot2/

│── chroma_db/ # Persistent Chroma vector database

│── temp_docs/ # Store documents (Samsung manual here)

│── app.py # Main Gradio app

│── requirements.txt # Dependencies

│── README.md # Project documentation

│── .gitattributes

---

## Features

- **Document Loading** – Loads and processes the Samsung manual (`temp_docs/samsung_manual.txt`).
- **Chunking** – Splits the document into manageable chunks for embeddings.
- **Embeddings** – Uses `sentence-transformers/all-MiniLM-L6-v2` for semantic search.
- **Vector Database** – Stores embeddings in **ChromaDB** for retrieval.
- **Conversational Memory** – Maintains chat context with `ConversationBufferMemory`.
- **LLM Response** – Powered by `google/flan-t5-base` via Hugging Face pipeline.
- **Gradio UI** – Simple chat interface for interacting with the chatbot.

---

## Installation

Clone the repository and install dependencies:

```bash
git clone https://github.com/Anvit25/LLM_chatbot2.git
cd LLM_chatbot2
pip install -r requirements.txt
Running the App
Make sure you have the Samsung manual text file at temp_docs/samsung_manual.txt.

Then run:

python app.py
Gradio will launch a local server. Open the link shown in the terminal (usually http://127.0.0.1:7860) to interact with the chatbot.

```

## Requirements
Dependencies are listed in requirements.txt:

pypdf
gradio
langchain
chromadb
sentence-transformers
transformers
torch

## Usage
Place your document inside temp_docs/ (default: samsung_manual.txt).

Run the app.

Ask natural language questions like:

"How do I reset my Samsung washing machine?"

"Explain the safety precautions in the manual."

The chatbot retrieves relevant chunks from the document and answers conversationally.

## Customization
Change the document: Replace temp_docs/samsung_manual.txt with any .txt file.

Switch embeddings: Modify MODEL_NAME_EMBEDDINGS in app.py.

Try different LLMs: Update MODEL_ID_LLM to another Hugging Face model.

## License
This project is open-source under the MIT License.

---