File size: 3,993 Bytes
1f1055d c9d0d48 1f1055d c9d0d48 c3160da 3cedfb2 1f1055d c5fdbec c9d0d48 3cedfb2 23b5a44 1f1055d 3d48e06 1f1055d 3d48e06 c2bb300 3d48e06 c2bb300 3d48e06 c2bb300 3d48e06 c2bb300 3d48e06 c2bb300 3d48e06 c2bb300 3d48e06 | 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 | ---
title: Chatbot for Project Guidance
emoji: 📚
colorFrom: yellow
colorTo: indigo
sdk: gradio
sdk_version: 5.14.0
app_file: app.py
pinned: false
short_description: Custom AI Chatbot for Project Guidance
license: osl-3.0
environment: conda
---
# Custom AI Chatbot for Project Guidance
This project implements a custom AI chatbot designed to guide users through complex projects based on predefined roadmaps and rules.
**Features:**
* **Roadmap-based Guidance:** Follows a structured roadmap defined in `roadmap.yaml`.
* **Rule Enforcement:** Adheres to project rules defined in `rules.yaml`.
* **Dynamic Response Generation:** Provides context-aware and step-by-step guidance.
* **Code Snippet Generation:** Generates complete code snippets for project phases using templates.
* **LLM Selection:** Integrates with Hugging Face Hub for flexible LLM selection (DeepSeek and Gemini models).
* **Model Switching:** Allows users to switch between available LLMs via the UI.
* **Basic LLM Responses:** Generates responses using the selected LLM for general queries.
* **Token Control:** Limits LLM response length using `max_response_tokens` in `configs/chatbot_config.yaml`.
* **Configuration Update Mode:** Allows authorized users to modify chatbot configuration (rules) via chat commands in a special "update mode".
* **Error Handling:** Includes error handling for model loading, switching, and configuration updates, with UI warnings.
* **Deployable on Hugging Face Spaces:** Built using Gradio for easy deployment.
**Important Notes on Safety Settings and Self-Update:**
* **Direct Safety Configuration Limited:** For the Hugging Face models used directly via `transformers` (DeepSeek and Gemini Flash), there are **no easily configurable, standardized "safety settings"**. Safety is model-dependent.
* **Model-Dependent Safety:** Safety behavior is primarily determined by how these models were trained.
* **Configuration-Based Self-Update:** The "self-update" feature is implemented as a *configuration modification* system. It allows authorized users to change the chatbot's rules by modifying the `rules.yaml` file via chat commands in "update mode." **It does not modify the core Python code itself.**
* **Security Warning:** The "self-update" feature, even in its configuration-based form, introduces security considerations. **Secret commands are NOT a robust security measure.** In a real deployment, stronger authentication and authorization would be essential. Use this feature with caution and only in trusted environments.
**Getting Started:**
1. **Clone this repository.**
2. **Install dependencies:** `pip install -r requirements.txt`
3. **Customize `roadmap.yaml` and `rules.yaml`** to define your project guidance.
4. **Configure `configs/chatbot_config.yaml`** to set up LLMs, token limits, and chatbot behavior.
5. **Run the Gradio app:** `python app.py`
6. **To enter update mode:** Type `sagor is python/start` in the chat.
7. **To get help in update mode:** Type `sagor is python/help`.
8. **To exit update mode:** Type `sagor is python/exit`.
9. **Deploy to Hugging Face Spaces** (refer to Hugging Face Spaces documentation).
**Available Models:**
* DeepSeek-R1-Distill-Llama-8B
* Gemini 2.0 Flash (Exp 01-21)
**Further Development:**
* Enhance LLM response generation for more context-aware and project-specific guidance.
* Implement more sophisticated state management to track user progress through the roadmap.
* Improve code generation with more dynamic templates and customization options.
* Develop a more advanced GUI or web-based interface for configuration management.
* Add more LLMs to the selection pool.
* Implement more robust error handling and logging.
* Explore and potentially integrate keyword-based output filtering for basic safety control.
* Investigate using commercial LLM APIs for more advanced safety settings and control.
* **Improve security and authorization for the configuration update mode.**
**License:** [Your License] |