Skip to main content
Give each user a private view of one shared knowledge base. Documents a user uploads are visible only to them; documents uploaded with no user are shared with everyone, and an admin (no user id) sees all of it.
valkey_db.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your API keys

4

Run Valkey

5

Run the example

Save the code above as valkey_db.py, then run:
Full source: cookbook/07_knowledge/04_advanced/07_per_user_isolation/valkey_db.py