AsylBILIM v2 📚 - Your Intelligent Study Companion for Kazakh Students

AsylBILIM is an innovative AI-powered Telegram bot designed specifically to empower Kazakhstani students. Built on a sophisticated Large Language Model (LLM), AsylBILIM provides instant, accurate, and localized assistance for a wide range of academic needs, all in the Kazakh language.

✨ Why AsylBILIM?

Navigating academic challenges can be tough. AsylBILIM streamlines your study process by offering:

  • 100% Kazakh Language Support: Get answers and explanations exclusively in Kazakh, ensuring clarity and cultural relevance.
  • Comprehensive Exam Preparation: Master entrance exams like UNT, IELTS, SAT, and TOEFL with targeted assistance.
  • Academic Writing Aid: Refine your essays, reports, and research papers with intelligent writing support.
  • Study Material Clarification: Understand complex topics and difficult concepts with clear, concise explanations.
  • Personalized Learning Experience: Leverage AI to adapt to your unique learning style and pace.

AsylBILIM is more than just a chatbot; it's your dedicated AI tutor, always ready to help you excel!

🚀 Key Features

  • Intelligent Q&A (LLM-Powered): Ask any academic question and receive accurate, contextually relevant answers based on the advanced Gemini 2.5.
  • Voice Input Support: Seamlessly interact with the bot using voice messages. Our Speech-to-Text service accurately transcribes your Kazakh speech into text for AI processing.
  • Conversation History Management: The bot remembers your past interactions, providing a more coherent and personalized conversation flow (history is stored for 7 days).
  • Efficient Caching System: Frequently asked questions and their responses are cached for faster retrieval and reduced API costs.
  • User Session Management: Keeps track of user-specific data like preferred language and session start time.
  • Robust Error Handling: Provides user-friendly messages for AI generation issues or technical errors.
  • Markdown to HTML Conversion: Ensures well-formatted, readable responses within Telegram using basic markdown (bold, italic, code).

⚙️ Architecture

This version features a modular architecture with clear separation of concerns:

src/
├── bot.py                 # Main bot class and initialization
├── services/
│   ├── ai.py             # AI/LLM service
│   ├── cache.py          # Redis caching service
│   └── speech_to_text.py # Speech recognition service
└── handlers/
    └── message_handler.py # Message handling logic

🛠️ Technologies Used

AsylBILIM is built with a modern and efficient technology stack:

  • Python: The core programming language for the bot's logic.
  • aiogram: A powerful and asynchronous framework for building Telegram bots.
  • Google Generative AI (Gemini API): Powers the core Large Language Model (LLM) for intelligent responses.
  • Redis: Used as a high-performance in-memory data store for caching AI responses and managing user session history.
  • python-dotenv: For secure management of environment variables.
  • Transformers: For advanced speech recognition with Whisper models.
  • PyTorch: Machine learning framework for model inference.
  • pydub: Handles audio file conversions (OGG to WAV) for speech recognition.
  • asyncio: For asynchronous programming, ensuring the bot remains responsive.

🚀 Getting Started

Prerequisites

  • Python 3.8+
  • Redis server
  • GPU support (optional, for faster speech recognition)

Installation

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/KazakhBotv2.git
    cd KazakhBotv2
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Create .env file with your configuration:

    BOT_TOKEN=YOUR_TELEGRAM_BOT_TOKEN
    LLM_API_KEY=YOUR_GOOGLE_GEMINI_API_KEY
    MODEL=gemini-pro
    REDIS_HOST=localhost
    REDIS_PORT=6379
    REDIS_DB=0
    SYSTEM_PROMPT="You are AsylBILIM, an AI assistant for Kazakhstani students..."
    
  4. Start Redis server (if not already running):

    redis-server
    
  5. Run the bot:

    python main.py
    

🤝 Contributing

We welcome contributions from the community! If you'd like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add new feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Open a Pull Request.

Please ensure your code adheres to the existing style and includes relevant tests.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Support

If you have any questions, issues, or suggestions, please feel free to:

  • Open an issue on this GitHub repository.
  • Contact the project maintainers tg:(@Vermeei).

Built With

Share this project:

Updates