Metadata-Version: 2.4
Name: orq-cli
Version: 0.1.2
Summary: Unofficial CLI tool for orq.ai LLM Ops platform
Project-URL: Homepage, https://github.com/nxtphase/orq-cli
Project-URL: Documentation, https://github.com/nxtphase/orq-cli#readme
Project-URL: Repository, https://github.com/nxtphase/orq-cli
Project-URL: Issues, https://github.com/nxtphase/orq-cli/issues
Author-email: Marco Kotrotsos <marco@nxtphase.io>
Maintainer-email: Marco Kotrotsos <marco@nxtphase.io>
License: MIT
License-File: LICENSE
Keywords: ai,cli,deployments,llm,llmops,orq,orq.ai,prompt-engineering
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: orq-ai-sdk>=3.4.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: questionary>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.12.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# ORQ CLI

Command line interface for the orq.ai LLM Ops platform.

## Installation

```bash
pip install orq-cli
```

## Quick Start

### Configure API Key

Set your API key using one of these methods:

```bash
# Using the CLI
orq config set api_key YOUR_API_KEY

# Using environment variable
export ORQ_API_KEY=YOUR_API_KEY
```

### Basic Usage

```bash
# List deployments
orq deployments list

# Invoke a deployment with a message
orq invoke my-deployment -m "Hello, world!"

# Invoke with variables (for prompt templates)
orq invoke my-deployment -v firstname=John -v city=Paris

# Combine variables and message
orq invoke my-deployment -v customer=John -m "Help me with my order"

# Stream a response
orq invoke my-deployment -v topic=AI --stream

# Interactive mode
orq --interactive
```

## Passing Variables

When your deployment has prompt templates with placeholders like `{{firstname}}` or `{{city}}`, pass them using `-v` or `--var`:

```bash
# Using --var (recommended)
orq invoke customer-service -v firstname=John -v city=Paris -v language=English

# Multiple variables
orq deployments invoke my-key -v name=Alice -v topic="machine learning" -v format=markdown

# Using JSON (alternative)
orq deployments invoke my-key --inputs '{"firstname": "John", "city": "Paris"}'
```

## Commands

### Deployments

```bash
orq deployments list                              # List all deployments
orq deployments invoke KEY -v name=value          # Invoke with variables
orq deployments stream KEY -v name=value          # Stream with variables
orq deployments get-config KEY                    # Get deployment configuration
```

### Datasets

```bash
orq datasets list                       # List datasets
orq datasets create --name "My Dataset" # Create a dataset
orq datasets get DATASET_ID             # Get dataset details
orq datasets delete DATASET_ID          # Delete a dataset

# Datapoints
orq datasets datapoints list DATASET_ID
orq datasets datapoints create DATASET_ID --inputs '{"key": "value"}'
```

### Files

```bash
orq files list                          # List files
orq files upload path/to/file.txt       # Upload a file
orq files get FILE_ID                   # Get file details
orq files delete FILE_ID                # Delete a file
```

### Knowledge Bases

```bash
orq knowledge list                      # List knowledge bases
orq knowledge search KB_ID --query "search term"
orq knowledge datasources list KB_ID    # List datasources
orq knowledge chunks list KB_ID DS_ID   # List chunks
```

### Prompts

```bash
orq prompts list                        # List prompts
orq prompts get PROMPT_ID               # Get prompt details
```

### Contacts

```bash
orq contacts create EXTERNAL_ID --name "John Doe" --email "john@example.com"
```

### Feedback

```bash
orq feedback create TRACE_ID --field rating --value 5
```

### Configuration

```bash
orq config show                         # Show configuration
orq config set KEY VALUE                # Set a config value
orq config get KEY                      # Get a config value
orq config path                         # Show config file path
```

## Quick Shortcuts

```bash
# Quick list any resource
orq list deployments
orq list datasets
orq list files

# Quick invoke with message
orq invoke DEPLOYMENT_KEY -m "message"

# Quick invoke with variables
orq invoke DEPLOYMENT_KEY -v firstname=John -v city=Paris

# Quick invoke with streaming
orq invoke DEPLOYMENT_KEY -v topic=AI -m "Explain this" --stream
```

## Interactive Mode

Run the CLI in interactive mode for a guided experience:

```bash
orq --interactive
# or
orq -i
```

## Output Formats

All commands support different output formats:

```bash
orq deployments list --output table   # Default, pretty table
orq deployments list --output json    # JSON output
orq deployments list --output yaml    # YAML output
```

## Configuration File

Configuration is stored in `~/.orq/config.yaml`:

```yaml
api_key: your-api-key
environment: production
output_format: table
```

## Environment Variables

- `ORQ_API_KEY`: API key for authentication
- `ORQ_ENVIRONMENT`: Default environment (production, staging, etc.)

## Development

```bash
# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=orq
```
