aipipe
Aipipe
Aipipe is a command-line tool designed to integrate Large Language Models (LLMs) into shell scripts. It provides a seamless interface to Ollama, supporting pipe operations and making AI capabilities readily available in your command-line workflow.
Features
- Pipe input/output support
- Automatic Ollama service management
- Custom model selection
- System prompt support
- Configurable API endpoints
Prerequisites
Ensure you have the following installed:
Installation
Clone and build the project:
bash
git clone https://github.com/yourusername/aipipe.git
cd aipipe
shards install
crystal build src/aipipe.cr -o bin/aipipe --release
Usage
Basic Commands
# Direct question
aipipe ask "What is 1+1?"
# Using pipes
echo "Explain this code" | aipipe ask
# Specify model
aipipe ask -m codellama "Analyze this code"
# With system prompt
aipipe ask -s "You are a Shell expert" "Optimize this script"
Script Integration
# Log analysis
cat error.log | aipipe ask "Analyze these error messages"
# Code review
git diff | aipipe ask -m codellama "Review these code changes"
# System diagnostics
top -b -n 1 | aipipe ask "Analyze system performance"
Configuration
Configure through environment variables:
# Ollama API endpoint
export OLLAMA_API_BASE="http://localhost:11434"
# Default model
export OLLAMA_MODEL="qwen2.5"
# Ollama port
export OLLAMA_PORT=11434
# Log level
export AIPIPE_LOG_LEVEL=DEBUG
Development
# Install dependencies
shards install
# Run tests
crystal spec
# Development mode
./scripts/dev.sh ask "test question"
Contributing
- Fork the project
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details
Repository
aipipe
Owner
Statistic
- 1
- 0
- 0
- 0
- 1
- 21 days ago
- December 5, 2024
License
MIT License
Links
Synced at
Wed, 25 Dec 2024 19:51:06 GMT
Languages