Skip to main content

Python client for Aitta HPC ML inference platform

A Python client library for the Aitta ML inference platform for HPC systems.

IMPORTANT: Note that both the API and the client library are still under heavy development and while we try to keep changes mostly backwards-compatible, breaking changes may happen. Access to Aitta is currently restricted to selected beta users.

Main client API classes

AccessTokenSource

Used by the client to get (and eventually refresh) access tokens

Client

Implements all requests to the Aitta API servers on a low level and is used by all other classes.

Useful members:

  • get_model_list(): Lists all models served by the API that can be accessed with the configured access credentials.

Model

Represents a model and provides methods to perform inference.

Useful members:

  • load(model_id, client): Creates a Model instance given the models id, loading the relevant data from the Aitta API server.

Example usage

The below shows an example for usage of the Aitta API using the Python client library.

For accessing the Aitta API the client will need a way to obtain access tokens, which is implemented in the form of an AccessTokenSource. You can obtain an access token by authenticating with your CSC user account at the Generate token page (also accessible from the main website by following the "Generate token" link in the navigation bar after logging in).

With the token thus obtained, then have to create an instance of StaticAccessTokenSource for use with the client library.

Chat completion with the LumiOpen/Llama-Poro-2-70B-Instruct model

This example shows how to start a conversation with the model using OpenAI’s chat completion feature.

NOTE: It is recommended to specify the max_tokens value to a high enough number in order to avoid responses being cut out.

from aitta_client import Model, Client, StaticAccessTokenSource
import openai

# configure Client instance with API URL and access token
access_token = "token_for_given_model"
token_source = StaticAccessTokenSource(access_token)
aitta_client = Client("https://api-aitta.csc.fi", token_source)

# load the LumiOpen/Llama-Poro-2-70B-Instruct model
model = Model.load("LumiOpen/Llama-Poro-2-70B-Instruct", aitta_client)
print(model.description)

# configure OpenAI client to use the Aitta OpenAI compatibility endpoints
client = openai.OpenAI(api_key=token_source.get_access_token(), base_url=model.openai_api_url)
# perform chat completion with the OpenAI client
chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Write a novel about bear talking about how to combine HPC with QC."
        }
    ],
    model=model.id,
    max_tokens=8000,
    stream=False  # response streaming is currently not supported by Aitta
)

print(chat_completion.choices[0].message.content)

Metadata

Release files for aitta-client 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aitta-client 0.3.3
File Size Uploaded
aitta_client-0.3.3.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aitta-client 0.3.3
File Interpreter ABI Platform
aitta_client-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / aitta_client-0.3.3.tar.gz

Download URL aitta_client-0.3.3.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
36860f436185a717dfec8d6a4f11a6f7eb27bd57b0bd6cf49a925fc147d09b03
BLAKE2b-256 checksum
How to use checksums
ae618346a04c2227a542d0bc8fe9585fd8b16b6ee29451ddc7112ed1b4f08271
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / aitta_client-0.3.3-py3-none-any.whl

Download URL aitta_client-0.3.3-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a26bfe137b2bcad847007d131f43d34646556d81b10c179c5389d877e92b36dd
BLAKE2b-256 checksum
How to use checksums
68c023d3eb8e4800f54d1ae54918f17da1266e9c653566456a4eb86df8e9b61e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release history Release notifications | RSS feed

This release

0.3.3 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page