An SDK for programmatically running local AI.
Project description
Ramalama Python SDK
Build local-first AI apps on top of the Ramalama CLI. The SDK provisions models in containers and exposes a simple API for on-device inference.
Capabilities
- LLM chat with OpenAI-compatible endpoints for direct requests.
- Speech-to-Text (STT) with Whisper (coming soon).
Requirements
- Ramalama CLI installed (the SDK manages invocation; you do not need to call it directly).
- Docker or Podman running locally.
CLI installation guide: https://docs.ramalama.com/cli/getting-started/installation
Install
pip install ramalama-sdk
Verify
import ramalama_sdk
print(f"SDK Version: {ramalama_sdk.__version__}")
Quick Start
from ramalama_sdk import RamalamaModel
with RamalamaModel(model="tinyllama") as model:
response = model.chat("How tall is Michael Jordan?")
print(response["content"])
Model initialization
from ramalama_sdk import RamalamaModel
model = RamalamaModel(
model="tinyllama",
base_image=None,
temp=0.7,
ngl=20,
max_tokens=256,
threads=8,
ctx_size=4096,
timeout=30,
)
Parameters
model: Model name or identifier.
base_image: Container image to use for serving, if different from config.
temp: Temperature override for sampling.
ngl: GPU layers override.
max_tokens: Maximum tokens for completions.
threads: CPU threads override.
ctx_size: Context window override.
timeout: Seconds to wait for server readiness.
Download models
Use download() to fetch models before serving. The model identifier controls the source:
hf:// for HuggingFace ollama:// for Ollama oci:// for OCI artifacts/images file:// for local files
from ramalama_sdk import RamalamaModel
model = RamalamaModel(model="hf://ggml-org/gpt-oss-20b-GGUF")
model.download()
Documentation
Python SDK: https://docs.ramalama.com/sdk/python Quick start: https://docs.ramalama.com/sdk/python/quickstart
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
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 ramalama_sdk-0.1.1.tar.gz.
File metadata
- Download URL: ramalama_sdk-0.1.1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aec191884dbdbb249afe36526b1e0ed56c2432c8bd634233dce0ade7e8132a4
|
|
| MD5 |
d4d4547b8c9a347d15a37a9254a90261
|
|
| BLAKE2b-256 |
20dd5c73c1309ec75345b5717b39fd93420b80445dcbc84849a66fc1693cd737
|
File details
Details for the file ramalama_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ramalama_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96e7230b3e0bc75cef163bad57a411f2308618cb96a6f8d5ebef8b26fd5fbb86
|
|
| MD5 |
8d1023af6ec051d5c66142a25013892c
|
|
| BLAKE2b-256 |
98a5dbe48407039239343bf6419d00102c65ff84dca839f28cb83489f89a6f08
|