(Deprecated) Adding the Intelligence Layer SDK to your project

Intelligence Layer SDK is deprecated!

For convenience and easier installation, the Intelligence Layer SDK has been split into three separate SDKs, all available on PyPI:

  • PhariaInference SDK - contains the core module of the Intelligence Layer

  • PhariaStudio SDK - contains the evaluation modules and everything needed to connect your project to PhariaStudio

  • PhariaData SDK - provides PhariaDocument Index capabilities and connection to the PhariaData service

These SDKs are documented in Adding PhariaAI SDKs to your project. The original Intelligence Layer SDK is now deprecated, and you should replace it with the above SDKs.


Add the Intelligence Layer SDK to your Poetry project

Prerequisites for installation

The Intelligence Layer uses Poetry as the 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 do not already have it installed).

  2. Change directory to where you want to create your project.

  3. Create a new Poetry project:

    poetry new poetry-demo
  4. Navigate to the project directory and run the following command to create a new virtual environment and install all project dependencies:

    poetry install
  5. Activate the environment:

    poetry env activate

For further details, see the official poetry documentation.

Add the Intelligence Layer to your project dependencies (JFrog)

If you do not have a JFrog account, see Add the Intelligence Layer to your project dependencies (GitHub).

To install the Intelligence Layer in your project from the JFrog artifactory, add this information to your Poetry setup as follows:

  1. Add the JFrog artifactory as a source to your project:

    poetry source add --priority=explicit artifactory https://alephalpha.jfrog.io/artifactory/api/pypi/python/simple
  2. 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
  3. Add the Intelligence Layer to the project:

    poetry add --source artifactory intelligence-layer
  4. 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 Intelligence Layer to your project dependencies (GitHub)

To install the Intelligence Layer from GitHub in your project, run the following command:

poetry add git+https://github.com/Aleph-Alpha/intelligence-layer-sdk.git --python ">=3.10,<3.13"

Add the Intelligence Layer to your project dependencies (local)

To install the Intelligence Layer in your project, you can also clone the repository locally and add the development dependency on your poetry project, as follows:

  1. Clone the Intelligence Layer repository from GitHub in any directory:

    git clone https://github.com/Aleph-Alpha/intelligence-layer-sdk.git
  2. In your Poetry project directory, open the pyproject.toml and add the Intelligence Layer as a dependency:

    [tool.poetry.group.dev.dependencies]
    python = ">=3.10,<3.13"
    intelligence-layer = {path = "path/to/git/folder/intelligence-layer-sdk/", develop = true}
  3. Refresh the lock file and then run the installation for the project with the following instructions:

    poetry lock
    poetry install

Set your environment variables

Your environment needs to provide the following values:

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

Get an authorisation token

To use the Aleph Alpha APIs, you need a valid authorisation token. You get this in PhariaStudio, as follows:

  1. Open PhariaStudio, and log in if necessary.

  2. In the upper-right corner, click your profile icon.

  3. In the popup, click Copy Bearer Token:

PhariaStudio - copy bearer token