Skip to main content

llama-ctrl

PyPI version License Python Version CI Status

Llama Control (llama-ctrl) is a versatile command-line interface (CLI) and Python client library designed for interacting with and managing various LlamaSearch AI operations. It provides a unified entry point for controlling models, managing configurations, and executing tasks within the LlamaSearch ecosystem. The tool is optimized for different hardware, including Apple Silicon (M1/M2/M3), to ensure efficient performance.

Key Features

  • Unified CLI Interface: Control various LlamaSearch functions via a single llama-ctrl command.
  • Python Client Library: Integrate control functionality directly into your Python applications.
  • Hardware Optimization: Includes specific optimizations for Apple Silicon (M-series chips).
  • Request Handling: Uses a factory pattern to dynamically select appropriate handlers (e.g., default, chat, REPL).
  • Caching: Built-in file-based caching to speed up repeated operations (especially LLM calls).
  • Extensible: Designed to be easily extended with new commands and handlers.

Installation

pip install llama-ctrl
# Or install directly from GitHub for the latest version:
# pip install git+https://github.com/llamasearchai/llama-ctrl.git

Usage

Command-Line Interface (CLI)

The CLI provides various subcommands. Use --help to explore options:

llama-ctrl --help
llama-ctrl <command> --help

(More specific CLI examples will be added as commands are finalized)

Python Client

from llamasearch_ctrl import Client # Assuming Client class exists

# Initialize the client (configuration details might vary)
# client = Client(api_key="YOUR_API_KEY") # Example configuration
client = Client() # Basic initialization

# Example: Process some data or execute a command
# The exact methods will depend on the final API design
# result = client.execute_command("some_command", param="value")
# print(result)

# Example from original README (adjust class/method names if needed)
# from llamasearch_ctrl import LlamaCtrlClient
# client = LlamaCtrlClient(api_key="your-api-key")
# result = client.query("your query")
# print(result)

(Note: The Python client API details need refinement based on the actual implementation in src/llamasearch_ctrl)

Architecture Overview

llama-ctrl follows a modular design:

graph TD
    A[CLI (Typer) / Python Client] --> B{Handler Factory};
    B -- Selects Handler --> C[Default Handler];
    B -- Selects Handler --> D[Chat Handler];
    B -- Selects Handler --> E[REPL Handler];
    B -- Selects Handler --> F[M3 Optimized Handler];
    B -- Selects Handler --> G[... other handlers];
    C --> H(Core Logic / LLM Interaction);
    D --> H;
    E --> H;
    F --> H;
    G --> H;
    H --> I[Cache System];
    A --> J[System Info (OS/CPU Detection)];
    J --> B;
    J --> F;

    style H fill:#f9f,stroke:#333,stroke-width:2px
    style I fill:#ccf,stroke:#333,stroke-width:1px
  1. Entry Point: User interacts via the CLI (typer) or Python client.
  2. System Info: Detects OS and CPU (e.g., Apple Silicon M3) for potential optimizations.
  3. Handler Factory: Selects the appropriate handler based on the command/context and system info.
  4. Handlers: Specific handlers (Default, Chat, REPL, M3-optimized, etc.) process the request.
  5. Core Logic: Handlers interact with the core LlamaSearch functionalities or LLMs.
  6. Caching: Results can be cached to improve performance for subsequent identical requests.

Configuration

(Details on configuration files, environment variables, or API keys needed by llama-ctrl will be added here.)

Development

Setup

# Clone the repository
git clone https://github.com/llamasearchai/llama-ctrl.git
cd llama-ctrl

# Create and activate a virtual environment (recommended)
# python -m venv venv
# source venv/bin/activate # or .\venv\Scripts\activate on Windows

# Install in editable mode with development dependencies
pip install -e ".[dev]"

Testing

pytest tests/

Contributing

Contributions are welcome! Please refer to CONTRIBUTING.md for guidelines and submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Download files

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

Source Distribution

llama_ctrl-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

llama_ctrl-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llama_ctrl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb137904b0d9a1b22848d4596085173b58696566e488e0e52c128a5f7e00380d
MD5 bf7f32e5e88bbac122c86bc3c7b48f65
BLAKE2b-256 0cc94cc0671ffc8fd87cdc0fd68e609e755ce628320cc0b56d2e1f80509373e8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for llama_ctrl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af9b67ae3d16f7267ff1481942c2753fd4b878fc0becb74408dd741bea1bd7d6
MD5 95e0e75a15e7c8674b12be5ae19c9ffd
BLAKE2b-256 0ef76349b6fff1acff5be9eb18256ce56a2e568833ac265ea8e28b5785cb5919

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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