BiA-Bob#

bia_bob is a Python library that connects Jupyter with large language models (LLM) and custom bio-image analysis instructions. Commonly, it uses OpenAIs/GPT models as default. For training purposes, we will use the LLM infrastructure of ScaDS.AI in the National Compute Center ZIH TU Dresden.

When using bia-bob to prompt LLMs, the prompts you enter including existing variable names etc. are sent to the LLM provider. Do not submit any sensitive, secret or private information. Also check bia-bob’s code recommendations before executing them. LLMs make mistakes.

First, we configure bia-bob:

from dotenv import load_dotenv
load_dotenv()

import os
from bia_bob import bob
bob.initialize(endpoint='https://chat-ai.academiccloud.de/v1', model='openai-gpt-oss-120b', api_key=os.environ.get('KISSKI_API_KEY'))
#bob.initialize(endpoint='https://llm.scads.ai/v1', model='openai/gpt-oss-120b', api_key=os.environ.get('SCADSAI_API_KEY'))
This notebook may contain text, code and images generated by artificial intelligence. Used model: openai-gpt-oss-120b, vision model: None, endpoint: https://chat-ai.academiccloud.de/v1, bia-bob version: 0.34.3.. Do not enter sensitive or private information and verify generated contents according to good scientific practice. Read more: https://github.com/haesleinhuepf/bia-bob#disclaimer

Prompting#

You can prompt for a single short task using %bob.

%bob print hello world.

I will provide a minimal Python snippet that prints the string hello world.

print("hello world")

More advanced multi-line tasks can be prompted using %%bob.

%%bob 
load data/blobs.tif and show it

I will load the TIFF image located at data/blobs.tif using skimage.io.imread and then display it interactively with stackview.

# 1. Imports
from skimage.io import imread
import stackview

# 2. Load the image
image = imread("data/blobs.tif")

# 3. Display the image interactively
stackview.insight(image)

Exercise#

Ask Bob to plot a sigmoid curve.