Skip to content

Commit

Permalink
style: remove autoreload, format
Browse files Browse the repository at this point in the history
  • Loading branch information
baggiponte committed Feb 12, 2025
1 parent df69e1f commit fc4e61e
Showing 1 changed file with 16 additions and 27 deletions.
43 changes: 16 additions & 27 deletions notebooks/02-domain-expert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"id": "3",
"metadata": {},
"source": [
"Now that we have chosen our SME, what could we ask him/her? We could ask him to judge some answers our system gives to a list of questions. We can leverage the power of LLM to invent questions for use, this could be useful to bootstrap our evaluation pipeline. "
"Now that we have chosen our SME, what could we ask him/her? We could ask him to judge some answers our system gives to a list of questions. We can leverage the power of LLM to invent questions for use, this could be useful to bootstrap our evaluation pipeline."
]
},
{
Expand All @@ -42,17 +42,6 @@
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"from pydantic import BaseModel\n",
"import polars as pl"
Expand All @@ -61,7 +50,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -72,7 +61,7 @@
},
{
"cell_type": "markdown",
"id": "7",
"id": "6",
"metadata": {},
"source": [
"To instruct the LLM to generate valuable questions to use as an evaluation dataset we could think about different characteristics that our product must have, in particular: \n",
Expand All @@ -86,7 +75,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -106,7 +95,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"id": "8",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -121,13 +110,15 @@
"\"\"\"\n",
"\n",
"MAX_ROWS = 20\n",
"EVAL_CONSTRUCTION_PROMPT = \"\"\"Generate an evaluation dataset with no more than {n_rows} rows\"\"\""
"EVAL_CONSTRUCTION_PROMPT = (\n",
" \"\"\"Generate an evaluation dataset with no more than {n_rows} rows\"\"\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -149,7 +140,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"id": "10",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -162,7 +153,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -181,16 +172,14 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "12",
"metadata": {},
"outputs": [],
"source": [
"import openai\n",
"\n",
"\n",
"client = openai.OpenAI()\n",
"\n",
"\n",
"chat_completion = client.beta.chat.completions.parse(\n",
" model=\"gpt-4o\",\n",
" messages=[\n",
Expand All @@ -208,7 +197,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -217,7 +206,7 @@
},
{
"cell_type": "markdown",
"id": "15",
"id": "14",
"metadata": {},
"source": [
"Now, we have a list of questions to pose to our AI and ask our evaluation expert to evaluate it. Note that, the SME could be involved also both for giving you features, scenario and personas or to add particular questions to the generated dataset. "
Expand All @@ -226,7 +215,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "16",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -237,7 +226,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "17",
"id": "16",
"metadata": {},
"outputs": [],
"source": [
Expand Down

0 comments on commit fc4e61e

Please sign in to comment.