Skip to content

Commit f50cbbc

Browse files
Revert "wip"
This reverts commit ce552e2.
1 parent d80ed1f commit f50cbbc

File tree

1 file changed

+0
-151
lines changed

1 file changed

+0
-151
lines changed

examples/evaluation/use-cases/responses-evaluation.ipynb

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,14 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
<<<<<<< HEAD
2019
"execution_count": 30,
21-
=======
22-
"execution_count": 68,
23-
>>>>>>> 562e852 (wip)
2420
"metadata": {},
2521
"outputs": [],
2622
"source": [
2723
"import openai\n",
2824
"import os\n",
2925
"\n",
30-
<<<<<<< HEAD
3126
"\n",
32-
=======
33-
>>>>>>> 562e852 (wip)
3427
"client = openai.OpenAI()"
3528
]
3629
},
@@ -51,11 +44,7 @@
5144
"source": [
5245
"openai_sdk_file_path = os.path.dirname(openai.__file__)\n",
5346
"\n",
54-
<<<<<<< HEAD
5547
"# Get some example code files from the OpenAI SDK \n",
56-
=======
57-
"# Get some example code files from the OpenAI SDK\n",
58-
>>>>>>> 562e852 (wip)
5948
"file_paths = [\n",
6049
" os.path.join(openai_sdk_file_path, \"resources\", \"evals\", \"evals.py\"),\n",
6150
" os.path.join(openai_sdk_file_path, \"resources\", \"responses\", \"responses.py\"),\n",
@@ -71,20 +60,12 @@
7160
"cell_type": "markdown",
7261
"metadata": {},
7362
"source": [
74-
<<<<<<< HEAD
7563
"Now, lets generate some responses. "
76-
=======
77-
"Now, lets generate some responses"
78-
>>>>>>> 562e852 (wip)
7964
]
8065
},
8166
{
8267
"cell_type": "code",
83-
<<<<<<< HEAD
8468
"execution_count": null,
85-
=======
86-
"execution_count": 66,
87-
>>>>>>> 562e852 (wip)
8869
"metadata": {},
8970
"outputs": [],
9071
"source": [
@@ -105,7 +86,6 @@
10586
" ],\n",
10687
" model=\"gpt-4o-mini\",\n",
10788
" )\n",
108-
<<<<<<< HEAD
10989
" print(response.output_text)"
11090
]
11191
},
@@ -114,24 +94,15 @@
11494
"metadata": {},
11595
"source": [
11696
"Note that in order for this to work, you'll have to be doing this on an org where data logging isn't disabled (through zdr, etc). If you aren't sure if this is the case for you, go to https://platform.openai.com/logs?api=responses and see if you can see the responses you just generated."
117-
=======
118-
" break\n",
119-
" print(response.id)"
120-
>>>>>>> 562e852 (wip)
12197
]
12298
},
12399
{
124100
"cell_type": "code",
125-
<<<<<<< HEAD
126101
"execution_count": 31,
127-
=======
128-
"execution_count": 49,
129-
>>>>>>> 562e852 (wip)
130102
"metadata": {},
131103
"outputs": [],
132104
"source": [
133105
"grader_system_prompt = \"\"\"\n",
134-
<<<<<<< HEAD
135106
"You are **Code-Explanation Grader**, an expert software engineer and technical writer. \n",
136107
"Your job is to score how well *Model A* explained the purpose and behaviour of a given source-code file.\n",
137108
"\n",
@@ -191,88 +162,20 @@
191162
"Then set `\"result\": \"4.0\"` (example).\n",
192163
"\n",
193164
"Be rigorous and unbiased.\n",
194-
=======
195-
"We've created a consumer-facing Evals product to help AI integrators quickly and clearly understand their models' real-world performance. Your role is to serve as a Universal Evaluator, automatically grading responses to measure how well each model output addresses user needs and expectations.\n",
196-
"\n",
197-
"Given the conversation messages, assign a quality score in the `result` key of the response in the inclusive range between 1.0 (poor) and 7.0 (excellent). Customers will analyze your collective scores and reasoning to gain actionable insights into their models' performance.\n",
198-
"\n",
199-
"---\n",
200-
"\n",
201-
"## Things to Consider\n",
202-
"\n",
203-
"- Evaluate the overall value provided to the user\n",
204-
"- Verify all claims and do not take the AI's statements at face value! Errors might be very hard to find and well hidden.\n",
205-
"- Differentiate between minor errors (slight utility reduction) and major errors (significant trust or safety impact).\n",
206-
"- Reward answers that closely follow user instructions.\n",
207-
"- Reserve the highest and lowest reward scores for cases where you have complete certainty about correctness and utility.\n",
208-
"\n",
209-
"\n",
210-
"---\n",
211-
"\n",
212-
"## Secondary Labels to Support Final Utility Score Prediction\n",
213-
"\n",
214-
"To help you assign an accurate final utility score, first analyze and predict several important aspects of the AI response. Crucially, these intermediate evaluations should precede your final utility score prediction.\n",
215-
"\n",
216-
"Your structured output must match the provided schema:\n",
217-
"\n",
218-
"- `steps`: A JSON array of objects, each containing:\n",
219-
" - `description`: A detailed explanation of your reasoning for each step.\n",
220-
" - `result`: The float score reached based on the reasoning in this step.\n",
221-
"\n",
222-
"### Steps to Predict (in order):\n",
223-
"\n",
224-
"1. **major_errors**\n",
225-
" - *description*: Identify and explain any significant errors.\n",
226-
" - *conclusion*: List major errors found, or indicate \"None\".\n",
227-
"\n",
228-
"2. **minor_errors**\n",
229-
" - *description*: Identify and explain any minor inaccuracies.\n",
230-
" - *conclusion*: List minor errors found, or indicate \"None\".\n",
231-
"\n",
232-
"3. **potential_improvements**\n",
233-
" - *description*: Suggest enhancements that would improve the response.\n",
234-
" - *conclusion*: List suggested improvements, or indicate \"None\".\n",
235-
"\n",
236-
"---\n",
237-
"\n",
238-
"## JSON Response Structure\n",
239-
"\n",
240-
"Once you predicted all the above fields you need to assign a float between 1 and 7 to indicate the response's utility compared to the alternative responses. Use your best judgment for the meaning of `final_score`. Your response should be a JSON that can be loaded with json.loads in Python and contains:\n",
241-
"- steps: An array of objects representing your reasoning steps. Each step includes:\n",
242-
" - description (string): Detailed reasoning for this step.\n",
243-
" - result (string): The float score derived from this reasoning.\n",
244-
"- result (float): A numeric quality score as a string, in the inclusive range [1,7].\n",
245-
"\n",
246-
"---\n",
247-
"\n",
248-
"## Notes\n",
249-
"\n",
250-
"- Be meticulous in identifying errors, especially subtle or high-impact ones.\n",
251-
"- Avoid being too kind by giving overly high scores easily, it's important to often keep a gap at the top to continue having signal for improvement. Only use [6.5, 7) if the answer is truly mind blowing and you don't see how it could have been improved.\n",
252-
"- Never take the AI's responses at face value—verify everything thoroughly.\n",
253-
>>>>>>> 562e852 (wip)
254165
"\"\"\"\n",
255166
"user_input_message = \"\"\"**User input**\n",
256167
"\n",
257168
"{{item.input}}\n",
258169
"\n",
259170
"**Response to evaluate**\n",
260171
"\n",
261-
<<<<<<< HEAD
262172
"{{sample.output_text}}\n",
263-
=======
264-
"{{sample.output_text}\n",
265-
>>>>>>> 562e852 (wip)
266173
"\"\"\""
267174
]
268175
},
269176
{
270177
"cell_type": "code",
271-
<<<<<<< HEAD
272178
"execution_count": 25,
273-
=======
274-
"execution_count": 71,
275-
>>>>>>> 562e852 (wip)
276179
"metadata": {},
277180
"outputs": [],
278181
"source": [
@@ -294,12 +197,8 @@
294197
" \"content\": user_input_message,\n",
295198
" },\n",
296199
" ],\n",
297-
<<<<<<< HEAD
298200
" \"range\": [1, 7],\n",
299201
" \"pass_threshold\": 5.5,\n",
300-
=======
301-
" \"pass_threshold\": 0.5\n",
302-
>>>>>>> 562e852 (wip)
303202
" }\n",
304203
" ]\n",
305204
")"
@@ -314,7 +213,6 @@
314213
},
315214
{
316215
"cell_type": "code",
317-
<<<<<<< HEAD
318216
"execution_count": 26,
319217
"metadata": {},
320218
"outputs": [],
@@ -325,17 +223,6 @@
325223
" data_source={\n",
326224
" \"type\": \"responses\",\n",
327225
" \"source\": {\"type\": \"responses\", \"limit\": len(file_paths)}, # just grab the most recent responses\n",
328-
=======
329-
"execution_count": 72,
330-
"metadata": {},
331-
"outputs": [],
332-
"source": [
333-
"gpt_4o_run = client.evals.runs.create(\n",
334-
" eval_id=logs_eval.id,\n",
335-
" data_source={\n",
336-
" \"type\": \"responses\",\n",
337-
" \"source\": {\"type\": \"responses\", \"limit\": len(file_paths)},\n",
338-
>>>>>>> 562e852 (wip)
339226
" },\n",
340227
")"
341228
]
@@ -349,20 +236,12 @@
349236
},
350237
{
351238
"cell_type": "code",
352-
<<<<<<< HEAD
353239
"execution_count": 27,
354240
"metadata": {},
355241
"outputs": [],
356242
"source": [
357243
"gpt_41_mini_run = client.evals.runs.create(\n",
358244
" name=\"gpt-4.1-mini\",\n",
359-
=======
360-
"execution_count": 73,
361-
"metadata": {},
362-
"outputs": [],
363-
"source": [
364-
"gpt_41_run = client.evals.runs.create(\n",
365-
>>>>>>> 562e852 (wip)
366245
" eval_id=logs_eval.id,\n",
367246
" data_source={\n",
368247
" \"type\": \"responses\",\n",
@@ -385,7 +264,6 @@
385264
},
386265
{
387266
"cell_type": "code",
388-
<<<<<<< HEAD
389267
"execution_count": null,
390268
"metadata": {},
391269
"outputs": [],
@@ -396,41 +274,12 @@
396274
{
397275
"cell_type": "markdown",
398276
"metadata": {},
399-
=======
400-
"execution_count": 74,
401-
"metadata": {},
402-
"outputs": [
403-
{
404-
"data": {
405-
"text/plain": [
406-
"'https://platform.openai.com/evaluations/eval_6822dd1c4d308190855601dc7fe982bd?project_id=proj_YFvXZA3VxHbZx5aSJv6SAM5B&run_id=evalrun_6822dd1f89b88190a3287c706fd599f4'"
407-
]
408-
},
409-
"execution_count": 74,
410-
"metadata": {},
411-
"output_type": "execute_result"
412-
}
413-
],
414-
"source": [
415-
"gpt_41_run.report_url"
416-
]
417-
},
418-
{
419-
"cell_type": "code",
420-
"execution_count": null,
421-
"metadata": {},
422-
"outputs": [],
423-
>>>>>>> 562e852 (wip)
424277
"source": []
425278
}
426279
],
427280
"metadata": {
428281
"kernelspec": {
429-
<<<<<<< HEAD
430282
"display_name": "Python 3",
431-
=======
432-
"display_name": "openai",
433-
>>>>>>> 562e852 (wip)
434283
"language": "python",
435284
"name": "python3"
436285
},

0 commit comments

Comments
 (0)