mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-08 03:10:26 +00:00
Merge unified-llm-cli crate into unified-llm
Move the ullm binary from a separate crate into unified-llm as src/bin/ullm.rs, consolidating CLI dependencies into the library crate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
30cf3a6787
commit
023cc54fed
4 changed files with 8 additions and 122 deletions
|
|
@ -1,26 +0,0 @@
|
|||
[package]
|
||||
name = "unified-llm-cli"
|
||||
description = "CLI for the unified-llm library"
|
||||
edition.workspace = true
|
||||
version.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "ullm"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
unified-llm = { path = "../unified-llm" }
|
||||
clap = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
dotenvy = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2"
|
||||
predicates = "3"
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
# unified-llm-cli
|
||||
|
||||
A command-line interface for interacting with LLM providers through the [unified-llm](../unified-llm/) library. Supports Anthropic, OpenAI, Google Gemini, and other providers with a single tool.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
cargo install --path crates/unified-llm-cli
|
||||
```
|
||||
|
||||
This installs the `ullm` binary.
|
||||
|
||||
## Configuration
|
||||
|
||||
API keys are read from environment variables. You can set them directly or place them in a `.env` file:
|
||||
|
||||
```sh
|
||||
export ANTHROPIC_API_KEY="sk-..."
|
||||
export OPENAI_API_KEY="sk-..."
|
||||
export GEMINI_API_KEY="..."
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
### `ullm prompt`
|
||||
|
||||
Send a prompt to an LLM and print the response.
|
||||
|
||||
```sh
|
||||
ullm prompt "What is the capital of France?"
|
||||
```
|
||||
|
||||
**Flags:**
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-m, --model <MODEL>` | Model to use (defaults to first catalog model) |
|
||||
| `-s, --system <TEXT>` | System prompt |
|
||||
| `-o, --option <KEY=VALUE>` | Generation options: `temperature`, `max_tokens`, `top_p`, or provider-specific keys |
|
||||
| `-u, --usage` | Show token usage on stderr |
|
||||
| `--no-stream` | Disable streaming (wait for full response) |
|
||||
|
||||
**Stdin support:** Pipe text into `ullm prompt` to use it as input. If both stdin and an argument are provided, they are concatenated.
|
||||
|
||||
```sh
|
||||
echo "Summarize this" | ullm prompt
|
||||
cat article.txt | ullm prompt "Give me the key points"
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
|
||||
```sh
|
||||
# Use a specific model
|
||||
ullm prompt -m claude-opus-4-6 "Explain quicksort"
|
||||
|
||||
# Set a system prompt
|
||||
ullm prompt -s "You are a helpful translator" "Translate to French: hello"
|
||||
|
||||
# Adjust generation parameters
|
||||
ullm prompt -o temperature=0.2 -o max_tokens=500 "Write a haiku"
|
||||
|
||||
# Show token usage
|
||||
ullm prompt -u --no-stream "Hello"
|
||||
```
|
||||
|
||||
### `ullm models`
|
||||
|
||||
List available models from all providers. Running `ullm models` with no subcommand defaults to `ullm models list`.
|
||||
|
||||
```sh
|
||||
ullm models
|
||||
```
|
||||
|
||||
#### `ullm models list`
|
||||
|
||||
```sh
|
||||
ullm models list
|
||||
```
|
||||
|
||||
**Flags:**
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-p, --provider <NAME>` | Filter models by provider (e.g., `anthropic`, `openai`, `gemini`) |
|
||||
| `-q, --query <TEXT>` | Search models by ID, display name, or alias (case-insensitive) |
|
||||
|
||||
**Examples:**
|
||||
|
||||
```sh
|
||||
# List only Anthropic models
|
||||
ullm models list --provider anthropic
|
||||
|
||||
# Search for models matching "opus"
|
||||
ullm models list --query opus
|
||||
```
|
||||
|
|
@ -9,6 +9,10 @@ readme = "README.md"
|
|||
keywords = ["llm", "ai", "openai", "anthropic"]
|
||||
categories = ["api-bindings"]
|
||||
|
||||
[[bin]]
|
||||
name = "ullm"
|
||||
path = "src/bin/ullm.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
thiserror.workspace = true
|
||||
|
|
@ -24,11 +28,14 @@ reqwest.workspace = true
|
|||
base64.workspace = true
|
||||
bytes.workspace = true
|
||||
tokio-util.workspace = true
|
||||
clap.workspace = true
|
||||
dotenvy.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
dotenvy.workspace = true
|
||||
http = "1"
|
||||
tokio = { workspace = true, features = ["test-util", "macros"] }
|
||||
assert_cmd = "2"
|
||||
predicates = "3"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue