Skip to content

Examples and guides for using the OpenAI API

EvalsAPI Images Inputs: Fix "grading_results" construction: it's .sample, not ["sample"] (#2343)

Gabor Cselleac3d7a456b61
diff --git a/examples/evaluation/use-cases/EvalsAPI_Image_Inputs.ipynb b/examples/evaluation/use-cases/EvalsAPI_Image_Inputs.ipynb
index 4f95bdfa..ac6666fd 100644
--- a/examples/evaluation/use-cases/EvalsAPI_Image_Inputs.ipynb
+++ b/examples/evaluation/use-cases/EvalsAPI_Image_Inputs.ipynb
@@ -348,6 +348,8 @@
" <th>prompt</th>\n",
" <th>reference</th>\n",
" <th>model_response</th>\n",
+ " <th>score</th>\n",
+ " <th>passed</th>\n",
" <th>grading_results</th>\n",
" </tr>\n",
" </thead>\n",
@@ -357,20 +359,26 @@
" <td>Please provide latex code to replicate this table</td>\n",
" <td>Below is the latex code for your table:\\n```te...</td>\n",
" <td>Certainly! Below is the LaTeX code to replicat...</td>\n",
- " <td>{\"steps\":[{\"description\":\"Assess if the provid...</td>\n",
+ " <td>0.5</td>\n",
+ " <td>False</td>\n",
+ " <td>{\"steps\":[{\"description\":\"Interpreted prompt r...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What ingredients do I need to make this?</td>\n",
" <td>This appears to be a classic Margherita pizza,...</td>\n",
- " <td>To make a classic Margherita pizza like the on...</td>\n",
- " <td>{\"steps\":[{\"description\":\"Check if model ident...</td>\n",
+ " <td>To make a classic Margherita pizza similar to ...</td>\n",
+ " <td>1.0</td>\n",
+ " <td>True</td>\n",
+ " <td>{\"steps\":[{\"description\":\"Compare model's ingr...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Is this safe for a vegan to eat?</td>\n",
" <td>Based on the image, this dish appears to be a ...</td>\n",
- " <td>To determine if the dish is safe for a vegan t...</td>\n",
+ " <td>To determine if the dish is safe for a vegan, ...</td>\n",
+ " <td>1.0</td>\n",
+ " <td>True</td>\n",
" <td>{\"steps\":[{\"description\":\"Compare model respon...</td>\n",
" </tr>\n",
" </tbody>\n",
@@ -388,14 +396,14 @@
"1 This appears to be a classic Margherita pizza,... \n",
"2 Based on the image, this dish appears to be a ... \n",
"\n",
- " model_response \\\n",
- "0 Certainly! Below is the LaTeX code to replicat... \n",
- "1 To make a classic Margherita pizza like the on... \n",
- "2 To determine if the dish is safe for a vegan t... \n",
+ " model_response score passed \\\n",
+ "0 Certainly! Below is the LaTeX code to replicat... 0.5 False \n",
+ "1 To make a classic Margherita pizza similar to ... 1.0 True \n",
+ "2 To determine if the dish is safe for a vegan, ... 1.0 True \n",
"\n",
" grading_results \n",
- "0 {\"steps\":[{\"description\":\"Assess if the provid... \n",
- "1 {\"steps\":[{\"description\":\"Check if model ident... \n",
+ "0 {\"steps\":[{\"description\":\"Interpreted prompt r... \n",
+ "1 {\"steps\":[{\"description\":\"Compare model's ingr... \n",
"2 {\"steps\":[{\"description\":\"Compare model respon... "
]
},
@@ -411,11 +419,12 @@
" run_id=run.id, eval_id=eval_object.id\n",
" ))\n",
" df = pd.DataFrame({\n",
- " \"prompt\": [item.datasource_item[\"prompt\"]for item in output_items],\n",
+ " \"prompt\": [item.datasource_item[\"prompt\"] for item in output_items],\n",
" \"reference\": [item.datasource_item[\"reference\"] for item in output_items],\n",
" \"model_response\": [item.sample.output[0].content for item in output_items],\n",
- " \"grading_results\": [item.results[0][\"sample\"][\"output\"][0][\"content\"]\n",
- " for item in output_items]\n",
+ " \"score\": [item.results[0].score for item in output_items],\n",
+ " \"passed\": [item.results[0].passed for item in output_items],\n",
+ " \"grading_results\": [item.results[0].sample[\"output\"][0][\"content\"] for item in output_items]\n",
" })\n",
" display(df)\n",
" break\n",