Ask your llm from the command line
Project description
(Still under development)
lask
Ask LLMs right from the terminal.
Supports multiple providers like OpenAI, Anthropic, AWS Bedrock, and Azure OpenAI
Usage
Ensure you have OPENAI_API_KEY in your environment variables or configure it in ~/.lask-config, then you can use lask to send prompts to the LLM.
lask What movie is this quote from\? \"that still only counts as one\"
Features
- Simple command-line interface to send prompts to multiple LLM providers
- Support for OpenAI, Anthropic, AWS Bedrock, and more.
- Customizable models and parameters for each provider
- Minimal dependencies (only requires the
requestslibrary, andboto3for AWS) - Easy installation via pip
- Direct output to your terminal
- Streaming responses for real-time output
Installation
Using pip (recommended)
pip install lask
(For dev, do pip install .)
For a user-specific installation:
pip install --user lask
From source
-
Clone the repository:
git clone https://github.com/Open-Source-Lodge/lask.git
-
Navigate to the directory:
cd lask
-
Install the package:
pip install -e .
Setup
Before using lask, you need to set up API keys for your preferred provider:
-
Get an API key from your chosen provider:
-
Create a configuration file at
~/.lask-configin INI format:[default] provider = openai # Options: openai, anthropic, aws, azure [openai] # OpenAI-specific settings api_key = your-api-key-here model = gpt-4.1 [anthropic] # Anthropic-specific settings api_key = your-api-key-here model = claude-3-opus-20240229 [aws] # AWS Bedrock settings api_key = your-api-key-here model_id = anthropic.claude-3-sonnet-20240229-v1:0 region = us-east-1 [azure] # Azure OpenAI settings api_key = your-azure-api-key resource_name = your-resource-name deployment_id = your-deployment-id
This INI configuration file allows you to set your preferred provider, API keys, and customize the models and parameters for each provider.
An example configuration file with comments is available in the
examples/example.lask-configfile. -
Alternatively, set the appropriate environment variable:
For OpenAI (default provider):
export OPENAI_API_KEY='your-api-key-here'
For Anthropic:
export ANTHROPIC_API_KEY='your-api-key-here'
For AWS Bedrock: Ensure your AWS credentials are properly configured.
For Azure OpenAI:
export AZURE_OPENAI_API_KEY='your-api-key-here'
To make these permanent, add the export line to your
~/.bashrc,~/.zshrc, or equivalent shell configuration file.Windows users can use
set(CMD) or$env:(PowerShell) instead ofexport.
API Key Issues
If you see an error about the API key:
- Ensure you've configured the API key in the
~/.lask-configfile - Alternatively, double-check that you've correctly set the appropriate environment variable for your chosen provider:
- OpenAI:
OPENAI_API_KEY - Anthropic:
ANTHROPIC_API_KEY - AWS: Check your AWS credentials configuration
- OpenAI:
- Verify your API key is valid and has enough credits
Configuration
You can find a fully commented example configuration file in the examples/example.lask-config directory of this repository. Copy it to your home directory as ~/.lask-config and customize it to your needs.
Selecting a Provider
Set your preferred provider in the [default] section:
[default]
provider = openai # Options: openai, anthropic, aws
Streaming Configuration
By default, responses are streamed in real-time to your terminal. You can disable streaming in your configuration file:
[openai]
streaming = false # Disable streaming for OpenAI
[anthropic]
streaming = false # Disable streaming for Anthropic
When streaming is enabled, you'll see the response appearing in real-time as it's generated. When disabled, you'll get the complete response only after it's fully generated.
Provider-specific Configuration
Each provider has its own section where you can set provider-specific options:
OpenAI
[openai]
api_key = your-openai-api-key
model = gpt-4.1
temperature = 0.7
max_tokens = 2000
streaming = true # Enable streaming (this is the default)
Anthropic
[anthropic]
api_key = your-anthropic-api-key
model = claude-3-opus-20240229
temperature = 0.7
max_tokens = 4096
streaming = true # Enable streaming (this is the default)
AWS Bedrock
[aws]
model_id = anthropic.claude-3-sonnet-20240229-v1:0
region = us-east-1
temperature = 0.7
max_tokens = 4096
Azure OpenAI
[azure]
api_key = your-azure-api-key
resource_name = your-resource-name
deployment_id = your-deployment-id
api_version = 2023-05-15
temperature = 0.7
max_tokens = 2000
Developing
Dependencies
This repo uses uv for running scripts and building the package. uv install instruction
To install the development dependencies, run:
uv sync
Build
To build the package, run:
uv build
Install for development
To install the package in development mode, run:
pip install dist/lask-0.1.0-py3-none-any.whl
or
pip install -e .
With the -e flag, you can edit the source code and see changes immediately without reinstalling.
If you want to use AWS Bedrock, also install boto3:
pip install boto3
(I have not tested aws yet, so please report any issues you find)
License
GNU General Public License v3.0 (GPL-3.0)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lask-0.1.7.tar.gz.
File metadata
- Download URL: lask-0.1.7.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e932c0cf73b1aa63843ce3c628156e25edc9daaa0c7e84b074c1ec067e8543e
|
|
| MD5 |
52dd066b43d7d6abc4be7d29449d26cf
|
|
| BLAKE2b-256 |
1782894e4516640c75740f36cbacdcd03eb6138eda0279ea41bbed713379b15d
|
Provenance
The following attestation bundles were made for lask-0.1.7.tar.gz:
Publisher:
pypipublish.yml on Open-Source-Lodge/lask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lask-0.1.7.tar.gz -
Subject digest:
3e932c0cf73b1aa63843ce3c628156e25edc9daaa0c7e84b074c1ec067e8543e - Sigstore transparency entry: 219804239
- Sigstore integration time:
-
Permalink:
Open-Source-Lodge/lask@8876c1d78e6dc3f90b8cde2319cd0805f9010780 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/Open-Source-Lodge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypipublish.yml@8876c1d78e6dc3f90b8cde2319cd0805f9010780 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lask-0.1.7-py3-none-any.whl.
File metadata
- Download URL: lask-0.1.7-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d87b6ec537c433ef73282d6bc805236d787abbe4a86460ae2c53c0a97ed16b2
|
|
| MD5 |
70ab85d51855482a03824dfc4dc606f7
|
|
| BLAKE2b-256 |
db85bcacdebacf0715125b93750034888ce57fd86246aac5f92a5449b71467aa
|
Provenance
The following attestation bundles were made for lask-0.1.7-py3-none-any.whl:
Publisher:
pypipublish.yml on Open-Source-Lodge/lask
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lask-0.1.7-py3-none-any.whl -
Subject digest:
0d87b6ec537c433ef73282d6bc805236d787abbe4a86460ae2c53c0a97ed16b2 - Sigstore transparency entry: 219804240
- Sigstore integration time:
-
Permalink:
Open-Source-Lodge/lask@8876c1d78e6dc3f90b8cde2319cd0805f9010780 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/Open-Source-Lodge
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypipublish.yml@8876c1d78e6dc3f90b8cde2319cd0805f9010780 -
Trigger Event:
release
-
Statement type: