🤖 AI Bot Agent - Intelligent command line assistant with chat, code generation, file analysis, and web search capabilities
Project description
🤖 AI Bot Agent
A powerful AI assistant that runs from the command line with various capabilities including chat, code generation, file analysis, and web search.
Features
- Interactive Chat Mode: Have conversations with the AI
- Code Generation: Generate code from natural language descriptions
- File Analysis: Analyze and get insights about your files
- Web Search: Search for information on the web
- Rich CLI Interface: Beautiful terminal interface with colors and formatting
- Conversation History: Maintains context across interactions
- Multiple AI Models: Support for different OpenAI models
- Easy Setup: Automated OpenAI API key configuration
Installation
Prerequisites
- Python 3.8 or higher
- OpenAI API key
Quick Start
-
Install the package
pip install ai-bot-agent
-
Set up your API key
ai-bot setupThis will:
- Open the OpenAI API key page in your browser
- Guide you through creating an API key
- Test and save your key automatically
-
Start using the bot
ai-bot chat
Alternative Installation
You can also install from source:
git clone https://github.com/thiennp/cli-smart.git
cd cli-smart
pip install -r requirements.txt
python main.py setup
Usage
Easy Setup
Set up your OpenAI API key with automated assistance:
ai-bot setup
This command will:
- Open https://platform.openai.com/api-keys in your browser
- Guide you through creating an API key
- Test the key to ensure it works
- Save it securely to your
.envfile
Interactive Chat Mode
Start an interactive conversation with the AI:
ai-bot chat
Ask a Single Question
Ask a specific question:
ai-bot ask "What is machine learning?"
Generate Code
Generate code from a description:
ai-bot code "Create a simple web scraper"
Generate code in a specific language:
ai-bot code "Create a REST API" --lang javascript
Analyze Files
Analyze a file and get insights:
ai-bot analyze main.py
Search the Web
Search for information:
ai-bot search "latest Python features"
Clear History
Clear conversation history:
ai-bot clear
Get Help
Show help information:
ai-bot help
Configuration
The setup command automatically creates a .env file with your configuration:
OPENAI_API_KEY=your_openai_api_key_here
You can also manually edit the .env file to customize:
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Optional: Customize the AI model
OPENAI_MODEL=gpt-3.5-turbo
# Optional: Set default temperature for responses
OPENAI_TEMPERATURE=0.7
# Optional: Set maximum tokens for responses
OPENAI_MAX_TOKENS=1000
Examples
Chat Mode Examples
You: What is Python?
AI Bot: Python is a high-level, interpreted programming language...
You: Write a function to calculate fibonacci numbers
AI Bot: Here's a Python function to calculate Fibonacci numbers...
You: Explain machine learning in simple terms
AI Bot: Machine learning is like teaching a computer to learn...
Code Generation Examples
# Generate a Python web scraper
ai-bot code "Create a web scraper that extracts titles from a news website"
# Generate a JavaScript function
ai-bot code "Create a function to validate email addresses" --lang javascript
# Generate a data analysis script
ai-bot code "Create a script to analyze CSV data and create visualizations"
Features in Detail
Easy Setup
- Automated browser opening to OpenAI API key page
- Step-by-step guidance for API key creation
- Automatic validation and testing of API keys
- Secure storage in
.envfile
Interactive Chat Mode
- Maintains conversation context
- Rich formatting with colors
- Easy-to-use interface
- Built-in commands (exit, clear, help)
Code Generation
- Supports multiple programming languages
- Generates complete, working code
- Includes explanations and usage examples
- Optimized for different use cases
File Analysis
- Analyzes code structure and purpose
- Identifies potential issues
- Provides improvement suggestions
- Works with various file types
Web Search
- Search for current information
- Get real-time data
- Research capabilities
- Information gathering
Troubleshooting
Common Issues
-
API Key Error
Error: OpenAI client not initialized. Please check your API key.Solution: Run
ai-bot setupto configure your API key -
Module Not Found
ModuleNotFoundError: No module named 'openai'Solution: Install dependencies with
pip install ai-bot-agent -
Permission Denied
PermissionError: [Errno 13] Permission deniedSolution: Make sure the script is executable:
chmod +x main.py
Getting Help
- Use
ai-bot helpfor command help - Use
ai-bot --helpfor general help - Check the logs for detailed error messages
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Version History
- v1.0.0: Initial release with basic chat, code generation, and file analysis features
- v1.1.0: Added automated setup command for easy API key configuration
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 ai_bot_agent-1.1.0.tar.gz.
File metadata
- Download URL: ai_bot_agent-1.1.0.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16dbf1a3c44e863f96f5da72437a9df4e9a22de63a305216af9ec328e39fa866
|
|
| MD5 |
a2885ff6b2c88964a261d5261cf2d9ba
|
|
| BLAKE2b-256 |
9fe4181491b4dda4144c9ee058439dfbdc56fd28c6b151dee02461893cd1c1b9
|
File details
Details for the file ai_bot_agent-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ai_bot_agent-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5a725e3972f1f3c5f47c843079c162552041e66a20f79fbd962ef674554248e
|
|
| MD5 |
27919f079a34e7d1d68603826aa750d7
|
|
| BLAKE2b-256 |
cf0c350467509bca1d909662067ef22126c7870d590b3239872d44af1b080773
|