loam-ai
A command-line interface (CLI) tool for interacting with AWS Bedrock foundation models and inference profiles. LoamAI provides a streamlined way to invoke AI models, generate embeddings, and manage conversations through AWS Bedrock.
Features
- List available foundation models and inference profiles
- Generate text and image embeddings
- Stream model responses for real-time output
- Support for conversation-based model interactions
- Manage multiple AWS profiles and regions
- Rich terminal output formatting
Installation
Requires Python 3.10 or higher.
pip install loam-ai
Configuration
AWS SSO Login
If you're using AWS SSO, first configure your AWS profile and log in:
export AWS_PROFILE=your-sso-profile
aws sso login
After successful login, you can run loam-ai commands using your SSO credentials.
Usage
List Available Models
loam list-models
Filter by provider or output type:
loam list-models --provider anthropic
loam list-models --output TEXT
Check Session Information
loam session
Generate Embeddings
Generate text embeddings:
loam generate-embeddings \
--model-id amazon.titan-embed-text-v2:0 \
--input-file texts.txt
Generate image embeddings:
loam generate-embeddings \
--model-id amazon.titan-embed-image-v1 \
--image image.jpg \
--texts "Image description"
Invoke Models
Simple text generation:
loam invoke \
-m amazon.nova-lite-v1:0 \
-p "What are the benefits of renewable energy?"
Conversation Mode
Use conversation mode for chat-based interactions:
loam converse \
--model-id "anthropic.claude-3-sonnet-20240229-v1:0" \
--messages-file conversation.json
Example messages file format:
[
{
"role": "user",
"content": [{ "text": "What is the capital of France?" }]
}
]
List Inference Profiles
loam list-inference-profiles
Command Options
Global Options
--profile: AWS profile name--region: AWS region--debug: Enable debug output
Model Invocation Options
--temperature: Control response randomness (0-1)--max-tokens: Maximum response length--top-p: Control response diversity (0-1)
Error Handling
LoamAI provides clear error messages with rich terminal formatting. Common issues include:
- Invalid AWS credentials
- Unsupported model configurations
- Rate limiting
- Input validation errors
Python Usage
LoamAI can also be used as a Python library. First make sure you have run pip install loam-ai in your Python environment. Here's an example setting up a client and invoking a model with streaming output:
from loam_ai.client import BedrockClient
client = BedrockClient(profile_name="default", region_name="us-east-1")
model_id = "amazon.nova-lite-v1:0"
response = client.invoke_model(
model_id=model_id,
prompt="Write a poem about the sea",
temperature=0.7,
max_tokens=200,
stream=True
)
for chunk in response:
print(chunk, end="")
# Beneath the boundless azure sky,
# The sea unfolds her silent plea,
# A vast expanse where dreams can fly,
# And secrets whispered tenderly.
# Her waves, like ancient, rhythmic prose,
# Converse in tones both soft and strong,
# A timeless dance, a mystic flow,
# Where endless stories are prolong.
# The sea, a canvas of the blue,
# With brushstrokes of the silver moon,
# A tapestry of hues anew,
# As daylight yields to night's cocoon.
Development
Built with:
License
MIT License - See LICENSE file for details.
Metadata
Release files for loam-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loam_ai-0.1.1.tar.gz | 31.2 kB | Without provenance | Details for loam_ai-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loam_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for loam_ai-0.1.1-py3-none-any.whl |
Total release size: 44.0 kB
Release files / loam_ai-0.1.1.tar.gz
| Download URL | loam_ai-0.1.1.tar.gz |
|---|---|
| Size | 31.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
978b995369f09ee1acc9b471937c06f132a7853244144202d675b80d974ee270
|
|
BLAKE2b-256 checksum How to use checksums |
dbe186f133b5dc6963a5ca3eb1045beb1c0ad0bd470935d7a486c3f6ad90aecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.16
|
Release files / loam_ai-0.1.1-py3-none-any.whl
| Download URL | loam_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a514b2750ed22328e82e893db2de0f925ffe5fbc3e467eab0baa2af585241020
|
|
BLAKE2b-256 checksum How to use checksums |
5d15a9388fc7eb6f84a4875e0b1f44705ff3f6c1e4dd203446608d8fda20ef5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.16
|
Security for loam-ai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.