Skip to content

[HANDS-ON BUG] Dummy Agent Library Notebook code does not work #612

@aiarcheology

Description

@aiarcheology

Describe the bug
Webpage: https://huggingface.co/agents-course/notebooks/blob/main/unit1/dummy_agent_library.ipynb referenced from https://huggingface.co/learn/agents-course/unit1/what-are-llms.

When using this notebook in Google Colab I have not been able to read the token in the way the original code is written.

I have

  1. added the token in the Secrets section in the Google Colab
  2. restarted the notebook with Runtime Restart Session

The script completing the "The capital of France is" did not work for me. The first section reading the token runs silently without an issue, despite not being able to retrieve the token. The second section with the Paris example suggests to login into Grock.

I had to use the instructions on the left side in the secret key section, telling me how to import the token. And also passed the token into the InferenceClient function as the second parameter.

import os
from google.colab import userdata
from huggingface_hub import InferenceClient

## You need a token from https://hf.co/settings/tokens, ensure that you select 'read' as the token type. If you run this on Google Colab, you can set it up in the "settings" tab under "secrets". Make sure to call it "HF_TOKEN"
HF_TOKEN = userdata.get('HF_TOKEN').strip()
client = InferenceClient(model="meta-llama/Llama-4-Scout-17B-16E-Instruct", token=HF_TOKEN)

To Reproduce

  1. Create your READ token in the Hugging Face
  2. Visit https://huggingface.co/agents-course/notebooks/blob/main/unit1/dummy_agent_library.ipynb
  3. Fill in the token in the Secrets section
  4. Restart the session with Runtime -> Restart Session

Additional context
I am not a python developer, so I could have missed something obvious.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions