|
1 | | -# LangChain Streamlit Chatbot |
| 1 | +# ask.UOS |
| 2 | + |
| 3 | +*AI chatbot for applicants and students – get instant answers about studies, teaching, and campus life.* |
| 4 | + |
2 | 5 | (Under development) |
3 | 6 |
|
4 | | -This project is a chatbot application built using LangChain and Streamlit. The chatbot can interact with users, summarize content, and handle various tasks using different tools and APIs. |
| 7 | +--- |
5 | 8 |
|
6 | 9 | ## Table of Contents |
7 | 10 |
|
8 | 11 | - [Overview](#overview) |
9 | 12 | - [Features](#features) |
10 | 13 | - [Setup](#setup) |
11 | | -- [Translation Mechanism](#translation_mechanism) |
| 14 | + - [Development with Docker](#development-with-docker) |
| 15 | + - [Production with Docker](#production-with-docker) |
| 16 | +- [Configuration](#configuration) |
| 17 | +- [Milvus Vector DB](#milvus-vector-db) |
| 18 | +- [Translation Mechanism](#translation-mechanism) |
12 | 19 |
|
| 20 | +--- |
13 | 21 |
|
14 | 22 | ## Overview |
15 | 23 |
|
16 | | -The LangChain Streamlit Chatbot is designed to provide an interactive interface for users to communicate with a chatbot and thus access to updated information (In this case about a University). It leverages the LangChain library for natural language processing and Streamlit for the web interface. |
| 24 | +ask.UOS is designed to provide an interactive interface for users to communicate with a chatbot and access up-to-date university information. It leverages the `LangChain` library for natural language processing and `Streamlit` for the web interface. The system supports both German and English, and can be easily extended to other languages. |
| 25 | + |
| 26 | +ask.UOS can answer a wide range of general questions about university life in just a few moments, including inquiries about the application process, academic requirements, and various study programs. The chatbot enables users to receive quick support in a conversational manner, without having to wait for office hours or search for the right contact person—available 24/7. For university departments such as student advisory services, the chatbot also helps reduce the volume of support requests. |
| 27 | + |
| 28 | +--- |
17 | 29 |
|
18 | 30 | ## Features |
19 | 31 |
|
20 | | -- Interactive chatbot interface |
21 | | -- Content summarization |
| 32 | +- Interactive chatbot interface for students and applicants |
| 33 | +- Content summarization and document insights |
22 | 34 | - PDF reading and processing |
23 | 35 | - Web scraping and data extraction |
| 36 | +- Multilingual support (German and English) |
24 | 37 | - Customizable prompts and responses |
| 38 | +- Vector database (Milvus) for efficient unstructured data retrieval |
| 39 | + |
| 40 | +--- |
25 | 41 |
|
26 | 42 | ## Setup |
27 | 43 |
|
28 | 44 | ### Prerequisites |
29 | 45 |
|
30 | | -- See `requirements.txt` |
31 | | -- Docker ( for containerization) |
| 46 | +- [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/) |
| 47 | +- (For development) See `requirements.txt` |
| 48 | +- (For production) See `requirements.prod.txt` |
32 | 49 |
|
| 50 | +--- |
33 | 51 |
|
34 | | -### Application Configuration |
35 | | -This application uses a configuration file (`config.yaml`) to manage its settings. The settings are structured in a way that allows for easy customization without modifying the source code. The configuration is validated at startup using Pydantic, ensuring that all required fields are present and correctly formatted. |
| 52 | +### Development with Docker |
36 | 53 |
|
37 | | -#### Congiguration File `config.yaml` |
| 54 | +1. **Clone the repository** |
| 55 | + ```sh |
| 56 | + git clone <your-repo-url> |
| 57 | + cd <your-repo> |
| 58 | + ``` |
38 | 59 |
|
39 | | -The `config.yaml` file should be placed in the root directory of the application. Modify the existing file accordingly (If necessary). |
| 60 | +2. **Create and configure environment file** |
| 61 | + ```sh |
| 62 | + cp .env.dev-example .env.dev |
| 63 | + # Edit .env.dev as needed |
| 64 | + ``` |
40 | 65 |
|
| 66 | +3. **Start the application** |
| 67 | + ```sh |
| 68 | + docker compose up -d |
| 69 | + ``` |
41 | 70 |
|
42 | | -### Installation |
| 71 | +4. **Access the chatbot** |
| 72 | + Open [http://localhost:8501/](http://localhost:8501/) in your browser. |
43 | 73 |
|
44 | | -You can develop or deploy this application using Docker. |
| 74 | +**Note:** If you run the application without Docker, you must set up a Milvus server manually. |
45 | 75 |
|
46 | | -#### Development |
| 76 | +--- |
47 | 77 |
|
| 78 | +### Production with Docker |
48 | 79 |
|
49 | | -1. Create a `.env.dev` file from `env.dev-example` and modify it accordingly. |
50 | | - ``` |
51 | | - cp .env.dev-example .env.dev |
| 80 | +1. **Create and configure environment file** |
| 81 | + ```sh |
| 82 | + cp .env.prod-example .env.prod |
| 83 | + # Edit .env.prod as needed |
52 | 84 | ``` |
53 | | -2. Start the ChatBot application |
| 85 | + |
| 86 | +2. **Set up Nginx configuration (optional, for reverse proxy)** |
| 87 | + ```sh |
| 88 | + cp ./nginx/nginx.conf.example nginx.conf |
| 89 | + # Edit nginx.conf as needed |
54 | 90 | ``` |
55 | | - docker compose up -d |
| 91 | + |
| 92 | +3. **Start the application in production mode** |
| 93 | + ```sh |
| 94 | + docker compose -f docker-compose.prod.yml up -d |
56 | 95 | ``` |
57 | | -3. To access the ChatBot visit ` http://localhost:8501/` |
58 | | - |
59 | | -**Note:** If you run the application without Docker; you need to set up a chromadb server manually. |
60 | 96 |
|
61 | | -#### Production |
| 97 | +--- |
62 | 98 |
|
63 | | -1. Create a `.env.prod` file from `env.prod-example` and modify it accordingly. |
64 | | - ``` |
65 | | - cp .env.prod-example .env.prod |
66 | | - ``` |
67 | | -2. Create a `nginx.conf` file from `nginx.conf-example` and modify it accordingly |
68 | | -``` |
69 | | -cp ./nginx/nginx.conf.example nginx.conf |
70 | | -``` |
| 99 | +## Configuration |
71 | 100 |
|
72 | | -3. Start the ChatBot application |
73 | | - ``` |
74 | | - docker compose -f docker-compose.prod.yml up |
| 101 | +This application uses a configuration file (`config.yaml`) to manage its settings. The configuration is validated at startup using `Pydantic`, ensuring all required fields are present and correctly formatted. |
75 | 102 |
|
| 103 | +- Modify the example file as needed for your environment. |
76 | 104 |
|
| 105 | + ```sh |
| 106 | + cp config_example.yamo config.yaml |
| 107 | + # Edit config.yaml as needed |
| 108 | + ``` |
77 | 109 |
|
| 110 | +--- |
78 | 111 |
|
79 | | -### Chroma DB |
| 112 | +## Milvus Vector DB |
80 | 113 |
|
81 | | -- Data: Place the documents to be processed and embedded here `src/data` |
| 114 | +- A vector database (Milvus) is used for indexing and storage of unstructured data (e.g., pdf files). |
| 115 | +- Milvus is automatically set up via Docker Compose and does not require manual installation. |
| 116 | +- If you are already running a Milvus instance, you can connect ask.UOS with it. See `config_example.yaml` |
82 | 117 |
|
| 118 | +--- |
83 | 119 |
|
84 | 120 | ## Translation Mechanism |
85 | 121 |
|
86 | | -
|
87 | | -This project supports both German and English languages, allowing users to switch between them seamlessly. The translation mechanism is implemented using the `gettext` library: a standard for internationalization and localization in Python. |
| 122 | +ask.UOS supports both German and English, allowing users to switch languages seamlessly. The translation mechanism is implemented using Python’s `gettext` library. |
88 | 123 |
|
89 | 124 | ### How It Works |
90 | 125 |
|
91 | | -1. Translation Setup: |
92 | | - - The system generates a `base.mo`file from `locale/de/LC_MESSAGES/base.po` (This file is autmatically generated when the software is installed using `Docker`) |
93 | | - - The project sets up the translation for German using `gettext.translation`. It installs the German translation and provides a function to translate text. |
94 | | -
|
95 | | -2. Language Initialization: |
| 126 | +1. **Translation Setup** |
| 127 | + - The system generates a `base.mo` file from `locale/de/LC_MESSAGES/base.po` (automatically during Docker build). |
| 128 | + - The project sets up German translation using `gettext.translation` and provides a function for dynamic text translation. |
96 | 129 |
|
97 | | - - The project, using `Streamlit`, sets up a radio button for language selection. It defaults to German if no language is chosen. |
98 | | - - When the user selects a language, the application updates the session state and configuration based on the selected language. |
| 130 | +2. **Language Initialization** |
| 131 | + - Streamlit presents a radio button for language selection (default: German). |
99 | 132 | - The selected language is stored in the session state and query parameters. |
100 | 133 |
|
| 134 | +3. **Usage in Streamlit** |
| 135 | + - Throughout the app, the translation function is used to display text in the user’s chosen language. |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## License |
101 | 142 |
|
102 | | -3. Usage in Streamlit: |
| 143 | +[MIT](LICENSE) |
103 | 144 |
|
104 | | - - Throughout the Streamlit application, the translation function from the session state is used to translate text dynamically based on the selected language. |
105 | 145 |
|
106 | | -By following this approach, the project ensures that all user-facing text can be easily translated and displayed in the user's preferred language. |
|
0 commit comments