The official Python client SDK for the AleutianLocal MLOps platform.
Project description
Aleutian Client (Python SDK)
The official Python client SDK for the AleutianLocal MLOps platform.
This package allows developers, data scientists, and applications to programmatically interact with a running AleutianLocal stack to perform:
- Retrieval-Augmented Generation (RAG) queries
- Direct-to-LLM chat sessions
- Timeseries forecasting
- Session management
- And more, all through a simple Python API.
Prerequisites
This package is a client library. It requires the full AleutianLocal stack to be installed and running on your local machine.
Before using this package, please ensure you have:
-
Installed the
aleutianCLI (see the main project for instructions). -
Started the Aleutian stack:
# Make sure your Podman machine and Ollama are running aleutian stack start
The AleutianClient will connect to the orchestrator service, which runs on http://localhost:12210 by default.
Installation
You can install the client using pip:
pip install aleutian-client
Quickstart & Usage
The client is designed to be used with a context manager (the with statement), which automatically handles opening and closing the connection.
Here is a complete example showing the most common operations.
import sys
from aleutian_client import AleutianClient, Message
from aleutian_client import AleutianConnectionError, AleutianApiError
def main():
try:
# 1. Connect to the running Aleutian stack
# Defaults to host="http://localhost", port=12210
with AleutianClient() as client:
# 2. Run a health check to verify connection
health = client.health_check()
print(f"Successfully connected to Aleutian: {health.get('status')}")
# -------------------------------------------------
# Example 1: Direct Ask (No RAG)
# This sends the query directly to the configured LLM.
# -------------------------------------------------
print("\n--- 1. Direct LLM Ask (no RAG) ---")
try:
# Use no_rag=True to bypass RAG
response_ask = client.ask(
query="What is the capital of France?",
no_rag=True
)
print(f"LLM Answer: {response_ask.answer}")
except AleutianApiError as e:
print(f"API Error: {e}")
# -------------------------------------------------
# Example 2: RAG-Powered Ask
# Assumes you have already populated data, e.g.:
# aleutian populate vectordb ./my_documents
# -------------------------------------------------
print("\n--- 2. RAG-Powered Query ---")
try:
# no_rag=False (default) uses the 'reranking' pipeline
response_rag = client.ask(
query="What is AleutianLocal?",
pipeline="reranking" # or "standard"
)
print(f"RAG Answer: {response_rag.answer}")
if response_rag.sources:
sources = [s.source for s in response_rag.sources]
print(f"Sources: {sources}")
else:
print("No sources found. (Is data populated?)")
except AleutianApiError as e:
print(f"API Error: {e}")
# -------------------------------------------------
# Example 3: Direct Chat Session
# This uses the /v1/chat/direct endpoint.
# -------------------------------------------------
print("\n--- 3. Direct Chat Session ---")
try:
# The chat method takes a list of Message objects
messages = [
Message(role="user", content="Hello! Please introduce yourself briefly.")
]
response_chat = client.chat(messages=messages)
print(f"Chat Answer: {response_chat.answer}")
except AleutianApiError as e:
print(f"API Error: {e}")
except AleutianConnectionError:
print("\nError: Could not connect to AleutianLocal stack.", file=sys.stderr)
print("Please ensure the stack is running with 'aleutian stack start'.", file=sys.stderr)
sys.exit(1)
except Exception as e:
print(f"An unexpected error occurred: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
License
This project is licensed under the GNU Affero General Public License v3.0.
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 aleutian_client-0.1.1.tar.gz.
File metadata
- Download URL: aleutian_client-0.1.1.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55732f2f8bd68ae24df8569913785242fa67d7c9f86f0799024f3b323ba8d215
|
|
| MD5 |
e2e7a97c7c4ce8fe05e01011c0121a05
|
|
| BLAKE2b-256 |
ec3d9e1c536824e74acb2c924953a79ae79be78bdf92955216e197737ddb084d
|
File details
Details for the file aleutian_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aleutian_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 32.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4d5f84100fff931d8e0075d834e1d5a7b1ee14c73c62fd42e865f8c97015dab
|
|
| MD5 |
7b8ce84d4b0c4d28740e42161ce1c680
|
|
| BLAKE2b-256 |
37c32d94a5d5453f316ac393a7af803c4b651e716ff91c2099e24d08685ee572
|