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
- Install Poetry if you haven't already.
- Change directory to where you want to create your project
- Create a new Poetry project
poetry new poetry-demo
- Navigate to the project directory and run the following command to create a new virtual environment and install all project dependencies:
poetry install
- 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.
- 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
- 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
- Add the Intelligence Layer to the project
poetry add --source artifactory intelligence-layer
- 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.
- Clone the Intelligence Layer repository from GitHub in any directory.
git clone git@github.com:Aleph-Alpha/intelligence-layer-sdk.git
- 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}
- 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.