Skip to content

acceleratedscience/openad_workbench

Repository files navigation

Open Accelerated Discovery Workbench

PyPI - Python Version PyPI version License MIT Code style: black Docs Workbench Builder sourced

The following provides the the template for building a Jupyter Workbench Runtime images to use with Open Data Hub ODH or Red Hat OpenShift Data Science RHODS or podman / Docker Locally.
It loads the Openad Toolkit and a minimal image of the UBI9 jupyter notebooks with prebuilt note books for using OpenAD.

To install podman see install instructions

To Install Docker Engine see Install Docker Engine

First of all make sure if you are using podman, you have at least 4GB of memory available to podman e.g.

podman machine stop
podman machine set --cpus 4 --memory 4096
podman machine start

To build your image and deploy on podman/docker run
podman/docker build -t openad_workbench https://github.com/acceleratedscience/openad_workbench.git#main

Using Ollama

NOTE: when using the tell me you must pass the ip address of your ollama environment as an environment variable into the contianer e.g. add -e OLLAMA_HOST=<ollama-server-ip>:11434 to your podman run command. If you get asked for api key just enter through the request and your connection will work.

To run your workbench
podman/docker run -d -p 8888:8888 --name my_workbench openad_workbench

To stop your workbench:
podman/docker stop my_workbench

To restart your workbench:
podman/docker stop my_workbench

To delete your workbench container you will need to stop it then run the following:
podman/docker rm my_workbench

Once the Pod is Started use the url in your browser 127.0.0.1:8888 to enter your jupyter lab

Using your existing Openad Workspaces and credentials

The following instruction provides an alternative to allow you to use your desktops existing workspaces as well as use exsiting RXN, Deep Search and LLM credentials. podman/docker run -d -v $HOME/.openad:/opt/app-root/src/.openad:Z -p 8888:8888 --name my_workbench openad_workbench

Add Plugin and LLM Credentials

Using your existing credentials and automating their usage via secrets.

There are 2 methods to automatically adding you credentials for tools like RXN and Deep Search.

First the user must create a json document called openad_creds.json

{
    "bam": {
        "auth": {
            "api_key": "<api_key>"
        }
    },
    "rxn": {
        "auth": {
            "api_key": "<api_key>"
        }
    },
    "deepsearch": {
        "auth": {
            "username": "jon.doe@email",
            "api_key": "<api_key>"
        }
    }
}

Applying the Credentials json
Options fot applying:

  1. Include the json document as a secret by running run podman secret create openad_creds openad_creds.json
    Then include in your container startup with the option --secret openad_creds

podman run -d --secret openad_creds -p 8888:8888 --name my_workbench openad_workbench

  1. Create an environment variable called OPENAD_CREDS with the json as its value and use the -e option -e OPENAD_CREDS in your commands.
    e.g.
    export OPENAD_CREDS={....}

podman run -d -e OPENAD_CREDS -p 8888:8888 --name my_workbench openad_workbench

Add Models at Startup

There are two different approaches for registering Models

  1. Secret Method

Create a file called opend_models.json like the following example.

{
   auth_groups": {

        "default": "<API_key/Bearer token>"
    },
    "services": {
        "prop": {
            "host": "https://<url>:8080/proxy",
            "inference-service": "properties",
            "auth_group": "default"
        },
        "gen": {
            "host": "https://<url>:8080/proxy",
            "inference-service": "generation",
            "auth_group": "default"
        },
        "moler": {
            "host":"https://<url>:8080/proxy",
            "inference-service": "moler",
            "auth_group": "default"
        },
        "molf": {
            "host": "https://<url>:8080/proxy",
            "inference-service": "molformer",
            "auth_group": "default"
        }
    }
 }

The above is broken out into a authgroup and services. Place your API key in the auth_groups section where you see <API_key/Bearer token> and for each service specify the short name you wish to use then the host / inference-service name of the service.
podman secret create openad_models openad_models.json

Then run the following to run the container and access you notebooks
podman run -d --secret openad_creds --secret openad_models -p 8888:8888 --name my_workbench openad_workbench

  1. Environment Variable Method:
    Alternatively you can use the OPEN_AUTH Environment variable method by creating an environment varialbe by this name with only your authorisation JWT token. The Container on startup with decode the key and create the respective groups. this only works for the open.accelerator.cafe host.

Registration

Before you can interact with the toolkits, you'll need to register with each individual toolkit.

Register with DS4SD (Deep Search)
  1. First, you'll need to generate an API key on the Deep Search website.

    • Visit the Deep Search website and create an account:
      deepsearch-experience.res.ibm.com
    • Once logged in, click the Toolkit/API icon in the top right hand corner, then open the HTTP section
    • Click the "Generate new API key" button

  2. Once inside the OpenAD client, you'll be prompted to authenticate when activating the Deep Search (DS4SD) toolkit. When running set context ds4sd :

  3. You should get a message saying you successfully logged in.

    Note: Your DS4SD auth config file is saved as ~/.openad/deepsearch_api.cred. If you ever want to reset your DS4SD login information you can run set context ds4sd reset, or you can delete this file.

Register with RXN
  1. First, you'll need to generate an API key on the RXN website.

    • Sign up for an RXN account at rxn.app.accelerate.science
    • Obtain your API key by clicking the user profile icon in the top right hand corner and select "My profile".

  2. When setting the context to RXN using set context rxn you'll be prompted to create a new auth configuration file:

  3. You should get a message saying you successfully logged in.

    Note: Your RXN auth config file is saved as ~/.openad/rxn_api.cred. If you ever want to reset your RXN login information you can run set context rxn reset, or you can delete this file.