How nicoeugui/telegram-bank-assistant works
Project type and purpose
• This is a conversational banking assistant bot (“Asistente NicoBank”) built in Python.
• It integrates with Telegram, LangChain, OpenAI (GPT-4 and Whisper), Redis, and is packaged with Docker.
• Purpose: receive text or voice messages, route them through a LangChain “conversation agent,” invoke domain-specific “tools” (balance, transactions, loan simulation), persist state in Redis, and return responses to the user.
File structure
• Top-level:
• bot/ – the application code
– agent/ (conversation_agent.py) – orchestrates LangChain chains & tool routing
– handlers/ – Telegram update handlers (text, audio, errors)
– prompts/ – system prompt templates
– services/ – glue code for Redis, interaction counting, humanization, transcription
– tools/ – LangChain-exposed business logic functions (authenticate, get_balance, etc.)
– utils/ – FFmpeg audio conversion, time utilities
• main.py – entrypoint, initializes Telegram Bot and LangChain agent
• config.py – environment loader and validation
• Dockerfile + docker-compose-*.yml – container definitions for dev & prod
• .github/workflows/deploy.yml – CI/CD pipeline
• tests/ – pytest suites for services and tools
README for additional insights
• The architecture section already shows a high-level flow:
User → Telegram → Handler → LangChain Agent → Tools → Redis
• It also mentions external calls to OpenAI APIs (GPT, Whisper) and FFmpeg for audio.
Detail
• TTL and state keys in Redis (e.g., auth_state:{user_id}).
• Docker Compose layering (dev vs prod) if space allows.
• CI/CD pipeline at the bottom: GitHub Actions → SSH-action → Production Docker Compose.