AI Assistant Framework with CLI and Telegram Bot
Project description
Assistants Framework
A flexible framework for creating AI assistants with multiple frontend interfaces.
Features
- Multi-Front-End Support: CLI and Telegram interfaces built on the same core framework
- CLI Features: Code highlighting, thread management, editor integration, file input, image generation
- Multiple LLM Support: OpenAI (
gpt-*,o*), Anthropic (claude-*), MistralAI (mistral-*,codestral-*), and image generation (DALL-E) - New Universal Assistant Interface: See MIGRATION_GUIDE.md for details
Installation
Requires Python 3.11+
pip install assistants-framework
For Telegram bot functionality:
pip install assistants-framework[telegram]
Add commands to your PATH:
ai-cli install
Usage
Command Line Interface
ai-cli --help
Key CLI commands (prefixed with /):
/help- Show help message/editor- Open editor for prompt composition/image <prompt>- Generate an image/copy- Copy response to clipboard/new- Start new thread/threads- List and select threads/thinking <level>- Toggle thinking mode (for reasoning models)/last- Retrieve last message
Use the claude command for Anthropic models (Now defaults to Claude 4):
claude -e # Open editor for Claude
There's also a chatgpt command that uses the default ChatGPT model:
chatgpt -t # Continue the last thread with ChatGPT (`gpt-4.1-mini`)
Run migrations in case of breaking changes:
ai-cli migrate
Rebuild the database:
ai-cli rebuild
Telegram Interface
The framework includes a Telegram bot interface with the following features:
- User Management: Authorise/deauthorise users and chats, promote/demote users
- Thread Management: Start new conversation threads
- Auto-Reply Toggle: Enable/disable automatic responses
- Media Generation: Generate images from text prompts
- Voice Responses: Generate audio responses with the
/voicecommand
Key Telegram commands:
/new_thread- Clear conversation history and start a new thread/auto_reply- Toggle automatic responses on/off/image <prompt>- Generate an image from a text prompt/voice <text>- Generate an audio response.
Environment Variables
ASSISTANT_INSTRUCTIONS- System message (default: "You are a helpful assistant")ASSISTANTS_API_KEY_NAME- API key variable name (default:OPENAI_API_KEY)ANTHROPIC_API_KEY_NAME- Anthropic API key variable (default:ANTHROPIC_API_KEY)MISTRAL_API_KEY_NAME- Mistral API key variable (default:MISTRAL_API_KEY)DEFAULT_MODEL- Default model (default:gpt-4o-mini)DEFAULT_CLAUDE_SONNET_MODEL- Default Claude model (default:claude-sonnet-4-20250514)DEFAULT_CLAUDE_OPUS_MODEL- Default Claude Opus model (default:claude-opus-4-1-20250805)DEFAULT_CHATGPT_MODEL- Default ChatGPT model (default:gpt-4.1-mini)DEFAULT_GPT_REASONING_MODEL- Default GPT reasoning model (default:o4-mini)CODE_MODEL- Reasoning model (default:o3-mini)IMAGE_MODEL- Image model (default:dall-e-3)ASSISTANTS_DATA_DIR- Data directory (default:~/.local/share/assistants)ASSISTANTS_CONFIG_DIR- Config directory (default:~/.config/assistants)TG_BOT_TOKEN- Telegram bot tokenOPEN_IMAGES_IN_BROWSER- Open images automatically (default:true)DEFAULT_MAX_RESPONSE_TOKENS- Default max response tokens (default:4096)DEFAULT_MAX_HISTORY_TOKENS- Default max history tokens (default:10000)
Contributing
Contributions welcome! Fork the repository, make changes, and submit a pull request.
TODOs:
- Improved conversation handling/truncation for token limits - currently uses tiktoken for all models
- Additional model/API support
- Additional database support
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file assistants_framework-0.7.7.tar.gz.
File metadata
- Download URL: assistants_framework-0.7.7.tar.gz
- Upload date:
- Size: 55.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3f9ad7fc6dd71de61325a1fb3c1ea3b082b1ea0ab0a1ff69d1769397ff506c0
|
|
| MD5 |
af736df4b14325a53ef283f772e72154
|
|
| BLAKE2b-256 |
1311baed06ab5514c7fa6ab026de7261a66568b89c2f7e7705a76f53213a91b6
|
File details
Details for the file assistants_framework-0.7.7-py3-none-any.whl.
File metadata
- Download URL: assistants_framework-0.7.7-py3-none-any.whl
- Upload date:
- Size: 72.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2e7c13b71f8672ea5cf5a32d1ad56cbaeabb541dec666b5b7f2c1462b3f0b33
|
|
| MD5 |
526c07111f0e2c230e966efa6e9d38a8
|
|
| BLAKE2b-256 |
788e4d037cdfa227d7a04db8951d2615795a82b4a46d8ecc18d97df192846b03
|