Skip to main content

Aleph Alpha Client

License PyPI version Documentation Status

Python client for the Aleph Alpha API.

Usage

Synchronous Client

import os
from aleph_alpha_client import Client, CompletionRequest, Prompt

client = Client(token=os.getenv("AA_TOKEN"))
request = CompletionRequest(
    prompt=Prompt.from_text("Provide a short description of AI:"),
    maximum_tokens=64,
)
response = client.complete(request, model="luminous-extended")

print(response.completions[0].completion)

Asynchronous Client

import os
from aleph_alpha_client import AsyncClient, CompletionRequest, Prompt

# Can enter context manager within an async function
async with AsyncClient(token=os.environ["AA_TOKEN"]) as client:
    request = CompletionRequest(
        prompt=Prompt.from_text("Provide a short description of AI:"),
        maximum_tokens=64,
    )
    response = await client.complete(request, model="luminous-base")
    print(response.completions[0].completion)

Interactive Examples

This table contains interactive code examples, further exercises can be found in the examples repository.

Template Description Internal Link Colab Link
1 Calling the API Template 1 Open In Colab
2 Simple completion Template 2 Open In Colab
3 Simple search Template 3 Open In Colab
4 Symmetric and Asymmetric Search Template 4 Open In Colab
5 Hidden Embeddings Template 5 Open In Colab
6 Task-specific Endpoints Template 6 Open In Colab

Installation

The latest stable version is deployed to PyPi so you can install this package via pip.

pip install aleph-alpha-client

Get started using the client by first creating an account. Afterwards head over to your profile to create an API token. Read more about how you can manage your API tokens here.

Development

For local development, start by creating a Python virtual environment as follows:

python3 -m venv venv
. ./venv/bin/activate

Next, install the test and dev dependencies:

pip install -e ".[test,dev]"

Now you should be able to ...

  • run all the tests using pytest or, pytest -k <test_name> to run a specific test
  • typecheck the code and tests using mypy aleph_alpha_client resp. mypy tests
  • format the code using black .

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aleph-alpha-client-6.0.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aleph_alpha_client-6.0.0-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file aleph-alpha-client-6.0.0.tar.gz.

File metadata

  • Download URL: aleph-alpha-client-6.0.0.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for aleph-alpha-client-6.0.0.tar.gz
Algorithm Hash digest
SHA256 b02cf68d243d1a643bb1234c04efdaa19206fdf5f948b5535fccec991ffb7154
MD5 07042fbfa64444d8b198fe3fb0623fbe
BLAKE2b-256 97db8cc78162acd138abe712869faee9c90fc96a6d37c27c6d63758125b24817

See more details on using hashes here.

File details

Details for the file aleph_alpha_client-6.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aleph_alpha_client-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb70abd73dd9f4291cd2969945574603a987b92e1f3fec737853921cf2e86610
MD5 32aa88b474fa9ccad907f0d8488d7dca
BLAKE2b-256 4daa2922309c1ee02553d8d115541fc6942ee7a80924f8046d733b7a14af62f8

See more details on using hashes here.

Release history Release notifications | RSS feed

11.5.1

2 files

11.5.0

2 files

11.4.0

2 files

11.2.0

2 files

11.1.0

2 files

11.0.0

2 files

10.6.2

2 files

10.6.1

2 files

10.6.0

2 files

10.5.1

2 files

10.5.0

2 files

10.4.0

2 files

10.2.2

2 files

10.2.1

2 files

10.1.0

2 files

10.0.1

2 files

10.0.0

2 files

9.1.0

2 files

9.0.0

2 files

8.1.0

2 files

8.0.0

2 files

7.6.0

2 files

7.5.1

2 files

7.5.0

2 files

7.4.0

2 files

7.3.0

2 files

7.1.0

2 files

7.0.1

2 files

7.0.0

2 files

This release

6.0.0 This release

2 files

5.0.0

2 files

4.1.0

2 files

4.0.0

2 files

3.5.1

2 files

3.5.0

2 files

3.4.1

2 files

3.4.0

2 files

3.3.0

2 files

3.2.4

2 files

3.2.3

2 files

3.2.2

2 files

3.2.0

2 files

3.1.5

2 files

3.1.4

2 files

3.1.3

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.17.0

2 files

2.16.1

2 files

2.16.0

2 files

2.15.0

2 files

2.14.0

2 files

2.13.0

2 files

2.12.0

2 files

2.11.1

2 files

2.11.0

2 files

2.10.0

2 files

2.9.2

2 files

2.9.1

2 files

2.9.0

2 files

2.8.1

2 files

2.8.0

2 files

2.7.1

2 files

2.7.0

2 files

2.6.1

2 files

2.6.0

2 files

2.5.0

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.0

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.7.1

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 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