API connection with wandb failing

Hi,

While attempting to complete the 1st code example in the course “Evaluating and Debugging Generative AI”, I am facing two errors.

  1. It does not allow me to login anonymously into wandb using option 1
  2. When trying option 2, I added my API key, but I am getting error that API key should be only 40 characters even though the generated API key is much longer.

Please look into this.

This is a problem with the updated wandb library. You should remove the login code, and set your API key as an environment variable before calling wandb.init()
os.environ[“WANDB_API_KEY”] = “your_key_here”

The problem is still active

Thank you for reporting this issue. I’ve checked and it is because of the updates in the newest version of wandb and the “WANDB_API_KEY” length.

  • Old Keys (Pre-2024): Were exactly 40 characters long.

  • New Keys (2025/2026): Are now 86 characters long to provide better security.

If you run it locally, remember to upgrade the wandb version and add your own “WANDB_API_KEY”
In the meanwhile, with the team we’re updating the notebook’s version. I’ll let you know in this thread when it is ready.

--

Lesly, DLAI