Skip to content

Commit

Permalink
Update index
Browse files Browse the repository at this point in the history
  • Loading branch information
ncoop57 committed Sep 25, 2024
1 parent 48691ab commit 539c783
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
4 changes: 1 addition & 3 deletions nbs/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -228,8 +228,6 @@
}
],
"source": [
"from typing import Literal\n",
"\n",
"class TranslationCritique():\n",
" \"\"\"\n",
" A critique of the translation.\n",
Expand Down
43 changes: 26 additions & 17 deletions nbs/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand Down Expand Up @@ -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?\")"
]
},
{
Expand Down Expand Up @@ -179,16 +195,15 @@
"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]"
]
},
{
"name": "stdout",
"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"
]
},
{
Expand All @@ -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",
Expand All @@ -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)"
]
},
{
Expand Down

0 comments on commit 539c783

Please sign in to comment.