Skip to main content

Ask your llm from the command line

Project description

lask

Ask LLMs right from the terminal.

Features

  • CLI for multiple LLM providers (OpenAI, Anthropic, AWS Bedrock, Azure)
  • Customizable models and parameters
  • Minimal dependencies (requests, boto3 for AWS)
  • Streaming responses
  • Repl mode for interactive use, with temporary chat history
  • Pipe input support

Installation

pip install lask

Usage

With OPENAI_API_KEY in your environment or in ~/.lask-config:

lask What movie is this quote from\? \"that still only counts as one\"

Or as a repl:

lask

==== Lask REPL Mode ====
Using provider: openai
Enter your prompts. Type 'exit' or 'quit' to end the session.
Press Ctrl+C to interrupt a response.

> What movie is this quote from? "that still only counts as one"
LLM response here...
> When was that movie released?

Or via pipe:

echo "What movie is this quote from? \"that still only counts as one\"" | lask

Setup

  1. Get API keys from your provider:

  2. Create ~/.lask-config:

    [default]
    provider = openai  # openai, anthropic, aws, azure
    system_prompt = Always answer questions concisely.
    
    [openai]
    api_key = your-api-key-here
    model = gpt-4.1
    
    [anthropic]
    api_key = your-api-key-here
    model = claude-3-opus-20240229
    
    [aws]
    model_id = anthropic.claude-3-sonnet-20240229-v1:0
    region = us-east-1
    
    [azure]
    api_key = your-azure-api-key
    resource_name = your-resource-name
    deployment_id = your-deployment-id
    

    See examples/example.lask-config for a full example.

  3. Or use environment variables:

    export OPENAI_API_KEY='your-api-key-here'
    export ANTHROPIC_API_KEY='your-api-key-here'
    # AWS uses standard AWS credentials
    export AZURE_OPENAI_API_KEY='your-api-key-here'
    

Configuration Options

Provider Selection

[default]
provider = openai  # openai, anthropic, aws, azure

Streaming

[openai]
streaming = false  # Disable streaming (true by default)

System Prompts

[default]
system_prompt = Always answer questions concisely.

[openai]
system_prompt = You are a helpful AI assistant.  # Provider-specific

Provider-Specific Settings

Each provider supports model, temperature, max_tokens, and other parameters.

See examples/example.lask-config for all options.

Development

This repo uses uv:

# Install dependencies
uv sync

# Build
uv build

# Install for development
pip install -e .

# For AWS Bedrock
pip install boto3

License

GNU General Public License v3.0 (GPL-3.0)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

lask-0.2.1.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

lask-0.2.1-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file lask-0.2.1.tar.gz.

File metadata

  • Download URL: lask-0.2.1.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lask-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b24b490ca738d776ee1943eb5e29f4401695ba50d3358668baf6d7146a9830d6
MD5 5ca63c22439df03a2cbd53c35fdb3f3c
BLAKE2b-256 bdd5f77a21a65f7911f9b2766a04c2e734c11a5e8571317e060051b11b24936e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lask-0.2.1.tar.gz:

Publisher: pypipublish.yml on Open-Source-Lodge/lask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lask-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: lask-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lask-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8ea6502d98f5d671a37a31e903bb7a357b2161efd2a60818a68e5ccf9cb3001
MD5 b4d3d16ee2cdf32c36e20f9a70d48ef4
BLAKE2b-256 0d76f310bd41a7a521005042c5344642fa2dc291754737277eb54abdcdf28c0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for lask-0.2.1-py3-none-any.whl:

Publisher: pypipublish.yml on Open-Source-Lodge/lask

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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