Skip to main content

AI pipeline command line tool for processing data with prompts

Project description

AIPipe

AIPipe is a powerful command-line tool for processing pipeline data through AI prompts. It supports both multi-line and line-by-line data processing, allows specifying prompts via parameters or files, and supports configuring AI model parameters.

Installation

pip install aipipe

Usage

Basic Usage

# Specify prompt via command line parameter
cat input.txt | aipipe "Translate the following text to English"

# Use prompt file
cat input.txt | aipipe --prompt-file prompt.txt

# Specify AI model
cat input.txt | aipipe --model "gpt-4" --prompt "Summarize the following text"

Configuration

You can configure the OpenAI API key in the following ways:

  1. Environment Variables:
# Set directly in terminal
export OPENAI_API_KEY=your_api_key

# Set permanently in .bashrc or .zshrc
echo 'export OPENAI_API_KEY=your_api_key' >> ~/.bashrc
source ~/.bashrc
  1. .env file: The program automatically looks for .env files in:
  • Current working directory
  • User home directory (~/.env)

Create a .env file in any of these locations with the following content:

OPENAI_API_KEY=your_api_key
  1. Other configurable environment variables:
  • OPENAI_BASE_URL: OpenAI API base URL (default: "https://api.openai.com/v1")
  • AIPIPE_MODEL: Default AI model to use (default: "gpt-4o-mini")
  • AIPIPE_TEMPERATURE: Default temperature setting for model outputs (default: 0.7)
  • AIPIPE_MAX_TOKENS: Default maximum number of tokens in model responses (default: 2000)
  • AIPIPE_SYSTEM_PROMPT: Default system prompt for the AI model

Parameters

  • --prompt: Directly specify the prompt
  • --prompt-file: Specify a file containing the prompt
  • --model: Specify the AI model to use (default: "gpt-3.5-turbo")
  • --temperature: Control output randomness (0-1, default: 0.7)
  • --max-tokens: Control maximum output length
  • --batch: Enable batch mode for line-by-line data processing (default: false)

Examples

Full Text Processing (Default Mode)

echo -e "First line\nSecond line" | aipipe "Translate the following text to English"

Batch Processing

echo -e "First line\nSecond line\nThird line" | aipipe "Summarize the following text" --batch

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aipipe-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aipipe-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file aipipe-0.1.0.tar.gz.

File metadata

  • Download URL: aipipe-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for aipipe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 927d3117e6873919d359191033517a9fb10042d65971e86e40fd2d4abbfd103c
MD5 c41027df62806773621793d4e825933e
BLAKE2b-256 da940c37e9a98e0c83ed01312e9ce982a5e07aa6d25625a08a8cabc994459fb5

See more details on using hashes here.

File details

Details for the file aipipe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aipipe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for aipipe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9336cd04b31d298add7f2923603097376d42aee798893ee4b3365ab5e8be9bd
MD5 6f1d29ad59915e176b29cd1637962d61
BLAKE2b-256 92cc6f4400b6e42567e163d9672b0d5b46bfa00ed8c033d2cf317a31e9ccde4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page