RAG and Vector Search · Exercise 1 of 6Next
Beginner
A fail-closed access filter
Write visible_ids(chunks, groups). Each chunk is a dict with keys id, label and text. Return the ids, in the original order, of the chunks whose label is in the set groups.
A user with an empty set of groups must see nothing. Do not write a special case for it: the membership test already does the right thing.
What Check tests
- A public user sees the public chunks in order
- A user with both groups sees everything
- An empty set of groups sees nothing
- An unknown group sees nothing
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.