# Project Configuration (LTM) *This file contains the stable, long-term context for the project.* *It should be updated infrequently, primarily when core goals, tech, or patterns change.* --- ## Core Goal Develop a Python-based Flask application that integrates with Zulip to: * Connect to a Zulip PostgreSQL database. * Retrieve messages from the specified channels: **IT Discussions, IT Knowledge, IT Support**. * Embed these messages into ChromaDB for efficient retrieval. * Implement a Zulip bot named **IT\_Bot** that responds to user queries when mentioned using the format `@**IT_Bot**`. * Generate context-based responses using the Gemini API. --- ## Tech Stack * **Backend:** Python, Flask * **Database:** PostgreSQL (Zulip DB), ChromaDB * **AI Integration:** Gemini API * **Bot Framework:** Zulip Bot API * **Environment Management:** Virtualenv or Conda * **Version Control:** Git --- ## Critical Patterns & Conventions * **Database Access:** * Store database credentials securely (e.g., environment variables or a secrets manager). * Use SQLAlchemy ORM for structured queries. * **Message Retrieval:** * Implement periodic tasks to pull messages from the channels. * Ensure idempotent operations to prevent duplicates in ChromaDB. * **Embedding Strategy:** * Embed messages with metadata (e.g., channel name, timestamp, user ID). * **Bot Activation:** * The bot listens for `@**IT_Bot**` mentions. * Upon activation, relevant context is fetched from ChromaDB, and a response is generated using the Gemini API. * **Error Handling:** * Implement structured logging. * Gracefully handle API rate limits and database connection errors. * **Security:** * Store credentials and API keys in environment variables. * Implement rate limiting to prevent abuse. --- ## Key Constraints * **Channels Monitored:** IT Discussions, IT Knowledge, IT Support * **Response Trigger:** Mentions of `@**IT_Bot**` * **Language Support:** English, Georgian * **Message Volume:** Approximately 500 messages per day. * **Deployment:** Local network server * **Zulip Bot Config:** ``` [api] email=IT_bot-bot@zulip.lci.ge key=ta8x0Rwlf5yLlZutETiTZbHFtQMVOv1z site=https://zulip.lci.ge ``` * **Database Connection:** `zulip:BlackMoonSky89@zulip.lci.ge:5432/zulip` * **Gemini API Key:** `AIzaSyD_VYKUcleCUkAxZj1sX3pWLHvGk0HDe9s`