Environment Variables
MilesONerd AI uses environment variables for configuration. All settings are stored in a.env file in the project root.
Required Variables
Variable Descriptions
TELEGRAM_BOT_TOKEN (Required)
Your Telegram Bot API token. This is mandatory for the bot to function.Open Telegram and search for @BotFather
@BotFather is Telegram’s official bot for creating and managing bots.
Create a new bot
Send the
/newbot command to @BotFather and follow the prompts:- Choose a name for your bot (e.g., “MilesONerd AI Assistant”)
- Choose a username ending in “bot” (e.g., “milesonerd_ai_bot”)
SERPAPI_API_KEY (Optional)
API key for SerpAPI Google Search integration. Currently planned for future implementation.This feature is not yet implemented in the current version. You can leave this blank for now.
DEFAULT_MODEL (Optional)
Specifies which AI model to use by default. Options:llama- Llama 3.1-Nemotron (default)bart- BART model
ai_handler.py:
ai_handler.py:46
ENABLE_CONTINUOUS_LEARNING (Optional)
Enables or disables continuous learning capabilities. Values:true or false (default: true).
ai_handler.py:47
Continuous learning features are planned for future implementation.
Model Configuration
The bot uses two AI models configured inai_handler.py:
Llama 3.1-Nemotron
Used for text generation and conversational responses:ai_handler.py:34-38
- General text generation
- Conversational responses
- Short and long-form answers
- Context-aware replies
BART
Used for text summarization:ai_handler.py:39-43
- Text summarization
- Long message condensation
- TL;DR generation
Loading Configuration
The bot loads environment variables usingpython-dotenv:
bot.py:4,10-11
.env file when the bot starts.
Verifying Configuration
The bot validates critical configuration on startup:bot.py:133-136
GPU Configuration
The AI handler automatically detects GPU availability:ai_handler.py:57-60
ai_handler.py:73-75
Example Configuration File
Here’s a complete example.env file:
.env
Next Steps
After configuration:- Message Handling - Learn how the bot processes messages
- Deployment - Deploy your configured bot
