Skip to main content

Add Intelligence Layer to your Poetry project

Prerequisites for installation

The Intelligence Layer uses poetry as its package manager to handle dependencies and manage virtual environments. We recommend installing poetry globally while isolating it in a virtual environment using pipx, following the official instructions.

Installation Steps

  1. Install Poetry if you haven't already.
  2. Change directory to where you want to create your project
  3. Create a new Poetry project
poetry new poetry-demo 
  1. Navigate to the project directory and run the following command to create a new virtual environment and install all project dependencies:
poetry install
  1. Activate the environment using:
poetry env activate

For further details, check out the official poetry documentation.

Add the SDK to your project dependencies (JFrog)

If you don't have a JFrog account, please go to Add the SDK to your project dependencies (GitHub)

To install the Aleph-Alpha Intelligence Layer from the JFrog artifactory in you project, you have to add this information to your poetry setup via the following four steps.

  1. Add the artifactory as a source to your project via
poetry source add --priority=explicit artifactory https://alephalpha.jfrog.io/artifactory/api/pypi/python/simple
  1. To install the poetry environment, export your JFrog credentials to the environment
export POETRY_HTTP_BASIC_ARTIFACTORY_USERNAME=your@username.here
export POETRY_HTTP_BASIC_ARTIFACTORY_PASSWORD=your-token-here
  1. Add the Intelligence Layer to the project
poetry add --source artifactory intelligence-layer
  1. Execute the poetry installation to add all the necessary dependencies to the environment
poetry install

The Intelligence Layer is now available as a Python package and ready to be used in your project.

from intelligence_layer.core import Task

Add the SDK to your project dependencies (GitHub)

To install the Aleph-Alpha Intelligence Layer from GitHub in you project, you have to add this information to your poetry setup via the following steps.

  1. Clone the Intelligence Layer repository from GitHub in any directory.
git clone git@github.com:Aleph-Alpha/intelligence-layer-sdk.git
  1. In your Poetry project directory, open the pyproject.toml and add the Intelligence Layer as a dependency.
[tool.poetry.dependencies]
python = ">=3.11,<3.13"
intelligence-layer = {path = "path/to/git/folder/intelligence-layer-sdk/", develop = true}
  1. Refresh the lock file and afterwards run the installation for the project with the following instructions.
poetry lock
poetry install

Set your environment variables

For this how to, your environment need to provide the following values:

AA_TOKEN=<YOUR_STUDIO_TOKEN>
STUDIO_URL="https://pharia-studio.{ingressDomain}"
CLIENT_URL="https://inference-api.{ingressDomain}"

To obtain a valid token, it is sufficient to log in to Studio, access the user menu from the user avatar in the top right corner and click on the Copy Bearer Token.

studio-copy-bearer-token.png