Update README.md
Browse files
README.md
CHANGED
@@ -14,25 +14,25 @@ pinned: false
|
|
14 |
[![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs)
|
15 |
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://chatbotmaritacaai-jkiyzmcjcuvduw5dzymwu5.streamlit.app/)
|
16 |
|
17 |
-
|
18 |
|
19 |
-
##
|
20 |
|
21 |
Reinaldo Chaves ([email protected])
|
22 |
|
23 |
-
##
|
24 |
|
25 |
-
-
|
26 |
-
- Upload
|
27 |
-
-
|
28 |
-
-
|
29 |
-
-
|
30 |
-
-
|
31 |
-
-
|
32 |
-
-
|
33 |
-
-
|
34 |
|
35 |
-
##
|
36 |
|
37 |
- Python 3.7+
|
38 |
- Streamlit
|
@@ -41,79 +41,79 @@ Reinaldo Chaves ([email protected])
|
|
41 |
- PyPDF2
|
42 |
- MaritalkAI
|
43 |
- HuggingFace Embeddings
|
44 |
-
-
|
45 |
|
46 |
-
##
|
47 |
|
48 |
-
1. Clone
|
49 |
```
|
50 |
git clone https://github.com/reichaves/chatbotmaritacaai.git
|
51 |
cd chatbotmaritacaai
|
52 |
```
|
53 |
|
54 |
-
2.
|
55 |
```
|
56 |
pip install streamlit langchain langchain_huggingface maritalk faiss-cpu tenacity cachetools
|
57 |
```
|
58 |
|
59 |
-
3. Configure
|
60 |
-
-
|
61 |
-
-
|
62 |
|
63 |
-
##
|
64 |
|
65 |
-
1.
|
66 |
```
|
67 |
streamlit run app.py
|
68 |
```
|
69 |
|
70 |
-
2.
|
71 |
-
3.
|
72 |
-
4.
|
73 |
-
5.
|
74 |
|
75 |
-
##
|
76 |
|
77 |
-
1. **Upload
|
78 |
-
2. **
|
79 |
-
3. **
|
80 |
-
4. **
|
81 |
-
5. **
|
82 |
-
6. **
|
83 |
-
7. **
|
84 |
|
85 |
-
##
|
86 |
|
87 |
-
-
|
88 |
-
-
|
89 |
-
-
|
90 |
-
-
|
91 |
-
-
|
92 |
|
93 |
-
##
|
94 |
|
95 |
-
-
|
96 |
-
-
|
97 |
-
-
|
98 |
-
-
|
99 |
-
- Use
|
100 |
|
101 |
-
##
|
102 |
|
103 |
-
|
104 |
-
1.
|
105 |
-
2.
|
106 |
-
3. Commit
|
107 |
-
4. Push
|
108 |
-
5.
|
109 |
|
110 |
-
##
|
111 |
|
112 |
[MIT License](LICENSE)
|
113 |
|
114 |
-
##
|
115 |
|
116 |
-
|
117 |
|
118 |
```
|
119 |
@software{chatbot-maritacaai-pdfs,
|
|
|
14 |
[![Hugging Face Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/reichaves/Chatbot-with-MaritacaAI-for-PDFs)
|
15 |
[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://chatbotmaritacaai-jkiyzmcjcuvduw5dzymwu5.streamlit.app/)
|
16 |
|
17 |
+
This project implements a conversational Retrieval-Augmented Generation (RAG) system using Streamlit, LangChain, and large language models from [MaritacaAI](https://www.maritaca.ai/) - a Brazilian startup focused on specializing language models for specific domains and languages - specialized in Brazilian Portuguese. The application allows users to upload PDF documents, ask questions about their content, and maintain a chat history for context in ongoing conversations.
|
18 |
|
19 |
+
## Author
|
20 |
|
21 |
Reinaldo Chaves ([email protected])
|
22 |
|
23 |
+
## Features
|
24 |
|
25 |
+
- Streamlit user interface with dark theme and responsive layout
|
26 |
+
- Upload and processing of multiple PDF files
|
27 |
+
- Document processing using LangChain and FAISS
|
28 |
+
- Answer generation using MaritacaAI's sabia-3 model specialized in Brazilian Portuguese
|
29 |
+
- Text embeddings using Hugging Face's all-MiniLM-L6-v2 model
|
30 |
+
- Persistent chat history to maintain conversation context
|
31 |
+
- Sidebar with important user guidelines
|
32 |
+
- Token count per response
|
33 |
+
- Special formatting for legal documents and FOI (Freedom of Information) requests
|
34 |
|
35 |
+
## Requirements
|
36 |
|
37 |
- Python 3.7+
|
38 |
- Streamlit
|
|
|
41 |
- PyPDF2
|
42 |
- MaritalkAI
|
43 |
- HuggingFace Embeddings
|
44 |
+
- Other dependencies listed in `requirements.txt`
|
45 |
|
46 |
+
## Installation
|
47 |
|
48 |
+
1. Clone this repository:
|
49 |
```
|
50 |
git clone https://github.com/reichaves/chatbotmaritacaai.git
|
51 |
cd chatbotmaritacaai
|
52 |
```
|
53 |
|
54 |
+
2. Install dependencies:
|
55 |
```
|
56 |
pip install streamlit langchain langchain_huggingface maritalk faiss-cpu tenacity cachetools
|
57 |
```
|
58 |
|
59 |
+
3. Configure the necessary API keys:
|
60 |
+
- Maritaca AI API key (https://plataforma.maritaca.ai/)
|
61 |
+
- Hugging Face API token (https://huggingface.co/docs/hub/security-tokens)
|
62 |
|
63 |
+
## Usage
|
64 |
|
65 |
+
1. Run the Streamlit application:
|
66 |
```
|
67 |
streamlit run app.py
|
68 |
```
|
69 |
|
70 |
+
2. Open your browser and access the local address shown in the terminal.
|
71 |
+
3. Enter your API keys when prompted.
|
72 |
+
4. Upload one or more PDF files.
|
73 |
+
5. Ask questions about the documents' content in the text input box.
|
74 |
|
75 |
+
## How it Works
|
76 |
|
77 |
+
1. **Document Upload**: Users upload PDF files, which are processed and split into smaller chunks.
|
78 |
+
2. **Embedding Creation**: The text is converted into embeddings using Hugging Face's all-MiniLM-L6-v2 model.
|
79 |
+
3. **Vector Storage**: Embeddings are stored in a FAISS database for efficient retrieval.
|
80 |
+
4. **Question Processing**: User questions are contextualized based on chat history.
|
81 |
+
5. **Information Retrieval**: The system retrieves the most relevant text chunks based on the question.
|
82 |
+
6. **Answer Generation**: MaritacaAI's sabia-3 model generates an answer in Brazilian Portuguese based on the retrieved chunks and question.
|
83 |
+
7. **History Maintenance**: Chat history is maintained to provide context in ongoing conversations.
|
84 |
|
85 |
+
## Special Features
|
86 |
|
87 |
+
- Special formatting for legal document analysis
|
88 |
+
- Detailed processing of Freedom of Information (FOI) documents
|
89 |
+
- Cache system for better performance
|
90 |
+
- Robust error handling
|
91 |
+
- Adaptive interface that maintains conversation context
|
92 |
|
93 |
+
## Important Notices
|
94 |
|
95 |
+
- Do not share documents containing sensitive or confidential information
|
96 |
+
- AI-generated responses may contain errors or inaccuracies
|
97 |
+
- Always verify information with original sources
|
98 |
+
- This project is for educational and demonstration purposes
|
99 |
+
- Use responsibly and in compliance with API usage policies
|
100 |
|
101 |
+
## Contributions
|
102 |
|
103 |
+
Contributions are welcome! Please:
|
104 |
+
1. Fork the project
|
105 |
+
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
|
106 |
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
107 |
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
108 |
+
5. Open a Pull Request
|
109 |
|
110 |
+
## License
|
111 |
|
112 |
[MIT License](LICENSE)
|
113 |
|
114 |
+
## Citation
|
115 |
|
116 |
+
If you use this project in your research or application, please cite:
|
117 |
|
118 |
```
|
119 |
@software{chatbot-maritacaai-pdfs,
|