2 releases
Uses new Rust 2024
new 0.1.1 | May 8, 2025 |
---|---|
0.1.0 | May 8, 2025 |
#98 in Configuration
202 downloads per month
27KB
498 lines
paip
A command-line tool to interact with Large Language Models (LLMs) via stdin or files.
Input handling mimics POSIX cat in how it reads from files and stdin, but it collects all input before sending it to the LLM for processing, unlike cat which outputs immediately.
Configuration
Before using paip, you need to configure your LLM API key and settings.
Run the following command to create a default configuration file:
paip --init-config
This will create a config.yaml
file in the appropriate configuration directory for your system (e.g., ~/.config/paip/config.yaml
).
Edit this file to:
- Specify the
provider
(e.g.,gemini
). - Add your LLM provider's API
key
under the corresponding provider section (e.g., undergemini:
). - Configure other settings like the
timeout
(in milliseconds), model (e.g.,gemini-2.0-flash
), temperature, top_p, top_k, max_output_tokens, and thinking_budget under the provider section.
Currently, only the gemini
provider is supported.
Usage
Usage: paip [OPTIONS] [FILES]...
Arguments:
[FILES]... Files to process. Reads from stdin if no files are provided. Use '-' to read from stdin within a list of files.
Options:
-p, --prompt <PROMPT> Use a predefined prompt from the configuration file.
-m, --message <MESSAGE> Additional message to include after input.
--init-config Create a default configuration file if it doesn't exist.
-v, --verbose Enable verbose output for debugging.
-h, --help Print help
-V, --version Print version
Examples
Process text from stdin:
echo 'Summarize this text.' | paip
Process text from a file:
paip file.txt
Process text from multiple files:
paip file1.txt file2.txt
Process text from stdin and a file using a specific prompt:
echo 'Additional context.' | paip -p summarize file.txt -
Explain most recent git commit:
git show | paip
Find issues in last 3 git commits:
git log -3 -p | paip -m 'Any issues?'
Write a conventional commit message for staged changes and pipe it to git commit while allowing editing:
git diff --cached | paip -p commit | git commit -e -F -
License
GPL-2.0-only
Dependencies
~7–23MB
~257K SLoC