From 539c783ea29f1a9e0a6130a9864b55e29b683a22 Mon Sep 17 00:00:00 2001 From: ncoop57 Date: Wed, 25 Sep 2024 13:20:35 -0500 Subject: [PATCH] Update index --- nbs/00_core.ipynb | 4 +--- nbs/index.ipynb | 43 ++++++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/nbs/00_core.ipynb b/nbs/00_core.ipynb index 1f0a845..d83dfa0 100644 --- a/nbs/00_core.ipynb +++ b/nbs/00_core.ipynb @@ -185,7 +185,7 @@ "Create an english and german translation pair that is similar to the examples and would be appropriate for the following persona: {persona}\n", "\"\"\"\n", "\n", - "# Generate tiny programs\n", + "# Generate translations\n", "fast_data = FastData()\n", "translations = fast_data.generate(\n", " prompt_template=prompt_template,\n", @@ -228,8 +228,6 @@ } ], "source": [ - "from typing import Literal\n", - "\n", "class TranslationCritique():\n", " \"\"\"\n", " A critique of the translation.\n", diff --git a/nbs/index.ipynb b/nbs/index.ipynb index a85556f..cd9b0e7 100644 --- a/nbs/index.ipynb +++ b/nbs/index.ipynb @@ -8,7 +8,7 @@ "\n", "> Easiest and fastest way to 1B synthetic tokens\n", "\n", - "Minimalist library that wraps around `instructor` to make generating synthetic data easy." + "Minimalist library that wraps around `claudette` to make generating synthetic data easy." ] }, { @@ -122,20 +122,36 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "First you need to define the structure of the data you want to generate. `instructor`, which is the library that fastdata uses to generate data, requires you to define the schema of the data you want to generate. This is done using pydantic models." + "First you need to define the structure of the data you want to generate. `claudette`, which is the library that fastdata uses to generate data, requires you to define the schema of the data you want to generate. This is done using pydantic models." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "__main__.Translation(english='Hello, how are you today?', german='Hallo, wie geht es Ihnen heute?')" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "from pydantic import BaseModel, Field\n", + "from fastcore.utils import *\n", + "\n", + "class Translation():\n", + " \"\"\"Translation from an English phrase to a German phrase\"\"\"\n", + " def __init__(self, english: str, german: str): store_attr()\n", + " \n", + " __repr__ = basic_repr([\"english\", \"german\"])\n", + " def __str__(self): return \"The translation has been created.\"\n", "\n", - "class Translation(BaseModel):\n", - " english: str = Field(description=\"An english phrase\")\n", - " german: str = Field(description=\"An equivalent german phrase that is a translation of the english phrase\")" + "Translation(\"Hello, how are you today?\", \"Hallo, wie geht es Ihnen heute?\")" ] }, { @@ -179,7 +195,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "100%|██████████| 2/2 [00:00<00:00, 2.21it/s]" + "100%|████████████████████████████████████████████████████████████| 2/2 [00:01<00:00, 1.55it/s]" ] }, { @@ -187,8 +203,7 @@ "output_type": "stream", "text": [ "Translations:\n", - "[ {'english': 'Otters are cute', 'german': 'Otter sind süß'},\n", - " {'english': 'I love programming', 'german': 'Ich liebe das Programmieren'}]\n" + "[__main__.Translation(english='I love programming', german='Ich liebe das Programmieren'), __main__.Translation(english='Otters are cute', german='Otter sind niedlich')]\n" ] }, { @@ -202,11 +217,6 @@ "source": [ "from fastdata.core import FastData\n", "\n", - "import pprint\n", - "\n", - "# Create a pretty printer object with custom settings\n", - "pp = pprint.PrettyPrinter(indent=4, width=100, compact=False)\n", - "\n", "fast_data = FastData()\n", "translations = fast_data.generate(\n", " prompt_template=prompt_template,\n", @@ -215,9 +225,8 @@ " model=\"claude-3-haiku-20240307\"\n", ")\n", "\n", - "# Pretty print the translations\n", "print(\"Translations:\")\n", - "pp.pprint(translations)" + "print(translations)" ] }, {