diff --git a/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb b/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb index 69bdb54..f98e519 100644 --- a/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb +++ b/notebooks/instructlab-knowledge/instructlab-knowledge.ipynb @@ -541,6 +541,34 @@ "print(next(chunk_gen)['chunk'])" ] }, + { + "cell_type": "markdown", + "id": "47f5aad8-21db-440b-b465-ae6d6a890217", + "metadata": {}, + "source": [ + "To view several randomly selected chunks, run the following cell as many times as you like:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6ceb3777-71c6-4418-8060-10ebc68ae1f6", + "metadata": {}, + "outputs": [], + "source": [ + "NUM_CHUNKS_TO_VIEW = 5\n", + "\n", + "import random\n", + "import json\n", + "\n", + "sample = random.sample(all_chunks, min(len(all_chunks), NUM_CHUNKS_TO_VIEW))\n", + "\n", + "i = 1\n", + "for chunk in sample:\n", + " print(f\"== Randomly selected chunk {i}: ==========\\n\\n{chunk['chunk']}\\n\\n\")\n", + " i += 1" + ] + }, { "cell_type": "markdown", "id": "a510f8c7-8cd3-4867-8742-9f4f9cda9e9f",