Bug fixing#

Bia-bob can assist bug fixing. In case you meet a bug, just put %%fix in the beginnign of the cell and exectue the cell again. The cell’s code will then be replaced with an updated version of the code.

#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'))
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
from bia_bob import fix

For example, if you execute this code, there will be an error:

from skimage.io import imread
image = imread(data/blobs.tif)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[7], line 2
      1 from skimage.io import imread
----> 2 image = imread(data/blobs.tif)

NameError: name 'data' is not defined

You can then add the %%fix magic in the cell above as shown here:

%%fix
from skimage.io import imread
image = imread(data/blobs.tif)

The cell may then be replaced by this one:

from skimage.io import imread
image = imread("data/blobs.tif")

Exercise#

The %%fix magic command only works right after an error message was shown. Next time you see an error, try out the %%fix magic!