Deploy Phase 2 dataset classifier (part 14)
Browse filesSource GitHub commit: 740750973b9c67c0d55c209c006d860192f79dc2
This view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +36 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/INSTALLER +1 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/METADATA +905 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/RECORD +0 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/WHEEL +4 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/entry_points.txt +2 -0
- .venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/licenses/LICENSE +201 -0
- .venv/lib/python3.13/site-packages/openai/types/conversations/text_content.py +13 -0
- .venv/lib/python3.13/site-packages/openai/types/create_embedding_response.py +31 -0
- .venv/lib/python3.13/site-packages/openai/types/embedding.py +23 -0
- .venv/lib/python3.13/site-packages/openai/types/embedding_create_params.py +55 -0
- .venv/lib/python3.13/site-packages/openai/types/embedding_model.py +7 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_create_params.py +202 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_create_response.py +111 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_custom_data_source_config.py +21 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_delete_response.py +13 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_list_params.py +27 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_list_response.py +111 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_retrieve_response.py +111 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_stored_completions_data_source_config.py +32 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_update_params.py +25 -0
- .venv/lib/python3.13/site-packages/openai/types/eval_update_response.py +111 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/__init__.py +22 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/create_eval_completions_run_data_source.py +229 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/create_eval_completions_run_data_source_param.py +225 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/create_eval_jsonl_run_data_source.py +42 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/create_eval_jsonl_run_data_source_param.py +47 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/eval_api_error.py +13 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_cancel_response.py +403 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_create_params.py +326 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_create_response.py +403 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_delete_response.py +15 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_list_params.py +27 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_list_response.py +403 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/run_retrieve_response.py +403 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/runs/__init__.py +7 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_list_params.py +30 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_list_response.py +134 -0
- .venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_retrieve_response.py +134 -0
- .venv/lib/python3.13/site-packages/openai/types/file_chunking_strategy.py +14 -0
- .venv/lib/python3.13/site-packages/openai/types/file_chunking_strategy_param.py +13 -0
- .venv/lib/python3.13/site-packages/openai/types/file_content.py +7 -0
- .venv/lib/python3.13/site-packages/openai/types/file_create_params.py +45 -0
- .venv/lib/python3.13/site-packages/openai/types/file_deleted.py +15 -0
- .venv/lib/python3.13/site-packages/openai/types/file_list_params.py +33 -0
- .venv/lib/python3.13/site-packages/openai/types/file_object.py +58 -0
- .venv/lib/python3.13/site-packages/openai/types/file_purpose.py +7 -0
- .venv/lib/python3.13/site-packages/openai/types/fine_tuning/__init__.py +26 -0
- .venv/lib/python3.13/site-packages/openai/types/fine_tuning/alpha/__init__.py +8 -0
- .venv/lib/python3.13/site-packages/openai/types/fine_tuning/alpha/grader_run_params.py +40 -0
.gitattributes
CHANGED
|
@@ -63,3 +63,39 @@
|
|
| 63 |
.venv/lib/python3.13/site-packages/numpy.libs/libgfortran-83c28eba-b4027c22.so.5.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 64 |
.venv/lib/python3.13/site-packages/numpy.libs/libquadmath-2284e583-a9307bba.so.0.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 65 |
.venv/lib/python3.13/site-packages/numpy.libs/libscipy_openblas64_-017048f4.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
.venv/lib/python3.13/site-packages/numpy.libs/libgfortran-83c28eba-b4027c22.so.5.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 64 |
.venv/lib/python3.13/site-packages/numpy.libs/libquadmath-2284e583-a9307bba.so.0.0.0 filter=lfs diff=lfs merge=lfs -text
|
| 65 |
.venv/lib/python3.13/site-packages/numpy.libs/libscipy_openblas64_-017048f4.so filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
.venv/lib/python3.13/site-packages/orjson/orjson.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/algos.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/arrays.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/groupby.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/hashing.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/hashtable.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/index.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/internals.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/interval.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/join.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/lib.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/missing.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 78 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/ops.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 79 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/parsers.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 80 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/reshape.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 81 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/sas.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 82 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/sparse.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 83 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/testing.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 84 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslib.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 85 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/conversion.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 86 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/dtypes.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 87 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/fields.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 88 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/nattype.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 89 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/np_datetime.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 90 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/offsets.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 91 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/parsing.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 92 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/period.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 93 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/strptime.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 94 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/timedeltas.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 95 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/timestamps.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 96 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/timezones.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 97 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/tzconversion.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 98 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/tslibs/vectorized.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 99 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/window/aggregations.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 100 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/window/indexers.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 101 |
+
.venv/lib/python3.13/site-packages/pandas/_libs/writers.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,905 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.3
|
| 2 |
+
Name: openai
|
| 3 |
+
Version: 1.109.1
|
| 4 |
+
Summary: The official Python library for the openai API
|
| 5 |
+
Project-URL: Homepage, https://github.com/openai/openai-python
|
| 6 |
+
Project-URL: Repository, https://github.com/openai/openai-python
|
| 7 |
+
Author-email: OpenAI <support@openai.com>
|
| 8 |
+
License: Apache-2.0
|
| 9 |
+
Classifier: Intended Audience :: Developers
|
| 10 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 11 |
+
Classifier: Operating System :: MacOS
|
| 12 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 13 |
+
Classifier: Operating System :: OS Independent
|
| 14 |
+
Classifier: Operating System :: POSIX
|
| 15 |
+
Classifier: Operating System :: POSIX :: Linux
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 22 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 23 |
+
Classifier: Typing :: Typed
|
| 24 |
+
Requires-Python: >=3.8
|
| 25 |
+
Requires-Dist: anyio<5,>=3.5.0
|
| 26 |
+
Requires-Dist: distro<2,>=1.7.0
|
| 27 |
+
Requires-Dist: httpx<1,>=0.23.0
|
| 28 |
+
Requires-Dist: jiter<1,>=0.4.0
|
| 29 |
+
Requires-Dist: pydantic<3,>=1.9.0
|
| 30 |
+
Requires-Dist: sniffio
|
| 31 |
+
Requires-Dist: tqdm>4
|
| 32 |
+
Requires-Dist: typing-extensions<5,>=4.11
|
| 33 |
+
Provides-Extra: aiohttp
|
| 34 |
+
Requires-Dist: aiohttp; extra == 'aiohttp'
|
| 35 |
+
Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
|
| 36 |
+
Provides-Extra: datalib
|
| 37 |
+
Requires-Dist: numpy>=1; extra == 'datalib'
|
| 38 |
+
Requires-Dist: pandas-stubs>=1.1.0.11; extra == 'datalib'
|
| 39 |
+
Requires-Dist: pandas>=1.2.3; extra == 'datalib'
|
| 40 |
+
Provides-Extra: realtime
|
| 41 |
+
Requires-Dist: websockets<16,>=13; extra == 'realtime'
|
| 42 |
+
Provides-Extra: voice-helpers
|
| 43 |
+
Requires-Dist: numpy>=2.0.2; extra == 'voice-helpers'
|
| 44 |
+
Requires-Dist: sounddevice>=0.5.1; extra == 'voice-helpers'
|
| 45 |
+
Description-Content-Type: text/markdown
|
| 46 |
+
|
| 47 |
+
# OpenAI Python API library
|
| 48 |
+
|
| 49 |
+
<!-- prettier-ignore -->
|
| 50 |
+
[)](https://pypi.org/project/openai/)
|
| 51 |
+
|
| 52 |
+
The OpenAI Python library provides convenient access to the OpenAI REST API from any Python 3.8+
|
| 53 |
+
application. The library includes type definitions for all request params and response fields,
|
| 54 |
+
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
| 55 |
+
|
| 56 |
+
It is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi) with [Stainless](https://stainlessapi.com/).
|
| 57 |
+
|
| 58 |
+
## Documentation
|
| 59 |
+
|
| 60 |
+
The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs/api-reference). The full API of this library can be found in [api.md](https://github.com/openai/openai-python/tree/main/api.md).
|
| 61 |
+
|
| 62 |
+
## Installation
|
| 63 |
+
|
| 64 |
+
```sh
|
| 65 |
+
# install from PyPI
|
| 66 |
+
pip install openai
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
## Usage
|
| 70 |
+
|
| 71 |
+
The full API of this library can be found in [api.md](https://github.com/openai/openai-python/tree/main/api.md).
|
| 72 |
+
|
| 73 |
+
The primary API for interacting with OpenAI models is the [Responses API](https://platform.openai.com/docs/api-reference/responses). You can generate text from the model with the code below.
|
| 74 |
+
|
| 75 |
+
```python
|
| 76 |
+
import os
|
| 77 |
+
from openai import OpenAI
|
| 78 |
+
|
| 79 |
+
client = OpenAI(
|
| 80 |
+
# This is the default and can be omitted
|
| 81 |
+
api_key=os.environ.get("OPENAI_API_KEY"),
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
response = client.responses.create(
|
| 85 |
+
model="gpt-4o",
|
| 86 |
+
instructions="You are a coding assistant that talks like a pirate.",
|
| 87 |
+
input="How do I check if a Python object is an instance of a class?",
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
print(response.output_text)
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
The previous standard (supported indefinitely) for generating text is the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat). You can use that API to generate text from the model with the code below.
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
from openai import OpenAI
|
| 97 |
+
|
| 98 |
+
client = OpenAI()
|
| 99 |
+
|
| 100 |
+
completion = client.chat.completions.create(
|
| 101 |
+
model="gpt-4o",
|
| 102 |
+
messages=[
|
| 103 |
+
{"role": "developer", "content": "Talk like a pirate."},
|
| 104 |
+
{
|
| 105 |
+
"role": "user",
|
| 106 |
+
"content": "How do I check if a Python object is an instance of a class?",
|
| 107 |
+
},
|
| 108 |
+
],
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
print(completion.choices[0].message.content)
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
While you can provide an `api_key` keyword argument,
|
| 115 |
+
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
| 116 |
+
to add `OPENAI_API_KEY="My API Key"` to your `.env` file
|
| 117 |
+
so that your API key is not stored in source control.
|
| 118 |
+
[Get an API key here](https://platform.openai.com/settings/organization/api-keys).
|
| 119 |
+
|
| 120 |
+
### Vision
|
| 121 |
+
|
| 122 |
+
With an image URL:
|
| 123 |
+
|
| 124 |
+
```python
|
| 125 |
+
prompt = "What is in this image?"
|
| 126 |
+
img_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/2023_06_08_Raccoon1.jpg/1599px-2023_06_08_Raccoon1.jpg"
|
| 127 |
+
|
| 128 |
+
response = client.responses.create(
|
| 129 |
+
model="gpt-4o-mini",
|
| 130 |
+
input=[
|
| 131 |
+
{
|
| 132 |
+
"role": "user",
|
| 133 |
+
"content": [
|
| 134 |
+
{"type": "input_text", "text": prompt},
|
| 135 |
+
{"type": "input_image", "image_url": f"{img_url}"},
|
| 136 |
+
],
|
| 137 |
+
}
|
| 138 |
+
],
|
| 139 |
+
)
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
With the image as a base64 encoded string:
|
| 143 |
+
|
| 144 |
+
```python
|
| 145 |
+
import base64
|
| 146 |
+
from openai import OpenAI
|
| 147 |
+
|
| 148 |
+
client = OpenAI()
|
| 149 |
+
|
| 150 |
+
prompt = "What is in this image?"
|
| 151 |
+
with open("path/to/image.png", "rb") as image_file:
|
| 152 |
+
b64_image = base64.b64encode(image_file.read()).decode("utf-8")
|
| 153 |
+
|
| 154 |
+
response = client.responses.create(
|
| 155 |
+
model="gpt-4o-mini",
|
| 156 |
+
input=[
|
| 157 |
+
{
|
| 158 |
+
"role": "user",
|
| 159 |
+
"content": [
|
| 160 |
+
{"type": "input_text", "text": prompt},
|
| 161 |
+
{"type": "input_image", "image_url": f"data:image/png;base64,{b64_image}"},
|
| 162 |
+
],
|
| 163 |
+
}
|
| 164 |
+
],
|
| 165 |
+
)
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
## Async usage
|
| 169 |
+
|
| 170 |
+
Simply import `AsyncOpenAI` instead of `OpenAI` and use `await` with each API call:
|
| 171 |
+
|
| 172 |
+
```python
|
| 173 |
+
import os
|
| 174 |
+
import asyncio
|
| 175 |
+
from openai import AsyncOpenAI
|
| 176 |
+
|
| 177 |
+
client = AsyncOpenAI(
|
| 178 |
+
# This is the default and can be omitted
|
| 179 |
+
api_key=os.environ.get("OPENAI_API_KEY"),
|
| 180 |
+
)
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
async def main() -> None:
|
| 184 |
+
response = await client.responses.create(
|
| 185 |
+
model="gpt-4o", input="Explain disestablishmentarianism to a smart five year old."
|
| 186 |
+
)
|
| 187 |
+
print(response.output_text)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
asyncio.run(main())
|
| 191 |
+
```
|
| 192 |
+
|
| 193 |
+
Functionality between the synchronous and asynchronous clients is otherwise identical.
|
| 194 |
+
|
| 195 |
+
### With aiohttp
|
| 196 |
+
|
| 197 |
+
By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
|
| 198 |
+
|
| 199 |
+
You can enable this by installing `aiohttp`:
|
| 200 |
+
|
| 201 |
+
```sh
|
| 202 |
+
# install from PyPI
|
| 203 |
+
pip install openai[aiohttp]
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
| 207 |
+
|
| 208 |
+
```python
|
| 209 |
+
import asyncio
|
| 210 |
+
from openai import DefaultAioHttpClient
|
| 211 |
+
from openai import AsyncOpenAI
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
async def main() -> None:
|
| 215 |
+
async with AsyncOpenAI(
|
| 216 |
+
api_key="My API Key",
|
| 217 |
+
http_client=DefaultAioHttpClient(),
|
| 218 |
+
) as client:
|
| 219 |
+
chat_completion = await client.chat.completions.create(
|
| 220 |
+
messages=[
|
| 221 |
+
{
|
| 222 |
+
"role": "user",
|
| 223 |
+
"content": "Say this is a test",
|
| 224 |
+
}
|
| 225 |
+
],
|
| 226 |
+
model="gpt-4o",
|
| 227 |
+
)
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
asyncio.run(main())
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
## Streaming responses
|
| 234 |
+
|
| 235 |
+
We provide support for streaming responses using Server Side Events (SSE).
|
| 236 |
+
|
| 237 |
+
```python
|
| 238 |
+
from openai import OpenAI
|
| 239 |
+
|
| 240 |
+
client = OpenAI()
|
| 241 |
+
|
| 242 |
+
stream = client.responses.create(
|
| 243 |
+
model="gpt-4o",
|
| 244 |
+
input="Write a one-sentence bedtime story about a unicorn.",
|
| 245 |
+
stream=True,
|
| 246 |
+
)
|
| 247 |
+
|
| 248 |
+
for event in stream:
|
| 249 |
+
print(event)
|
| 250 |
+
```
|
| 251 |
+
|
| 252 |
+
The async client uses the exact same interface.
|
| 253 |
+
|
| 254 |
+
```python
|
| 255 |
+
import asyncio
|
| 256 |
+
from openai import AsyncOpenAI
|
| 257 |
+
|
| 258 |
+
client = AsyncOpenAI()
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
async def main():
|
| 262 |
+
stream = await client.responses.create(
|
| 263 |
+
model="gpt-4o",
|
| 264 |
+
input="Write a one-sentence bedtime story about a unicorn.",
|
| 265 |
+
stream=True,
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
async for event in stream:
|
| 269 |
+
print(event)
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
asyncio.run(main())
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
## Realtime API
|
| 276 |
+
|
| 277 |
+
The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a WebSocket connection.
|
| 278 |
+
|
| 279 |
+
Under the hood the SDK uses the [`websockets`](https://websockets.readthedocs.io/en/stable/) library to manage connections.
|
| 280 |
+
|
| 281 |
+
The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime).
|
| 282 |
+
|
| 283 |
+
Basic text based example:
|
| 284 |
+
|
| 285 |
+
```py
|
| 286 |
+
import asyncio
|
| 287 |
+
from openai import AsyncOpenAI
|
| 288 |
+
|
| 289 |
+
async def main():
|
| 290 |
+
client = AsyncOpenAI()
|
| 291 |
+
|
| 292 |
+
async with client.realtime.connect(model="gpt-realtime") as connection:
|
| 293 |
+
await connection.session.update(session={'modalities': ['text']})
|
| 294 |
+
|
| 295 |
+
await connection.conversation.item.create(
|
| 296 |
+
item={
|
| 297 |
+
"type": "message",
|
| 298 |
+
"role": "user",
|
| 299 |
+
"content": [{"type": "input_text", "text": "Say hello!"}],
|
| 300 |
+
}
|
| 301 |
+
)
|
| 302 |
+
await connection.response.create()
|
| 303 |
+
|
| 304 |
+
async for event in connection:
|
| 305 |
+
if event.type == 'response.text.delta':
|
| 306 |
+
print(event.delta, flush=True, end="")
|
| 307 |
+
|
| 308 |
+
elif event.type == 'response.text.done':
|
| 309 |
+
print()
|
| 310 |
+
|
| 311 |
+
elif event.type == "response.done":
|
| 312 |
+
break
|
| 313 |
+
|
| 314 |
+
asyncio.run(main())
|
| 315 |
+
```
|
| 316 |
+
|
| 317 |
+
However the real magic of the Realtime API is handling audio inputs / outputs, see this example [TUI script](https://github.com/openai/openai-python/blob/main/examples/realtime/push_to_talk_app.py) for a fully fledged example.
|
| 318 |
+
|
| 319 |
+
### Realtime error handling
|
| 320 |
+
|
| 321 |
+
Whenever an error occurs, the Realtime API will send an [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling) and the connection will stay open and remain usable. This means you need to handle it yourself, as _no errors are raised directly_ by the SDK when an `error` event comes in.
|
| 322 |
+
|
| 323 |
+
```py
|
| 324 |
+
client = AsyncOpenAI()
|
| 325 |
+
|
| 326 |
+
async with client.realtime.connect(model="gpt-realtime") as connection:
|
| 327 |
+
...
|
| 328 |
+
async for event in connection:
|
| 329 |
+
if event.type == 'error':
|
| 330 |
+
print(event.error.type)
|
| 331 |
+
print(event.error.code)
|
| 332 |
+
print(event.error.event_id)
|
| 333 |
+
print(event.error.message)
|
| 334 |
+
```
|
| 335 |
+
|
| 336 |
+
## Using types
|
| 337 |
+
|
| 338 |
+
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
|
| 339 |
+
|
| 340 |
+
- Serializing back into JSON, `model.to_json()`
|
| 341 |
+
- Converting to a dictionary, `model.to_dict()`
|
| 342 |
+
|
| 343 |
+
Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.
|
| 344 |
+
|
| 345 |
+
## Pagination
|
| 346 |
+
|
| 347 |
+
List methods in the OpenAI API are paginated.
|
| 348 |
+
|
| 349 |
+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
|
| 350 |
+
|
| 351 |
+
```python
|
| 352 |
+
from openai import OpenAI
|
| 353 |
+
|
| 354 |
+
client = OpenAI()
|
| 355 |
+
|
| 356 |
+
all_jobs = []
|
| 357 |
+
# Automatically fetches more pages as needed.
|
| 358 |
+
for job in client.fine_tuning.jobs.list(
|
| 359 |
+
limit=20,
|
| 360 |
+
):
|
| 361 |
+
# Do something with job here
|
| 362 |
+
all_jobs.append(job)
|
| 363 |
+
print(all_jobs)
|
| 364 |
+
```
|
| 365 |
+
|
| 366 |
+
Or, asynchronously:
|
| 367 |
+
|
| 368 |
+
```python
|
| 369 |
+
import asyncio
|
| 370 |
+
from openai import AsyncOpenAI
|
| 371 |
+
|
| 372 |
+
client = AsyncOpenAI()
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
async def main() -> None:
|
| 376 |
+
all_jobs = []
|
| 377 |
+
# Iterate through items across all pages, issuing requests as needed.
|
| 378 |
+
async for job in client.fine_tuning.jobs.list(
|
| 379 |
+
limit=20,
|
| 380 |
+
):
|
| 381 |
+
all_jobs.append(job)
|
| 382 |
+
print(all_jobs)
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
asyncio.run(main())
|
| 386 |
+
```
|
| 387 |
+
|
| 388 |
+
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
|
| 389 |
+
|
| 390 |
+
```python
|
| 391 |
+
first_page = await client.fine_tuning.jobs.list(
|
| 392 |
+
limit=20,
|
| 393 |
+
)
|
| 394 |
+
if first_page.has_next_page():
|
| 395 |
+
print(f"will fetch next page using these details: {first_page.next_page_info()}")
|
| 396 |
+
next_page = await first_page.get_next_page()
|
| 397 |
+
print(f"number of items we just fetched: {len(next_page.data)}")
|
| 398 |
+
|
| 399 |
+
# Remove `await` for non-async usage.
|
| 400 |
+
```
|
| 401 |
+
|
| 402 |
+
Or just work directly with the returned data:
|
| 403 |
+
|
| 404 |
+
```python
|
| 405 |
+
first_page = await client.fine_tuning.jobs.list(
|
| 406 |
+
limit=20,
|
| 407 |
+
)
|
| 408 |
+
|
| 409 |
+
print(f"next page cursor: {first_page.after}") # => "next page cursor: ..."
|
| 410 |
+
for job in first_page.data:
|
| 411 |
+
print(job.id)
|
| 412 |
+
|
| 413 |
+
# Remove `await` for non-async usage.
|
| 414 |
+
```
|
| 415 |
+
|
| 416 |
+
## Nested params
|
| 417 |
+
|
| 418 |
+
Nested parameters are dictionaries, typed using `TypedDict`, for example:
|
| 419 |
+
|
| 420 |
+
```python
|
| 421 |
+
from openai import OpenAI
|
| 422 |
+
|
| 423 |
+
client = OpenAI()
|
| 424 |
+
|
| 425 |
+
response = client.chat.responses.create(
|
| 426 |
+
input=[
|
| 427 |
+
{
|
| 428 |
+
"role": "user",
|
| 429 |
+
"content": "How much ?",
|
| 430 |
+
}
|
| 431 |
+
],
|
| 432 |
+
model="gpt-4o",
|
| 433 |
+
response_format={"type": "json_object"},
|
| 434 |
+
)
|
| 435 |
+
```
|
| 436 |
+
|
| 437 |
+
## File uploads
|
| 438 |
+
|
| 439 |
+
Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
|
| 440 |
+
|
| 441 |
+
```python
|
| 442 |
+
from pathlib import Path
|
| 443 |
+
from openai import OpenAI
|
| 444 |
+
|
| 445 |
+
client = OpenAI()
|
| 446 |
+
|
| 447 |
+
client.files.create(
|
| 448 |
+
file=Path("input.jsonl"),
|
| 449 |
+
purpose="fine-tune",
|
| 450 |
+
)
|
| 451 |
+
```
|
| 452 |
+
|
| 453 |
+
The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.
|
| 454 |
+
|
| 455 |
+
## Webhook Verification
|
| 456 |
+
|
| 457 |
+
Verifying webhook signatures is _optional but encouraged_.
|
| 458 |
+
|
| 459 |
+
For more information about webhooks, see [the API docs](https://platform.openai.com/docs/guides/webhooks).
|
| 460 |
+
|
| 461 |
+
### Parsing webhook payloads
|
| 462 |
+
|
| 463 |
+
For most use cases, you will likely want to verify the webhook and parse the payload at the same time. To achieve this, we provide the method `client.webhooks.unwrap()`, which parses a webhook request and verifies that it was sent by OpenAI. This method will raise an error if the signature is invalid.
|
| 464 |
+
|
| 465 |
+
Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). The `.unwrap()` method will parse this JSON for you into an event object after verifying the webhook was sent from OpenAI.
|
| 466 |
+
|
| 467 |
+
```python
|
| 468 |
+
from openai import OpenAI
|
| 469 |
+
from flask import Flask, request
|
| 470 |
+
|
| 471 |
+
app = Flask(__name__)
|
| 472 |
+
client = OpenAI() # OPENAI_WEBHOOK_SECRET environment variable is used by default
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
@app.route("/webhook", methods=["POST"])
|
| 476 |
+
def webhook():
|
| 477 |
+
request_body = request.get_data(as_text=True)
|
| 478 |
+
|
| 479 |
+
try:
|
| 480 |
+
event = client.webhooks.unwrap(request_body, request.headers)
|
| 481 |
+
|
| 482 |
+
if event.type == "response.completed":
|
| 483 |
+
print("Response completed:", event.data)
|
| 484 |
+
elif event.type == "response.failed":
|
| 485 |
+
print("Response failed:", event.data)
|
| 486 |
+
else:
|
| 487 |
+
print("Unhandled event type:", event.type)
|
| 488 |
+
|
| 489 |
+
return "ok"
|
| 490 |
+
except Exception as e:
|
| 491 |
+
print("Invalid signature:", e)
|
| 492 |
+
return "Invalid signature", 400
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
if __name__ == "__main__":
|
| 496 |
+
app.run(port=8000)
|
| 497 |
+
```
|
| 498 |
+
|
| 499 |
+
### Verifying webhook payloads directly
|
| 500 |
+
|
| 501 |
+
In some cases, you may want to verify the webhook separately from parsing the payload. If you prefer to handle these steps separately, we provide the method `client.webhooks.verify_signature()` to _only verify_ the signature of a webhook request. Like `.unwrap()`, this method will raise an error if the signature is invalid.
|
| 502 |
+
|
| 503 |
+
Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). You will then need to parse the body after verifying the signature.
|
| 504 |
+
|
| 505 |
+
```python
|
| 506 |
+
import json
|
| 507 |
+
from openai import OpenAI
|
| 508 |
+
from flask import Flask, request
|
| 509 |
+
|
| 510 |
+
app = Flask(__name__)
|
| 511 |
+
client = OpenAI() # OPENAI_WEBHOOK_SECRET environment variable is used by default
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
@app.route("/webhook", methods=["POST"])
|
| 515 |
+
def webhook():
|
| 516 |
+
request_body = request.get_data(as_text=True)
|
| 517 |
+
|
| 518 |
+
try:
|
| 519 |
+
client.webhooks.verify_signature(request_body, request.headers)
|
| 520 |
+
|
| 521 |
+
# Parse the body after verification
|
| 522 |
+
event = json.loads(request_body)
|
| 523 |
+
print("Verified event:", event)
|
| 524 |
+
|
| 525 |
+
return "ok"
|
| 526 |
+
except Exception as e:
|
| 527 |
+
print("Invalid signature:", e)
|
| 528 |
+
return "Invalid signature", 400
|
| 529 |
+
|
| 530 |
+
|
| 531 |
+
if __name__ == "__main__":
|
| 532 |
+
app.run(port=8000)
|
| 533 |
+
```
|
| 534 |
+
|
| 535 |
+
## Handling errors
|
| 536 |
+
|
| 537 |
+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openai.APIConnectionError` is raised.
|
| 538 |
+
|
| 539 |
+
When the API returns a non-success status code (that is, 4xx or 5xx
|
| 540 |
+
response), a subclass of `openai.APIStatusError` is raised, containing `status_code` and `response` properties.
|
| 541 |
+
|
| 542 |
+
All errors inherit from `openai.APIError`.
|
| 543 |
+
|
| 544 |
+
```python
|
| 545 |
+
import openai
|
| 546 |
+
from openai import OpenAI
|
| 547 |
+
|
| 548 |
+
client = OpenAI()
|
| 549 |
+
|
| 550 |
+
try:
|
| 551 |
+
client.fine_tuning.jobs.create(
|
| 552 |
+
model="gpt-4o",
|
| 553 |
+
training_file="file-abc123",
|
| 554 |
+
)
|
| 555 |
+
except openai.APIConnectionError as e:
|
| 556 |
+
print("The server could not be reached")
|
| 557 |
+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
|
| 558 |
+
except openai.RateLimitError as e:
|
| 559 |
+
print("A 429 status code was received; we should back off a bit.")
|
| 560 |
+
except openai.APIStatusError as e:
|
| 561 |
+
print("Another non-200-range status code was received")
|
| 562 |
+
print(e.status_code)
|
| 563 |
+
print(e.response)
|
| 564 |
+
```
|
| 565 |
+
|
| 566 |
+
Error codes are as follows:
|
| 567 |
+
|
| 568 |
+
| Status Code | Error Type |
|
| 569 |
+
| ----------- | -------------------------- |
|
| 570 |
+
| 400 | `BadRequestError` |
|
| 571 |
+
| 401 | `AuthenticationError` |
|
| 572 |
+
| 403 | `PermissionDeniedError` |
|
| 573 |
+
| 404 | `NotFoundError` |
|
| 574 |
+
| 422 | `UnprocessableEntityError` |
|
| 575 |
+
| 429 | `RateLimitError` |
|
| 576 |
+
| >=500 | `InternalServerError` |
|
| 577 |
+
| N/A | `APIConnectionError` |
|
| 578 |
+
|
| 579 |
+
## Request IDs
|
| 580 |
+
|
| 581 |
+
> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests)
|
| 582 |
+
|
| 583 |
+
All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI.
|
| 584 |
+
|
| 585 |
+
```python
|
| 586 |
+
response = await client.responses.create(
|
| 587 |
+
model="gpt-4o-mini",
|
| 588 |
+
input="Say 'this is a test'.",
|
| 589 |
+
)
|
| 590 |
+
print(response._request_id) # req_123
|
| 591 |
+
```
|
| 592 |
+
|
| 593 |
+
Note that unlike other properties that use an `_` prefix, the `_request_id` property
|
| 594 |
+
_is_ public. Unless documented otherwise, _all_ other `_` prefix properties,
|
| 595 |
+
methods and modules are _private_.
|
| 596 |
+
|
| 597 |
+
> [!IMPORTANT]
|
| 598 |
+
> If you need to access request IDs for failed requests you must catch the `APIStatusError` exception
|
| 599 |
+
|
| 600 |
+
```python
|
| 601 |
+
import openai
|
| 602 |
+
|
| 603 |
+
try:
|
| 604 |
+
completion = await client.chat.completions.create(
|
| 605 |
+
messages=[{"role": "user", "content": "Say this is a test"}], model="gpt-4"
|
| 606 |
+
)
|
| 607 |
+
except openai.APIStatusError as exc:
|
| 608 |
+
print(exc.request_id) # req_123
|
| 609 |
+
raise exc
|
| 610 |
+
```
|
| 611 |
+
|
| 612 |
+
## Retries
|
| 613 |
+
|
| 614 |
+
Certain errors are automatically retried 2 times by default, with a short exponential backoff.
|
| 615 |
+
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
| 616 |
+
429 Rate Limit, and >=500 Internal errors are all retried by default.
|
| 617 |
+
|
| 618 |
+
You can use the `max_retries` option to configure or disable retry settings:
|
| 619 |
+
|
| 620 |
+
```python
|
| 621 |
+
from openai import OpenAI
|
| 622 |
+
|
| 623 |
+
# Configure the default for all requests:
|
| 624 |
+
client = OpenAI(
|
| 625 |
+
# default is 2
|
| 626 |
+
max_retries=0,
|
| 627 |
+
)
|
| 628 |
+
|
| 629 |
+
# Or, configure per-request:
|
| 630 |
+
client.with_options(max_retries=5).chat.completions.create(
|
| 631 |
+
messages=[
|
| 632 |
+
{
|
| 633 |
+
"role": "user",
|
| 634 |
+
"content": "How can I get the name of the current day in JavaScript?",
|
| 635 |
+
}
|
| 636 |
+
],
|
| 637 |
+
model="gpt-4o",
|
| 638 |
+
)
|
| 639 |
+
```
|
| 640 |
+
|
| 641 |
+
## Timeouts
|
| 642 |
+
|
| 643 |
+
By default requests time out after 10 minutes. You can configure this with a `timeout` option,
|
| 644 |
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
| 645 |
+
|
| 646 |
+
```python
|
| 647 |
+
from openai import OpenAI
|
| 648 |
+
|
| 649 |
+
# Configure the default for all requests:
|
| 650 |
+
client = OpenAI(
|
| 651 |
+
# 20 seconds (default is 10 minutes)
|
| 652 |
+
timeout=20.0,
|
| 653 |
+
)
|
| 654 |
+
|
| 655 |
+
# More granular control:
|
| 656 |
+
client = OpenAI(
|
| 657 |
+
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
|
| 658 |
+
)
|
| 659 |
+
|
| 660 |
+
# Override per-request:
|
| 661 |
+
client.with_options(timeout=5.0).chat.completions.create(
|
| 662 |
+
messages=[
|
| 663 |
+
{
|
| 664 |
+
"role": "user",
|
| 665 |
+
"content": "How can I list all files in a directory using Python?",
|
| 666 |
+
}
|
| 667 |
+
],
|
| 668 |
+
model="gpt-4o",
|
| 669 |
+
)
|
| 670 |
+
```
|
| 671 |
+
|
| 672 |
+
On timeout, an `APITimeoutError` is thrown.
|
| 673 |
+
|
| 674 |
+
Note that requests that time out are [retried twice by default](https://github.com/openai/openai-python/tree/main/#retries).
|
| 675 |
+
|
| 676 |
+
## Advanced
|
| 677 |
+
|
| 678 |
+
### Logging
|
| 679 |
+
|
| 680 |
+
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
|
| 681 |
+
|
| 682 |
+
You can enable logging by setting the environment variable `OPENAI_LOG` to `info`.
|
| 683 |
+
|
| 684 |
+
```shell
|
| 685 |
+
$ export OPENAI_LOG=info
|
| 686 |
+
```
|
| 687 |
+
|
| 688 |
+
Or to `debug` for more verbose logging.
|
| 689 |
+
|
| 690 |
+
### How to tell whether `None` means `null` or missing
|
| 691 |
+
|
| 692 |
+
In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
|
| 693 |
+
|
| 694 |
+
```py
|
| 695 |
+
if response.my_field is None:
|
| 696 |
+
if 'my_field' not in response.model_fields_set:
|
| 697 |
+
print('Got json like {}, without a "my_field" key present at all.')
|
| 698 |
+
else:
|
| 699 |
+
print('Got json like {"my_field": null}.')
|
| 700 |
+
```
|
| 701 |
+
|
| 702 |
+
### Accessing raw response data (e.g. headers)
|
| 703 |
+
|
| 704 |
+
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
|
| 705 |
+
|
| 706 |
+
```py
|
| 707 |
+
from openai import OpenAI
|
| 708 |
+
|
| 709 |
+
client = OpenAI()
|
| 710 |
+
response = client.chat.completions.with_raw_response.create(
|
| 711 |
+
messages=[{
|
| 712 |
+
"role": "user",
|
| 713 |
+
"content": "Say this is a test",
|
| 714 |
+
}],
|
| 715 |
+
model="gpt-4o",
|
| 716 |
+
)
|
| 717 |
+
print(response.headers.get('X-My-Header'))
|
| 718 |
+
|
| 719 |
+
completion = response.parse() # get the object that `chat.completions.create()` would have returned
|
| 720 |
+
print(completion)
|
| 721 |
+
```
|
| 722 |
+
|
| 723 |
+
These methods return a [`LegacyAPIResponse`](https://github.com/openai/openai-python/tree/main/src/openai/_legacy_response.py) object. This is a legacy class as we're changing it slightly in the next major version.
|
| 724 |
+
|
| 725 |
+
For the sync client this will mostly be the same with the exception
|
| 726 |
+
of `content` & `text` will be methods instead of properties. In the
|
| 727 |
+
async client, all methods will be async.
|
| 728 |
+
|
| 729 |
+
A migration script will be provided & the migration in general should
|
| 730 |
+
be smooth.
|
| 731 |
+
|
| 732 |
+
#### `.with_streaming_response`
|
| 733 |
+
|
| 734 |
+
The above interface eagerly reads the full response body when you make the request, which may not always be what you want.
|
| 735 |
+
|
| 736 |
+
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
| 737 |
+
|
| 738 |
+
As such, `.with_streaming_response` methods return a different [`APIResponse`](https://github.com/openai/openai-python/tree/main/src/openai/_response.py) object, and the async client returns an [`AsyncAPIResponse`](https://github.com/openai/openai-python/tree/main/src/openai/_response.py) object.
|
| 739 |
+
|
| 740 |
+
```python
|
| 741 |
+
with client.chat.completions.with_streaming_response.create(
|
| 742 |
+
messages=[
|
| 743 |
+
{
|
| 744 |
+
"role": "user",
|
| 745 |
+
"content": "Say this is a test",
|
| 746 |
+
}
|
| 747 |
+
],
|
| 748 |
+
model="gpt-4o",
|
| 749 |
+
) as response:
|
| 750 |
+
print(response.headers.get("X-My-Header"))
|
| 751 |
+
|
| 752 |
+
for line in response.iter_lines():
|
| 753 |
+
print(line)
|
| 754 |
+
```
|
| 755 |
+
|
| 756 |
+
The context manager is required so that the response will reliably be closed.
|
| 757 |
+
|
| 758 |
+
### Making custom/undocumented requests
|
| 759 |
+
|
| 760 |
+
This library is typed for convenient access to the documented API.
|
| 761 |
+
|
| 762 |
+
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
|
| 763 |
+
|
| 764 |
+
#### Undocumented endpoints
|
| 765 |
+
|
| 766 |
+
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
|
| 767 |
+
http verbs. Options on the client will be respected (such as retries) when making this request.
|
| 768 |
+
|
| 769 |
+
```py
|
| 770 |
+
import httpx
|
| 771 |
+
|
| 772 |
+
response = client.post(
|
| 773 |
+
"/foo",
|
| 774 |
+
cast_to=httpx.Response,
|
| 775 |
+
body={"my_param": True},
|
| 776 |
+
)
|
| 777 |
+
|
| 778 |
+
print(response.headers.get("x-foo"))
|
| 779 |
+
```
|
| 780 |
+
|
| 781 |
+
#### Undocumented request params
|
| 782 |
+
|
| 783 |
+
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
|
| 784 |
+
options.
|
| 785 |
+
|
| 786 |
+
#### Undocumented response properties
|
| 787 |
+
|
| 788 |
+
To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
|
| 789 |
+
can also get all the extra fields on the Pydantic model as a dict with
|
| 790 |
+
[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
|
| 791 |
+
|
| 792 |
+
### Configuring the HTTP client
|
| 793 |
+
|
| 794 |
+
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
|
| 795 |
+
|
| 796 |
+
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
|
| 797 |
+
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
|
| 798 |
+
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
|
| 799 |
+
|
| 800 |
+
```python
|
| 801 |
+
import httpx
|
| 802 |
+
from openai import OpenAI, DefaultHttpxClient
|
| 803 |
+
|
| 804 |
+
client = OpenAI(
|
| 805 |
+
# Or use the `OPENAI_BASE_URL` env var
|
| 806 |
+
base_url="http://my.test.server.example.com:8083/v1",
|
| 807 |
+
http_client=DefaultHttpxClient(
|
| 808 |
+
proxy="http://my.test.proxy.example.com",
|
| 809 |
+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
|
| 810 |
+
),
|
| 811 |
+
)
|
| 812 |
+
```
|
| 813 |
+
|
| 814 |
+
You can also customize the client on a per-request basis by using `with_options()`:
|
| 815 |
+
|
| 816 |
+
```python
|
| 817 |
+
client.with_options(http_client=DefaultHttpxClient(...))
|
| 818 |
+
```
|
| 819 |
+
|
| 820 |
+
### Managing HTTP resources
|
| 821 |
+
|
| 822 |
+
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
|
| 823 |
+
|
| 824 |
+
```py
|
| 825 |
+
from openai import OpenAI
|
| 826 |
+
|
| 827 |
+
with OpenAI() as client:
|
| 828 |
+
# make requests here
|
| 829 |
+
...
|
| 830 |
+
|
| 831 |
+
# HTTP client is now closed
|
| 832 |
+
```
|
| 833 |
+
|
| 834 |
+
## Microsoft Azure OpenAI
|
| 835 |
+
|
| 836 |
+
To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI`
|
| 837 |
+
class instead of the `OpenAI` class.
|
| 838 |
+
|
| 839 |
+
> [!IMPORTANT]
|
| 840 |
+
> The Azure API shape differs from the core API shape which means that the static types for responses / params
|
| 841 |
+
> won't always be correct.
|
| 842 |
+
|
| 843 |
+
```py
|
| 844 |
+
from openai import AzureOpenAI
|
| 845 |
+
|
| 846 |
+
# gets the API Key from environment variable AZURE_OPENAI_API_KEY
|
| 847 |
+
client = AzureOpenAI(
|
| 848 |
+
# https://learn.microsoft.com/azure/ai-services/openai/reference#rest-api-versioning
|
| 849 |
+
api_version="2023-07-01-preview",
|
| 850 |
+
# https://learn.microsoft.com/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
|
| 851 |
+
azure_endpoint="https://example-endpoint.openai.azure.com",
|
| 852 |
+
)
|
| 853 |
+
|
| 854 |
+
completion = client.chat.completions.create(
|
| 855 |
+
model="deployment-name", # e.g. gpt-35-instant
|
| 856 |
+
messages=[
|
| 857 |
+
{
|
| 858 |
+
"role": "user",
|
| 859 |
+
"content": "How do I output all files in a directory using Python?",
|
| 860 |
+
},
|
| 861 |
+
],
|
| 862 |
+
)
|
| 863 |
+
print(completion.to_json())
|
| 864 |
+
```
|
| 865 |
+
|
| 866 |
+
In addition to the options provided in the base `OpenAI` client, the following options are provided:
|
| 867 |
+
|
| 868 |
+
- `azure_endpoint` (or the `AZURE_OPENAI_ENDPOINT` environment variable)
|
| 869 |
+
- `azure_deployment`
|
| 870 |
+
- `api_version` (or the `OPENAI_API_VERSION` environment variable)
|
| 871 |
+
- `azure_ad_token` (or the `AZURE_OPENAI_AD_TOKEN` environment variable)
|
| 872 |
+
- `azure_ad_token_provider`
|
| 873 |
+
|
| 874 |
+
An example of using the client with Microsoft Entra ID (formerly known as Azure Active Directory) can be found [here](https://github.com/openai/openai-python/blob/main/examples/azure_ad.py).
|
| 875 |
+
|
| 876 |
+
## Versioning
|
| 877 |
+
|
| 878 |
+
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
| 879 |
+
|
| 880 |
+
1. Changes that only affect static types, without breaking runtime behavior.
|
| 881 |
+
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
| 882 |
+
3. Changes that we do not expect to impact the vast majority of users in practice.
|
| 883 |
+
|
| 884 |
+
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
| 885 |
+
|
| 886 |
+
We are keen for your feedback; please open an [issue](https://www.github.com/openai/openai-python/issues) with questions, bugs, or suggestions.
|
| 887 |
+
|
| 888 |
+
### Determining the installed version
|
| 889 |
+
|
| 890 |
+
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
|
| 891 |
+
|
| 892 |
+
You can determine the version that is being used at runtime with:
|
| 893 |
+
|
| 894 |
+
```py
|
| 895 |
+
import openai
|
| 896 |
+
print(openai.__version__)
|
| 897 |
+
```
|
| 898 |
+
|
| 899 |
+
## Requirements
|
| 900 |
+
|
| 901 |
+
Python 3.8 or higher.
|
| 902 |
+
|
| 903 |
+
## Contributing
|
| 904 |
+
|
| 905 |
+
See [the contributing documentation](https://github.com/openai/openai-python/tree/main/./CONTRIBUTING.md).
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/RECORD
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.26.3
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
openai = openai.cli:main
|
.venv/lib/python3.13/site-packages/openai-1.109.1.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright 2025 OpenAI
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
.venv/lib/python3.13/site-packages/openai/types/conversations/text_content.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing_extensions import Literal
|
| 4 |
+
|
| 5 |
+
from ..._models import BaseModel
|
| 6 |
+
|
| 7 |
+
__all__ = ["TextContent"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class TextContent(BaseModel):
|
| 11 |
+
text: str
|
| 12 |
+
|
| 13 |
+
type: Literal["text"]
|
.venv/lib/python3.13/site-packages/openai/types/create_embedding_response.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import List
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from .._models import BaseModel
|
| 7 |
+
from .embedding import Embedding
|
| 8 |
+
|
| 9 |
+
__all__ = ["CreateEmbeddingResponse", "Usage"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class Usage(BaseModel):
|
| 13 |
+
prompt_tokens: int
|
| 14 |
+
"""The number of tokens used by the prompt."""
|
| 15 |
+
|
| 16 |
+
total_tokens: int
|
| 17 |
+
"""The total number of tokens used by the request."""
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class CreateEmbeddingResponse(BaseModel):
|
| 21 |
+
data: List[Embedding]
|
| 22 |
+
"""The list of embeddings generated by the model."""
|
| 23 |
+
|
| 24 |
+
model: str
|
| 25 |
+
"""The name of the model used to generate the embedding."""
|
| 26 |
+
|
| 27 |
+
object: Literal["list"]
|
| 28 |
+
"""The object type, which is always "list"."""
|
| 29 |
+
|
| 30 |
+
usage: Usage
|
| 31 |
+
"""The usage information for the request."""
|
.venv/lib/python3.13/site-packages/openai/types/embedding.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import List
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from .._models import BaseModel
|
| 7 |
+
|
| 8 |
+
__all__ = ["Embedding"]
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class Embedding(BaseModel):
|
| 12 |
+
embedding: List[float]
|
| 13 |
+
"""The embedding vector, which is a list of floats.
|
| 14 |
+
|
| 15 |
+
The length of vector depends on the model as listed in the
|
| 16 |
+
[embedding guide](https://platform.openai.com/docs/guides/embeddings).
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
index: int
|
| 20 |
+
"""The index of the embedding in the list of embeddings."""
|
| 21 |
+
|
| 22 |
+
object: Literal["embedding"]
|
| 23 |
+
"""The object type, which is always "embedding"."""
|
.venv/lib/python3.13/site-packages/openai/types/embedding_create_params.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Union, Iterable
|
| 6 |
+
from typing_extensions import Literal, Required, TypedDict
|
| 7 |
+
|
| 8 |
+
from .._types import SequenceNotStr
|
| 9 |
+
from .embedding_model import EmbeddingModel
|
| 10 |
+
|
| 11 |
+
__all__ = ["EmbeddingCreateParams"]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class EmbeddingCreateParams(TypedDict, total=False):
|
| 15 |
+
input: Required[Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]]]
|
| 16 |
+
"""Input text to embed, encoded as a string or array of tokens.
|
| 17 |
+
|
| 18 |
+
To embed multiple inputs in a single request, pass an array of strings or array
|
| 19 |
+
of token arrays. The input must not exceed the max input tokens for the model
|
| 20 |
+
(8192 tokens for all embedding models), cannot be an empty string, and any array
|
| 21 |
+
must be 2048 dimensions or less.
|
| 22 |
+
[Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
|
| 23 |
+
for counting tokens. In addition to the per-input token limit, all embedding
|
| 24 |
+
models enforce a maximum of 300,000 tokens summed across all inputs in a single
|
| 25 |
+
request.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
model: Required[Union[str, EmbeddingModel]]
|
| 29 |
+
"""ID of the model to use.
|
| 30 |
+
|
| 31 |
+
You can use the
|
| 32 |
+
[List models](https://platform.openai.com/docs/api-reference/models/list) API to
|
| 33 |
+
see all of your available models, or see our
|
| 34 |
+
[Model overview](https://platform.openai.com/docs/models) for descriptions of
|
| 35 |
+
them.
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
dimensions: int
|
| 39 |
+
"""The number of dimensions the resulting output embeddings should have.
|
| 40 |
+
|
| 41 |
+
Only supported in `text-embedding-3` and later models.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
encoding_format: Literal["float", "base64"]
|
| 45 |
+
"""The format to return the embeddings in.
|
| 46 |
+
|
| 47 |
+
Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
user: str
|
| 51 |
+
"""
|
| 52 |
+
A unique identifier representing your end-user, which can help OpenAI to monitor
|
| 53 |
+
and detect abuse.
|
| 54 |
+
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
|
| 55 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/embedding_model.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing_extensions import Literal, TypeAlias
|
| 4 |
+
|
| 5 |
+
__all__ = ["EmbeddingModel"]
|
| 6 |
+
|
| 7 |
+
EmbeddingModel: TypeAlias = Literal["text-embedding-ada-002", "text-embedding-3-small", "text-embedding-3-large"]
|
.venv/lib/python3.13/site-packages/openai/types/eval_create_params.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Dict, Union, Iterable, Optional
|
| 6 |
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
| 7 |
+
|
| 8 |
+
from .._types import SequenceNotStr
|
| 9 |
+
from .shared_params.metadata import Metadata
|
| 10 |
+
from .graders.python_grader_param import PythonGraderParam
|
| 11 |
+
from .graders.score_model_grader_param import ScoreModelGraderParam
|
| 12 |
+
from .graders.string_check_grader_param import StringCheckGraderParam
|
| 13 |
+
from .responses.response_input_text_param import ResponseInputTextParam
|
| 14 |
+
from .graders.text_similarity_grader_param import TextSimilarityGraderParam
|
| 15 |
+
from .responses.response_input_audio_param import ResponseInputAudioParam
|
| 16 |
+
|
| 17 |
+
__all__ = [
|
| 18 |
+
"EvalCreateParams",
|
| 19 |
+
"DataSourceConfig",
|
| 20 |
+
"DataSourceConfigCustom",
|
| 21 |
+
"DataSourceConfigLogs",
|
| 22 |
+
"DataSourceConfigStoredCompletions",
|
| 23 |
+
"TestingCriterion",
|
| 24 |
+
"TestingCriterionLabelModel",
|
| 25 |
+
"TestingCriterionLabelModelInput",
|
| 26 |
+
"TestingCriterionLabelModelInputSimpleInputMessage",
|
| 27 |
+
"TestingCriterionLabelModelInputEvalItem",
|
| 28 |
+
"TestingCriterionLabelModelInputEvalItemContent",
|
| 29 |
+
"TestingCriterionLabelModelInputEvalItemContentOutputText",
|
| 30 |
+
"TestingCriterionLabelModelInputEvalItemContentInputImage",
|
| 31 |
+
"TestingCriterionTextSimilarity",
|
| 32 |
+
"TestingCriterionPython",
|
| 33 |
+
"TestingCriterionScoreModel",
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class EvalCreateParams(TypedDict, total=False):
|
| 38 |
+
data_source_config: Required[DataSourceConfig]
|
| 39 |
+
"""The configuration for the data source used for the evaluation runs.
|
| 40 |
+
|
| 41 |
+
Dictates the schema of the data used in the evaluation.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
testing_criteria: Required[Iterable[TestingCriterion]]
|
| 45 |
+
"""A list of graders for all eval runs in this group.
|
| 46 |
+
|
| 47 |
+
Graders can reference variables in the data source using double curly braces
|
| 48 |
+
notation, like `{{item.variable_name}}`. To reference the model's output, use
|
| 49 |
+
the `sample` namespace (ie, `{{sample.output_text}}`).
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
metadata: Optional[Metadata]
|
| 53 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 54 |
+
|
| 55 |
+
This can be useful for storing additional information about the object in a
|
| 56 |
+
structured format, and querying for objects via API or the dashboard.
|
| 57 |
+
|
| 58 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 59 |
+
a maximum length of 512 characters.
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
name: str
|
| 63 |
+
"""The name of the evaluation."""
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class DataSourceConfigCustom(TypedDict, total=False):
|
| 67 |
+
item_schema: Required[Dict[str, object]]
|
| 68 |
+
"""The json schema for each row in the data source."""
|
| 69 |
+
|
| 70 |
+
type: Required[Literal["custom"]]
|
| 71 |
+
"""The type of data source. Always `custom`."""
|
| 72 |
+
|
| 73 |
+
include_sample_schema: bool
|
| 74 |
+
"""
|
| 75 |
+
Whether the eval should expect you to populate the sample namespace (ie, by
|
| 76 |
+
generating responses off of your data source)
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class DataSourceConfigLogs(TypedDict, total=False):
|
| 81 |
+
type: Required[Literal["logs"]]
|
| 82 |
+
"""The type of data source. Always `logs`."""
|
| 83 |
+
|
| 84 |
+
metadata: Dict[str, object]
|
| 85 |
+
"""Metadata filters for the logs data source."""
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
class DataSourceConfigStoredCompletions(TypedDict, total=False):
|
| 89 |
+
type: Required[Literal["stored_completions"]]
|
| 90 |
+
"""The type of data source. Always `stored_completions`."""
|
| 91 |
+
|
| 92 |
+
metadata: Dict[str, object]
|
| 93 |
+
"""Metadata filters for the stored completions data source."""
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
DataSourceConfig: TypeAlias = Union[DataSourceConfigCustom, DataSourceConfigLogs, DataSourceConfigStoredCompletions]
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
class TestingCriterionLabelModelInputSimpleInputMessage(TypedDict, total=False):
|
| 100 |
+
content: Required[str]
|
| 101 |
+
"""The content of the message."""
|
| 102 |
+
|
| 103 |
+
role: Required[str]
|
| 104 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
class TestingCriterionLabelModelInputEvalItemContentOutputText(TypedDict, total=False):
|
| 108 |
+
text: Required[str]
|
| 109 |
+
"""The text output from the model."""
|
| 110 |
+
|
| 111 |
+
type: Required[Literal["output_text"]]
|
| 112 |
+
"""The type of the output text. Always `output_text`."""
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class TestingCriterionLabelModelInputEvalItemContentInputImage(TypedDict, total=False):
|
| 116 |
+
image_url: Required[str]
|
| 117 |
+
"""The URL of the image input."""
|
| 118 |
+
|
| 119 |
+
type: Required[Literal["input_image"]]
|
| 120 |
+
"""The type of the image input. Always `input_image`."""
|
| 121 |
+
|
| 122 |
+
detail: str
|
| 123 |
+
"""The detail level of the image to be sent to the model.
|
| 124 |
+
|
| 125 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 126 |
+
"""
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
TestingCriterionLabelModelInputEvalItemContent: TypeAlias = Union[
|
| 130 |
+
str,
|
| 131 |
+
ResponseInputTextParam,
|
| 132 |
+
TestingCriterionLabelModelInputEvalItemContentOutputText,
|
| 133 |
+
TestingCriterionLabelModelInputEvalItemContentInputImage,
|
| 134 |
+
ResponseInputAudioParam,
|
| 135 |
+
Iterable[object],
|
| 136 |
+
]
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class TestingCriterionLabelModelInputEvalItem(TypedDict, total=False):
|
| 140 |
+
content: Required[TestingCriterionLabelModelInputEvalItemContent]
|
| 141 |
+
"""Inputs to the model - can contain template strings."""
|
| 142 |
+
|
| 143 |
+
role: Required[Literal["user", "assistant", "system", "developer"]]
|
| 144 |
+
"""The role of the message input.
|
| 145 |
+
|
| 146 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 147 |
+
"""
|
| 148 |
+
|
| 149 |
+
type: Literal["message"]
|
| 150 |
+
"""The type of the message input. Always `message`."""
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
TestingCriterionLabelModelInput: TypeAlias = Union[
|
| 154 |
+
TestingCriterionLabelModelInputSimpleInputMessage, TestingCriterionLabelModelInputEvalItem
|
| 155 |
+
]
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
class TestingCriterionLabelModel(TypedDict, total=False):
|
| 159 |
+
input: Required[Iterable[TestingCriterionLabelModelInput]]
|
| 160 |
+
"""A list of chat messages forming the prompt or context.
|
| 161 |
+
|
| 162 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 163 |
+
"""
|
| 164 |
+
|
| 165 |
+
labels: Required[SequenceNotStr[str]]
|
| 166 |
+
"""The labels to classify to each item in the evaluation."""
|
| 167 |
+
|
| 168 |
+
model: Required[str]
|
| 169 |
+
"""The model to use for the evaluation. Must support structured outputs."""
|
| 170 |
+
|
| 171 |
+
name: Required[str]
|
| 172 |
+
"""The name of the grader."""
|
| 173 |
+
|
| 174 |
+
passing_labels: Required[SequenceNotStr[str]]
|
| 175 |
+
"""The labels that indicate a passing result. Must be a subset of labels."""
|
| 176 |
+
|
| 177 |
+
type: Required[Literal["label_model"]]
|
| 178 |
+
"""The object type, which is always `label_model`."""
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
class TestingCriterionTextSimilarity(TextSimilarityGraderParam, total=False):
|
| 182 |
+
pass_threshold: Required[float]
|
| 183 |
+
"""The threshold for the score."""
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
class TestingCriterionPython(PythonGraderParam, total=False):
|
| 187 |
+
pass_threshold: float
|
| 188 |
+
"""The threshold for the score."""
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
class TestingCriterionScoreModel(ScoreModelGraderParam, total=False):
|
| 192 |
+
pass_threshold: float
|
| 193 |
+
"""The threshold for the score."""
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
TestingCriterion: TypeAlias = Union[
|
| 197 |
+
TestingCriterionLabelModel,
|
| 198 |
+
StringCheckGraderParam,
|
| 199 |
+
TestingCriterionTextSimilarity,
|
| 200 |
+
TestingCriterionPython,
|
| 201 |
+
TestingCriterionScoreModel,
|
| 202 |
+
]
|
.venv/lib/python3.13/site-packages/openai/types/eval_create_response.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._utils import PropertyInfo
|
| 9 |
+
from .._models import BaseModel
|
| 10 |
+
from .shared.metadata import Metadata
|
| 11 |
+
from .graders.python_grader import PythonGrader
|
| 12 |
+
from .graders.label_model_grader import LabelModelGrader
|
| 13 |
+
from .graders.score_model_grader import ScoreModelGrader
|
| 14 |
+
from .graders.string_check_grader import StringCheckGrader
|
| 15 |
+
from .eval_custom_data_source_config import EvalCustomDataSourceConfig
|
| 16 |
+
from .graders.text_similarity_grader import TextSimilarityGrader
|
| 17 |
+
from .eval_stored_completions_data_source_config import EvalStoredCompletionsDataSourceConfig
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"EvalCreateResponse",
|
| 21 |
+
"DataSourceConfig",
|
| 22 |
+
"DataSourceConfigLogs",
|
| 23 |
+
"TestingCriterion",
|
| 24 |
+
"TestingCriterionEvalGraderTextSimilarity",
|
| 25 |
+
"TestingCriterionEvalGraderPython",
|
| 26 |
+
"TestingCriterionEvalGraderScoreModel",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class DataSourceConfigLogs(BaseModel):
|
| 31 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 32 |
+
"""
|
| 33 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 34 |
+
[here](https://json-schema.org/).
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
type: Literal["logs"]
|
| 38 |
+
"""The type of data source. Always `logs`."""
|
| 39 |
+
|
| 40 |
+
metadata: Optional[Metadata] = None
|
| 41 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 42 |
+
|
| 43 |
+
This can be useful for storing additional information about the object in a
|
| 44 |
+
structured format, and querying for objects via API or the dashboard.
|
| 45 |
+
|
| 46 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 47 |
+
a maximum length of 512 characters.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
DataSourceConfig: TypeAlias = Annotated[
|
| 52 |
+
Union[EvalCustomDataSourceConfig, DataSourceConfigLogs, EvalStoredCompletionsDataSourceConfig],
|
| 53 |
+
PropertyInfo(discriminator="type"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class TestingCriterionEvalGraderTextSimilarity(TextSimilarityGrader):
|
| 58 |
+
__test__ = False
|
| 59 |
+
pass_threshold: float
|
| 60 |
+
"""The threshold for the score."""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class TestingCriterionEvalGraderPython(PythonGrader):
|
| 64 |
+
__test__ = False
|
| 65 |
+
pass_threshold: Optional[float] = None
|
| 66 |
+
"""The threshold for the score."""
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class TestingCriterionEvalGraderScoreModel(ScoreModelGrader):
|
| 70 |
+
__test__ = False
|
| 71 |
+
pass_threshold: Optional[float] = None
|
| 72 |
+
"""The threshold for the score."""
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
TestingCriterion: TypeAlias = Union[
|
| 76 |
+
LabelModelGrader,
|
| 77 |
+
StringCheckGrader,
|
| 78 |
+
TestingCriterionEvalGraderTextSimilarity,
|
| 79 |
+
TestingCriterionEvalGraderPython,
|
| 80 |
+
TestingCriterionEvalGraderScoreModel,
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class EvalCreateResponse(BaseModel):
|
| 85 |
+
id: str
|
| 86 |
+
"""Unique identifier for the evaluation."""
|
| 87 |
+
|
| 88 |
+
created_at: int
|
| 89 |
+
"""The Unix timestamp (in seconds) for when the eval was created."""
|
| 90 |
+
|
| 91 |
+
data_source_config: DataSourceConfig
|
| 92 |
+
"""Configuration of data sources used in runs of the evaluation."""
|
| 93 |
+
|
| 94 |
+
metadata: Optional[Metadata] = None
|
| 95 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 96 |
+
|
| 97 |
+
This can be useful for storing additional information about the object in a
|
| 98 |
+
structured format, and querying for objects via API or the dashboard.
|
| 99 |
+
|
| 100 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 101 |
+
a maximum length of 512 characters.
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
name: str
|
| 105 |
+
"""The name of the evaluation."""
|
| 106 |
+
|
| 107 |
+
object: Literal["eval"]
|
| 108 |
+
"""The object type."""
|
| 109 |
+
|
| 110 |
+
testing_criteria: List[TestingCriterion]
|
| 111 |
+
"""A list of testing criteria."""
|
.venv/lib/python3.13/site-packages/openai/types/eval_custom_data_source_config.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._models import BaseModel
|
| 9 |
+
|
| 10 |
+
__all__ = ["EvalCustomDataSourceConfig"]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class EvalCustomDataSourceConfig(BaseModel):
|
| 14 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 15 |
+
"""
|
| 16 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 17 |
+
[here](https://json-schema.org/).
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
type: Literal["custom"]
|
| 21 |
+
"""The type of data source. Always `custom`."""
|
.venv/lib/python3.13/site-packages/openai/types/eval_delete_response.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from .._models import BaseModel
|
| 4 |
+
|
| 5 |
+
__all__ = ["EvalDeleteResponse"]
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class EvalDeleteResponse(BaseModel):
|
| 9 |
+
deleted: bool
|
| 10 |
+
|
| 11 |
+
eval_id: str
|
| 12 |
+
|
| 13 |
+
object: str
|
.venv/lib/python3.13/site-packages/openai/types/eval_list_params.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing_extensions import Literal, TypedDict
|
| 6 |
+
|
| 7 |
+
__all__ = ["EvalListParams"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class EvalListParams(TypedDict, total=False):
|
| 11 |
+
after: str
|
| 12 |
+
"""Identifier for the last eval from the previous pagination request."""
|
| 13 |
+
|
| 14 |
+
limit: int
|
| 15 |
+
"""Number of evals to retrieve."""
|
| 16 |
+
|
| 17 |
+
order: Literal["asc", "desc"]
|
| 18 |
+
"""Sort order for evals by timestamp.
|
| 19 |
+
|
| 20 |
+
Use `asc` for ascending order or `desc` for descending order.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
order_by: Literal["created_at", "updated_at"]
|
| 24 |
+
"""Evals can be ordered by creation time or last updated time.
|
| 25 |
+
|
| 26 |
+
Use `created_at` for creation time or `updated_at` for last updated time.
|
| 27 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/eval_list_response.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._utils import PropertyInfo
|
| 9 |
+
from .._models import BaseModel
|
| 10 |
+
from .shared.metadata import Metadata
|
| 11 |
+
from .graders.python_grader import PythonGrader
|
| 12 |
+
from .graders.label_model_grader import LabelModelGrader
|
| 13 |
+
from .graders.score_model_grader import ScoreModelGrader
|
| 14 |
+
from .graders.string_check_grader import StringCheckGrader
|
| 15 |
+
from .eval_custom_data_source_config import EvalCustomDataSourceConfig
|
| 16 |
+
from .graders.text_similarity_grader import TextSimilarityGrader
|
| 17 |
+
from .eval_stored_completions_data_source_config import EvalStoredCompletionsDataSourceConfig
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"EvalListResponse",
|
| 21 |
+
"DataSourceConfig",
|
| 22 |
+
"DataSourceConfigLogs",
|
| 23 |
+
"TestingCriterion",
|
| 24 |
+
"TestingCriterionEvalGraderTextSimilarity",
|
| 25 |
+
"TestingCriterionEvalGraderPython",
|
| 26 |
+
"TestingCriterionEvalGraderScoreModel",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class DataSourceConfigLogs(BaseModel):
|
| 31 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 32 |
+
"""
|
| 33 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 34 |
+
[here](https://json-schema.org/).
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
type: Literal["logs"]
|
| 38 |
+
"""The type of data source. Always `logs`."""
|
| 39 |
+
|
| 40 |
+
metadata: Optional[Metadata] = None
|
| 41 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 42 |
+
|
| 43 |
+
This can be useful for storing additional information about the object in a
|
| 44 |
+
structured format, and querying for objects via API or the dashboard.
|
| 45 |
+
|
| 46 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 47 |
+
a maximum length of 512 characters.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
DataSourceConfig: TypeAlias = Annotated[
|
| 52 |
+
Union[EvalCustomDataSourceConfig, DataSourceConfigLogs, EvalStoredCompletionsDataSourceConfig],
|
| 53 |
+
PropertyInfo(discriminator="type"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class TestingCriterionEvalGraderTextSimilarity(TextSimilarityGrader):
|
| 58 |
+
__test__ = False
|
| 59 |
+
pass_threshold: float
|
| 60 |
+
"""The threshold for the score."""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class TestingCriterionEvalGraderPython(PythonGrader):
|
| 64 |
+
__test__ = False
|
| 65 |
+
pass_threshold: Optional[float] = None
|
| 66 |
+
"""The threshold for the score."""
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class TestingCriterionEvalGraderScoreModel(ScoreModelGrader):
|
| 70 |
+
__test__ = False
|
| 71 |
+
pass_threshold: Optional[float] = None
|
| 72 |
+
"""The threshold for the score."""
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
TestingCriterion: TypeAlias = Union[
|
| 76 |
+
LabelModelGrader,
|
| 77 |
+
StringCheckGrader,
|
| 78 |
+
TestingCriterionEvalGraderTextSimilarity,
|
| 79 |
+
TestingCriterionEvalGraderPython,
|
| 80 |
+
TestingCriterionEvalGraderScoreModel,
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class EvalListResponse(BaseModel):
|
| 85 |
+
id: str
|
| 86 |
+
"""Unique identifier for the evaluation."""
|
| 87 |
+
|
| 88 |
+
created_at: int
|
| 89 |
+
"""The Unix timestamp (in seconds) for when the eval was created."""
|
| 90 |
+
|
| 91 |
+
data_source_config: DataSourceConfig
|
| 92 |
+
"""Configuration of data sources used in runs of the evaluation."""
|
| 93 |
+
|
| 94 |
+
metadata: Optional[Metadata] = None
|
| 95 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 96 |
+
|
| 97 |
+
This can be useful for storing additional information about the object in a
|
| 98 |
+
structured format, and querying for objects via API or the dashboard.
|
| 99 |
+
|
| 100 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 101 |
+
a maximum length of 512 characters.
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
name: str
|
| 105 |
+
"""The name of the evaluation."""
|
| 106 |
+
|
| 107 |
+
object: Literal["eval"]
|
| 108 |
+
"""The object type."""
|
| 109 |
+
|
| 110 |
+
testing_criteria: List[TestingCriterion]
|
| 111 |
+
"""A list of testing criteria."""
|
.venv/lib/python3.13/site-packages/openai/types/eval_retrieve_response.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._utils import PropertyInfo
|
| 9 |
+
from .._models import BaseModel
|
| 10 |
+
from .shared.metadata import Metadata
|
| 11 |
+
from .graders.python_grader import PythonGrader
|
| 12 |
+
from .graders.label_model_grader import LabelModelGrader
|
| 13 |
+
from .graders.score_model_grader import ScoreModelGrader
|
| 14 |
+
from .graders.string_check_grader import StringCheckGrader
|
| 15 |
+
from .eval_custom_data_source_config import EvalCustomDataSourceConfig
|
| 16 |
+
from .graders.text_similarity_grader import TextSimilarityGrader
|
| 17 |
+
from .eval_stored_completions_data_source_config import EvalStoredCompletionsDataSourceConfig
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"EvalRetrieveResponse",
|
| 21 |
+
"DataSourceConfig",
|
| 22 |
+
"DataSourceConfigLogs",
|
| 23 |
+
"TestingCriterion",
|
| 24 |
+
"TestingCriterionEvalGraderTextSimilarity",
|
| 25 |
+
"TestingCriterionEvalGraderPython",
|
| 26 |
+
"TestingCriterionEvalGraderScoreModel",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class DataSourceConfigLogs(BaseModel):
|
| 31 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 32 |
+
"""
|
| 33 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 34 |
+
[here](https://json-schema.org/).
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
type: Literal["logs"]
|
| 38 |
+
"""The type of data source. Always `logs`."""
|
| 39 |
+
|
| 40 |
+
metadata: Optional[Metadata] = None
|
| 41 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 42 |
+
|
| 43 |
+
This can be useful for storing additional information about the object in a
|
| 44 |
+
structured format, and querying for objects via API or the dashboard.
|
| 45 |
+
|
| 46 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 47 |
+
a maximum length of 512 characters.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
DataSourceConfig: TypeAlias = Annotated[
|
| 52 |
+
Union[EvalCustomDataSourceConfig, DataSourceConfigLogs, EvalStoredCompletionsDataSourceConfig],
|
| 53 |
+
PropertyInfo(discriminator="type"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class TestingCriterionEvalGraderTextSimilarity(TextSimilarityGrader):
|
| 58 |
+
__test__ = False
|
| 59 |
+
pass_threshold: float
|
| 60 |
+
"""The threshold for the score."""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class TestingCriterionEvalGraderPython(PythonGrader):
|
| 64 |
+
__test__ = False
|
| 65 |
+
pass_threshold: Optional[float] = None
|
| 66 |
+
"""The threshold for the score."""
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class TestingCriterionEvalGraderScoreModel(ScoreModelGrader):
|
| 70 |
+
__test__ = False
|
| 71 |
+
pass_threshold: Optional[float] = None
|
| 72 |
+
"""The threshold for the score."""
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
TestingCriterion: TypeAlias = Union[
|
| 76 |
+
LabelModelGrader,
|
| 77 |
+
StringCheckGrader,
|
| 78 |
+
TestingCriterionEvalGraderTextSimilarity,
|
| 79 |
+
TestingCriterionEvalGraderPython,
|
| 80 |
+
TestingCriterionEvalGraderScoreModel,
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class EvalRetrieveResponse(BaseModel):
|
| 85 |
+
id: str
|
| 86 |
+
"""Unique identifier for the evaluation."""
|
| 87 |
+
|
| 88 |
+
created_at: int
|
| 89 |
+
"""The Unix timestamp (in seconds) for when the eval was created."""
|
| 90 |
+
|
| 91 |
+
data_source_config: DataSourceConfig
|
| 92 |
+
"""Configuration of data sources used in runs of the evaluation."""
|
| 93 |
+
|
| 94 |
+
metadata: Optional[Metadata] = None
|
| 95 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 96 |
+
|
| 97 |
+
This can be useful for storing additional information about the object in a
|
| 98 |
+
structured format, and querying for objects via API or the dashboard.
|
| 99 |
+
|
| 100 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 101 |
+
a maximum length of 512 characters.
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
name: str
|
| 105 |
+
"""The name of the evaluation."""
|
| 106 |
+
|
| 107 |
+
object: Literal["eval"]
|
| 108 |
+
"""The object type."""
|
| 109 |
+
|
| 110 |
+
testing_criteria: List[TestingCriterion]
|
| 111 |
+
"""A list of testing criteria."""
|
.venv/lib/python3.13/site-packages/openai/types/eval_stored_completions_data_source_config.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, Optional
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._models import BaseModel
|
| 9 |
+
from .shared.metadata import Metadata
|
| 10 |
+
|
| 11 |
+
__all__ = ["EvalStoredCompletionsDataSourceConfig"]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class EvalStoredCompletionsDataSourceConfig(BaseModel):
|
| 15 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 16 |
+
"""
|
| 17 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 18 |
+
[here](https://json-schema.org/).
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
type: Literal["stored_completions"]
|
| 22 |
+
"""The type of data source. Always `stored_completions`."""
|
| 23 |
+
|
| 24 |
+
metadata: Optional[Metadata] = None
|
| 25 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 26 |
+
|
| 27 |
+
This can be useful for storing additional information about the object in a
|
| 28 |
+
structured format, and querying for objects via API or the dashboard.
|
| 29 |
+
|
| 30 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 31 |
+
a maximum length of 512 characters.
|
| 32 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/eval_update_params.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Optional
|
| 6 |
+
from typing_extensions import TypedDict
|
| 7 |
+
|
| 8 |
+
from .shared_params.metadata import Metadata
|
| 9 |
+
|
| 10 |
+
__all__ = ["EvalUpdateParams"]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class EvalUpdateParams(TypedDict, total=False):
|
| 14 |
+
metadata: Optional[Metadata]
|
| 15 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 16 |
+
|
| 17 |
+
This can be useful for storing additional information about the object in a
|
| 18 |
+
structured format, and querying for objects via API or the dashboard.
|
| 19 |
+
|
| 20 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 21 |
+
a maximum length of 512 characters.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
name: str
|
| 25 |
+
"""Rename the evaluation."""
|
.venv/lib/python3.13/site-packages/openai/types/eval_update_response.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from .._utils import PropertyInfo
|
| 9 |
+
from .._models import BaseModel
|
| 10 |
+
from .shared.metadata import Metadata
|
| 11 |
+
from .graders.python_grader import PythonGrader
|
| 12 |
+
from .graders.label_model_grader import LabelModelGrader
|
| 13 |
+
from .graders.score_model_grader import ScoreModelGrader
|
| 14 |
+
from .graders.string_check_grader import StringCheckGrader
|
| 15 |
+
from .eval_custom_data_source_config import EvalCustomDataSourceConfig
|
| 16 |
+
from .graders.text_similarity_grader import TextSimilarityGrader
|
| 17 |
+
from .eval_stored_completions_data_source_config import EvalStoredCompletionsDataSourceConfig
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"EvalUpdateResponse",
|
| 21 |
+
"DataSourceConfig",
|
| 22 |
+
"DataSourceConfigLogs",
|
| 23 |
+
"TestingCriterion",
|
| 24 |
+
"TestingCriterionEvalGraderTextSimilarity",
|
| 25 |
+
"TestingCriterionEvalGraderPython",
|
| 26 |
+
"TestingCriterionEvalGraderScoreModel",
|
| 27 |
+
]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class DataSourceConfigLogs(BaseModel):
|
| 31 |
+
schema_: Dict[str, object] = FieldInfo(alias="schema")
|
| 32 |
+
"""
|
| 33 |
+
The json schema for the run data source items. Learn how to build JSON schemas
|
| 34 |
+
[here](https://json-schema.org/).
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
type: Literal["logs"]
|
| 38 |
+
"""The type of data source. Always `logs`."""
|
| 39 |
+
|
| 40 |
+
metadata: Optional[Metadata] = None
|
| 41 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 42 |
+
|
| 43 |
+
This can be useful for storing additional information about the object in a
|
| 44 |
+
structured format, and querying for objects via API or the dashboard.
|
| 45 |
+
|
| 46 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 47 |
+
a maximum length of 512 characters.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
DataSourceConfig: TypeAlias = Annotated[
|
| 52 |
+
Union[EvalCustomDataSourceConfig, DataSourceConfigLogs, EvalStoredCompletionsDataSourceConfig],
|
| 53 |
+
PropertyInfo(discriminator="type"),
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class TestingCriterionEvalGraderTextSimilarity(TextSimilarityGrader):
|
| 58 |
+
__test__ = False
|
| 59 |
+
pass_threshold: float
|
| 60 |
+
"""The threshold for the score."""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class TestingCriterionEvalGraderPython(PythonGrader):
|
| 64 |
+
__test__ = False
|
| 65 |
+
pass_threshold: Optional[float] = None
|
| 66 |
+
"""The threshold for the score."""
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class TestingCriterionEvalGraderScoreModel(ScoreModelGrader):
|
| 70 |
+
__test__ = False
|
| 71 |
+
pass_threshold: Optional[float] = None
|
| 72 |
+
"""The threshold for the score."""
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
TestingCriterion: TypeAlias = Union[
|
| 76 |
+
LabelModelGrader,
|
| 77 |
+
StringCheckGrader,
|
| 78 |
+
TestingCriterionEvalGraderTextSimilarity,
|
| 79 |
+
TestingCriterionEvalGraderPython,
|
| 80 |
+
TestingCriterionEvalGraderScoreModel,
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class EvalUpdateResponse(BaseModel):
|
| 85 |
+
id: str
|
| 86 |
+
"""Unique identifier for the evaluation."""
|
| 87 |
+
|
| 88 |
+
created_at: int
|
| 89 |
+
"""The Unix timestamp (in seconds) for when the eval was created."""
|
| 90 |
+
|
| 91 |
+
data_source_config: DataSourceConfig
|
| 92 |
+
"""Configuration of data sources used in runs of the evaluation."""
|
| 93 |
+
|
| 94 |
+
metadata: Optional[Metadata] = None
|
| 95 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 96 |
+
|
| 97 |
+
This can be useful for storing additional information about the object in a
|
| 98 |
+
structured format, and querying for objects via API or the dashboard.
|
| 99 |
+
|
| 100 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 101 |
+
a maximum length of 512 characters.
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
name: str
|
| 105 |
+
"""The name of the evaluation."""
|
| 106 |
+
|
| 107 |
+
object: Literal["eval"]
|
| 108 |
+
"""The object type."""
|
| 109 |
+
|
| 110 |
+
testing_criteria: List[TestingCriterion]
|
| 111 |
+
"""A list of testing criteria."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/__init__.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .eval_api_error import EvalAPIError as EvalAPIError
|
| 6 |
+
from .run_list_params import RunListParams as RunListParams
|
| 7 |
+
from .run_create_params import RunCreateParams as RunCreateParams
|
| 8 |
+
from .run_list_response import RunListResponse as RunListResponse
|
| 9 |
+
from .run_cancel_response import RunCancelResponse as RunCancelResponse
|
| 10 |
+
from .run_create_response import RunCreateResponse as RunCreateResponse
|
| 11 |
+
from .run_delete_response import RunDeleteResponse as RunDeleteResponse
|
| 12 |
+
from .run_retrieve_response import RunRetrieveResponse as RunRetrieveResponse
|
| 13 |
+
from .create_eval_jsonl_run_data_source import CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource
|
| 14 |
+
from .create_eval_completions_run_data_source import (
|
| 15 |
+
CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource,
|
| 16 |
+
)
|
| 17 |
+
from .create_eval_jsonl_run_data_source_param import (
|
| 18 |
+
CreateEvalJSONLRunDataSourceParam as CreateEvalJSONLRunDataSourceParam,
|
| 19 |
+
)
|
| 20 |
+
from .create_eval_completions_run_data_source_param import (
|
| 21 |
+
CreateEvalCompletionsRunDataSourceParam as CreateEvalCompletionsRunDataSourceParam,
|
| 22 |
+
)
|
.venv/lib/python3.13/site-packages/openai/types/evals/create_eval_completions_run_data_source.py
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from ..._utils import PropertyInfo
|
| 7 |
+
from ..._models import BaseModel
|
| 8 |
+
from ..shared.metadata import Metadata
|
| 9 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 10 |
+
from ..shared.response_format_text import ResponseFormatText
|
| 11 |
+
from ..responses.easy_input_message import EasyInputMessage
|
| 12 |
+
from ..responses.response_input_text import ResponseInputText
|
| 13 |
+
from ..responses.response_input_audio import ResponseInputAudio
|
| 14 |
+
from ..chat.chat_completion_function_tool import ChatCompletionFunctionTool
|
| 15 |
+
from ..shared.response_format_json_object import ResponseFormatJSONObject
|
| 16 |
+
from ..shared.response_format_json_schema import ResponseFormatJSONSchema
|
| 17 |
+
|
| 18 |
+
__all__ = [
|
| 19 |
+
"CreateEvalCompletionsRunDataSource",
|
| 20 |
+
"Source",
|
| 21 |
+
"SourceFileContent",
|
| 22 |
+
"SourceFileContentContent",
|
| 23 |
+
"SourceFileID",
|
| 24 |
+
"SourceStoredCompletions",
|
| 25 |
+
"InputMessages",
|
| 26 |
+
"InputMessagesTemplate",
|
| 27 |
+
"InputMessagesTemplateTemplate",
|
| 28 |
+
"InputMessagesTemplateTemplateEvalItem",
|
| 29 |
+
"InputMessagesTemplateTemplateEvalItemContent",
|
| 30 |
+
"InputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 31 |
+
"InputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 32 |
+
"InputMessagesItemReference",
|
| 33 |
+
"SamplingParams",
|
| 34 |
+
"SamplingParamsResponseFormat",
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class SourceFileContentContent(BaseModel):
|
| 39 |
+
item: Dict[str, object]
|
| 40 |
+
|
| 41 |
+
sample: Optional[Dict[str, object]] = None
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class SourceFileContent(BaseModel):
|
| 45 |
+
content: List[SourceFileContentContent]
|
| 46 |
+
"""The content of the jsonl file."""
|
| 47 |
+
|
| 48 |
+
type: Literal["file_content"]
|
| 49 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class SourceFileID(BaseModel):
|
| 53 |
+
id: str
|
| 54 |
+
"""The identifier of the file."""
|
| 55 |
+
|
| 56 |
+
type: Literal["file_id"]
|
| 57 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class SourceStoredCompletions(BaseModel):
|
| 61 |
+
type: Literal["stored_completions"]
|
| 62 |
+
"""The type of source. Always `stored_completions`."""
|
| 63 |
+
|
| 64 |
+
created_after: Optional[int] = None
|
| 65 |
+
"""An optional Unix timestamp to filter items created after this time."""
|
| 66 |
+
|
| 67 |
+
created_before: Optional[int] = None
|
| 68 |
+
"""An optional Unix timestamp to filter items created before this time."""
|
| 69 |
+
|
| 70 |
+
limit: Optional[int] = None
|
| 71 |
+
"""An optional maximum number of items to return."""
|
| 72 |
+
|
| 73 |
+
metadata: Optional[Metadata] = None
|
| 74 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 75 |
+
|
| 76 |
+
This can be useful for storing additional information about the object in a
|
| 77 |
+
structured format, and querying for objects via API or the dashboard.
|
| 78 |
+
|
| 79 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 80 |
+
a maximum length of 512 characters.
|
| 81 |
+
"""
|
| 82 |
+
|
| 83 |
+
model: Optional[str] = None
|
| 84 |
+
"""An optional model to filter by (e.g., 'gpt-4o')."""
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
Source: TypeAlias = Annotated[
|
| 88 |
+
Union[SourceFileContent, SourceFileID, SourceStoredCompletions], PropertyInfo(discriminator="type")
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class InputMessagesTemplateTemplateEvalItemContentOutputText(BaseModel):
|
| 93 |
+
text: str
|
| 94 |
+
"""The text output from the model."""
|
| 95 |
+
|
| 96 |
+
type: Literal["output_text"]
|
| 97 |
+
"""The type of the output text. Always `output_text`."""
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
class InputMessagesTemplateTemplateEvalItemContentInputImage(BaseModel):
|
| 101 |
+
image_url: str
|
| 102 |
+
"""The URL of the image input."""
|
| 103 |
+
|
| 104 |
+
type: Literal["input_image"]
|
| 105 |
+
"""The type of the image input. Always `input_image`."""
|
| 106 |
+
|
| 107 |
+
detail: Optional[str] = None
|
| 108 |
+
"""The detail level of the image to be sent to the model.
|
| 109 |
+
|
| 110 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 111 |
+
"""
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
InputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 115 |
+
str,
|
| 116 |
+
ResponseInputText,
|
| 117 |
+
InputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 118 |
+
InputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 119 |
+
ResponseInputAudio,
|
| 120 |
+
List[object],
|
| 121 |
+
]
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
class InputMessagesTemplateTemplateEvalItem(BaseModel):
|
| 125 |
+
content: InputMessagesTemplateTemplateEvalItemContent
|
| 126 |
+
"""Inputs to the model - can contain template strings."""
|
| 127 |
+
|
| 128 |
+
role: Literal["user", "assistant", "system", "developer"]
|
| 129 |
+
"""The role of the message input.
|
| 130 |
+
|
| 131 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 132 |
+
"""
|
| 133 |
+
|
| 134 |
+
type: Optional[Literal["message"]] = None
|
| 135 |
+
"""The type of the message input. Always `message`."""
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
InputMessagesTemplateTemplate: TypeAlias = Union[EasyInputMessage, InputMessagesTemplateTemplateEvalItem]
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
class InputMessagesTemplate(BaseModel):
|
| 142 |
+
template: List[InputMessagesTemplateTemplate]
|
| 143 |
+
"""A list of chat messages forming the prompt or context.
|
| 144 |
+
|
| 145 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
type: Literal["template"]
|
| 149 |
+
"""The type of input messages. Always `template`."""
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class InputMessagesItemReference(BaseModel):
|
| 153 |
+
item_reference: str
|
| 154 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" """
|
| 155 |
+
|
| 156 |
+
type: Literal["item_reference"]
|
| 157 |
+
"""The type of input messages. Always `item_reference`."""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
InputMessages: TypeAlias = Annotated[
|
| 161 |
+
Union[InputMessagesTemplate, InputMessagesItemReference], PropertyInfo(discriminator="type")
|
| 162 |
+
]
|
| 163 |
+
|
| 164 |
+
SamplingParamsResponseFormat: TypeAlias = Union[ResponseFormatText, ResponseFormatJSONSchema, ResponseFormatJSONObject]
|
| 165 |
+
|
| 166 |
+
|
| 167 |
+
class SamplingParams(BaseModel):
|
| 168 |
+
max_completion_tokens: Optional[int] = None
|
| 169 |
+
"""The maximum number of tokens in the generated output."""
|
| 170 |
+
|
| 171 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 172 |
+
"""
|
| 173 |
+
Constrains effort on reasoning for
|
| 174 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 175 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 176 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 177 |
+
response.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
response_format: Optional[SamplingParamsResponseFormat] = None
|
| 181 |
+
"""An object specifying the format that the model must output.
|
| 182 |
+
|
| 183 |
+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
| 184 |
+
Outputs which ensures the model will match your supplied JSON schema. Learn more
|
| 185 |
+
in the
|
| 186 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 187 |
+
|
| 188 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 189 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 190 |
+
preferred for models that support it.
|
| 191 |
+
"""
|
| 192 |
+
|
| 193 |
+
seed: Optional[int] = None
|
| 194 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 195 |
+
|
| 196 |
+
temperature: Optional[float] = None
|
| 197 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 198 |
+
|
| 199 |
+
tools: Optional[List[ChatCompletionFunctionTool]] = None
|
| 200 |
+
"""A list of tools the model may call.
|
| 201 |
+
|
| 202 |
+
Currently, only functions are supported as a tool. Use this to provide a list of
|
| 203 |
+
functions the model may generate JSON inputs for. A max of 128 functions are
|
| 204 |
+
supported.
|
| 205 |
+
"""
|
| 206 |
+
|
| 207 |
+
top_p: Optional[float] = None
|
| 208 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
class CreateEvalCompletionsRunDataSource(BaseModel):
|
| 212 |
+
source: Source
|
| 213 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 214 |
+
|
| 215 |
+
type: Literal["completions"]
|
| 216 |
+
"""The type of run data source. Always `completions`."""
|
| 217 |
+
|
| 218 |
+
input_messages: Optional[InputMessages] = None
|
| 219 |
+
"""Used when sampling from a model.
|
| 220 |
+
|
| 221 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 222 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 223 |
+
with variable references to the `item` namespace.
|
| 224 |
+
"""
|
| 225 |
+
|
| 226 |
+
model: Optional[str] = None
|
| 227 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 228 |
+
|
| 229 |
+
sampling_params: Optional[SamplingParams] = None
|
.venv/lib/python3.13/site-packages/openai/types/evals/create_eval_completions_run_data_source_param.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Dict, Union, Iterable, Optional
|
| 6 |
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
| 7 |
+
|
| 8 |
+
from ..shared_params.metadata import Metadata
|
| 9 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 10 |
+
from ..responses.easy_input_message_param import EasyInputMessageParam
|
| 11 |
+
from ..shared_params.response_format_text import ResponseFormatText
|
| 12 |
+
from ..responses.response_input_text_param import ResponseInputTextParam
|
| 13 |
+
from ..responses.response_input_audio_param import ResponseInputAudioParam
|
| 14 |
+
from ..chat.chat_completion_function_tool_param import ChatCompletionFunctionToolParam
|
| 15 |
+
from ..shared_params.response_format_json_object import ResponseFormatJSONObject
|
| 16 |
+
from ..shared_params.response_format_json_schema import ResponseFormatJSONSchema
|
| 17 |
+
|
| 18 |
+
__all__ = [
|
| 19 |
+
"CreateEvalCompletionsRunDataSourceParam",
|
| 20 |
+
"Source",
|
| 21 |
+
"SourceFileContent",
|
| 22 |
+
"SourceFileContentContent",
|
| 23 |
+
"SourceFileID",
|
| 24 |
+
"SourceStoredCompletions",
|
| 25 |
+
"InputMessages",
|
| 26 |
+
"InputMessagesTemplate",
|
| 27 |
+
"InputMessagesTemplateTemplate",
|
| 28 |
+
"InputMessagesTemplateTemplateEvalItem",
|
| 29 |
+
"InputMessagesTemplateTemplateEvalItemContent",
|
| 30 |
+
"InputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 31 |
+
"InputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 32 |
+
"InputMessagesItemReference",
|
| 33 |
+
"SamplingParams",
|
| 34 |
+
"SamplingParamsResponseFormat",
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
class SourceFileContentContent(TypedDict, total=False):
|
| 39 |
+
item: Required[Dict[str, object]]
|
| 40 |
+
|
| 41 |
+
sample: Dict[str, object]
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class SourceFileContent(TypedDict, total=False):
|
| 45 |
+
content: Required[Iterable[SourceFileContentContent]]
|
| 46 |
+
"""The content of the jsonl file."""
|
| 47 |
+
|
| 48 |
+
type: Required[Literal["file_content"]]
|
| 49 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class SourceFileID(TypedDict, total=False):
|
| 53 |
+
id: Required[str]
|
| 54 |
+
"""The identifier of the file."""
|
| 55 |
+
|
| 56 |
+
type: Required[Literal["file_id"]]
|
| 57 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class SourceStoredCompletions(TypedDict, total=False):
|
| 61 |
+
type: Required[Literal["stored_completions"]]
|
| 62 |
+
"""The type of source. Always `stored_completions`."""
|
| 63 |
+
|
| 64 |
+
created_after: Optional[int]
|
| 65 |
+
"""An optional Unix timestamp to filter items created after this time."""
|
| 66 |
+
|
| 67 |
+
created_before: Optional[int]
|
| 68 |
+
"""An optional Unix timestamp to filter items created before this time."""
|
| 69 |
+
|
| 70 |
+
limit: Optional[int]
|
| 71 |
+
"""An optional maximum number of items to return."""
|
| 72 |
+
|
| 73 |
+
metadata: Optional[Metadata]
|
| 74 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 75 |
+
|
| 76 |
+
This can be useful for storing additional information about the object in a
|
| 77 |
+
structured format, and querying for objects via API or the dashboard.
|
| 78 |
+
|
| 79 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 80 |
+
a maximum length of 512 characters.
|
| 81 |
+
"""
|
| 82 |
+
|
| 83 |
+
model: Optional[str]
|
| 84 |
+
"""An optional model to filter by (e.g., 'gpt-4o')."""
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
Source: TypeAlias = Union[SourceFileContent, SourceFileID, SourceStoredCompletions]
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class InputMessagesTemplateTemplateEvalItemContentOutputText(TypedDict, total=False):
|
| 91 |
+
text: Required[str]
|
| 92 |
+
"""The text output from the model."""
|
| 93 |
+
|
| 94 |
+
type: Required[Literal["output_text"]]
|
| 95 |
+
"""The type of the output text. Always `output_text`."""
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
class InputMessagesTemplateTemplateEvalItemContentInputImage(TypedDict, total=False):
|
| 99 |
+
image_url: Required[str]
|
| 100 |
+
"""The URL of the image input."""
|
| 101 |
+
|
| 102 |
+
type: Required[Literal["input_image"]]
|
| 103 |
+
"""The type of the image input. Always `input_image`."""
|
| 104 |
+
|
| 105 |
+
detail: str
|
| 106 |
+
"""The detail level of the image to be sent to the model.
|
| 107 |
+
|
| 108 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
InputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 113 |
+
str,
|
| 114 |
+
ResponseInputTextParam,
|
| 115 |
+
InputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 116 |
+
InputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 117 |
+
ResponseInputAudioParam,
|
| 118 |
+
Iterable[object],
|
| 119 |
+
]
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
class InputMessagesTemplateTemplateEvalItem(TypedDict, total=False):
|
| 123 |
+
content: Required[InputMessagesTemplateTemplateEvalItemContent]
|
| 124 |
+
"""Inputs to the model - can contain template strings."""
|
| 125 |
+
|
| 126 |
+
role: Required[Literal["user", "assistant", "system", "developer"]]
|
| 127 |
+
"""The role of the message input.
|
| 128 |
+
|
| 129 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 130 |
+
"""
|
| 131 |
+
|
| 132 |
+
type: Literal["message"]
|
| 133 |
+
"""The type of the message input. Always `message`."""
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
InputMessagesTemplateTemplate: TypeAlias = Union[EasyInputMessageParam, InputMessagesTemplateTemplateEvalItem]
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class InputMessagesTemplate(TypedDict, total=False):
|
| 140 |
+
template: Required[Iterable[InputMessagesTemplateTemplate]]
|
| 141 |
+
"""A list of chat messages forming the prompt or context.
|
| 142 |
+
|
| 143 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 144 |
+
"""
|
| 145 |
+
|
| 146 |
+
type: Required[Literal["template"]]
|
| 147 |
+
"""The type of input messages. Always `template`."""
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
class InputMessagesItemReference(TypedDict, total=False):
|
| 151 |
+
item_reference: Required[str]
|
| 152 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" """
|
| 153 |
+
|
| 154 |
+
type: Required[Literal["item_reference"]]
|
| 155 |
+
"""The type of input messages. Always `item_reference`."""
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
InputMessages: TypeAlias = Union[InputMessagesTemplate, InputMessagesItemReference]
|
| 159 |
+
|
| 160 |
+
SamplingParamsResponseFormat: TypeAlias = Union[ResponseFormatText, ResponseFormatJSONSchema, ResponseFormatJSONObject]
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
class SamplingParams(TypedDict, total=False):
|
| 164 |
+
max_completion_tokens: int
|
| 165 |
+
"""The maximum number of tokens in the generated output."""
|
| 166 |
+
|
| 167 |
+
reasoning_effort: Optional[ReasoningEffort]
|
| 168 |
+
"""
|
| 169 |
+
Constrains effort on reasoning for
|
| 170 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 171 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 172 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 173 |
+
response.
|
| 174 |
+
"""
|
| 175 |
+
|
| 176 |
+
response_format: SamplingParamsResponseFormat
|
| 177 |
+
"""An object specifying the format that the model must output.
|
| 178 |
+
|
| 179 |
+
Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
| 180 |
+
Outputs which ensures the model will match your supplied JSON schema. Learn more
|
| 181 |
+
in the
|
| 182 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 183 |
+
|
| 184 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 185 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 186 |
+
preferred for models that support it.
|
| 187 |
+
"""
|
| 188 |
+
|
| 189 |
+
seed: int
|
| 190 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 191 |
+
|
| 192 |
+
temperature: float
|
| 193 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 194 |
+
|
| 195 |
+
tools: Iterable[ChatCompletionFunctionToolParam]
|
| 196 |
+
"""A list of tools the model may call.
|
| 197 |
+
|
| 198 |
+
Currently, only functions are supported as a tool. Use this to provide a list of
|
| 199 |
+
functions the model may generate JSON inputs for. A max of 128 functions are
|
| 200 |
+
supported.
|
| 201 |
+
"""
|
| 202 |
+
|
| 203 |
+
top_p: float
|
| 204 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 205 |
+
|
| 206 |
+
|
| 207 |
+
class CreateEvalCompletionsRunDataSourceParam(TypedDict, total=False):
|
| 208 |
+
source: Required[Source]
|
| 209 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 210 |
+
|
| 211 |
+
type: Required[Literal["completions"]]
|
| 212 |
+
"""The type of run data source. Always `completions`."""
|
| 213 |
+
|
| 214 |
+
input_messages: InputMessages
|
| 215 |
+
"""Used when sampling from a model.
|
| 216 |
+
|
| 217 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 218 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 219 |
+
with variable references to the `item` namespace.
|
| 220 |
+
"""
|
| 221 |
+
|
| 222 |
+
model: str
|
| 223 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 224 |
+
|
| 225 |
+
sampling_params: SamplingParams
|
.venv/lib/python3.13/site-packages/openai/types/evals/create_eval_jsonl_run_data_source.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from ..._utils import PropertyInfo
|
| 7 |
+
from ..._models import BaseModel
|
| 8 |
+
|
| 9 |
+
__all__ = ["CreateEvalJSONLRunDataSource", "Source", "SourceFileContent", "SourceFileContentContent", "SourceFileID"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class SourceFileContentContent(BaseModel):
|
| 13 |
+
item: Dict[str, object]
|
| 14 |
+
|
| 15 |
+
sample: Optional[Dict[str, object]] = None
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class SourceFileContent(BaseModel):
|
| 19 |
+
content: List[SourceFileContentContent]
|
| 20 |
+
"""The content of the jsonl file."""
|
| 21 |
+
|
| 22 |
+
type: Literal["file_content"]
|
| 23 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class SourceFileID(BaseModel):
|
| 27 |
+
id: str
|
| 28 |
+
"""The identifier of the file."""
|
| 29 |
+
|
| 30 |
+
type: Literal["file_id"]
|
| 31 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
Source: TypeAlias = Annotated[Union[SourceFileContent, SourceFileID], PropertyInfo(discriminator="type")]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class CreateEvalJSONLRunDataSource(BaseModel):
|
| 38 |
+
source: Source
|
| 39 |
+
"""Determines what populates the `item` namespace in the data source."""
|
| 40 |
+
|
| 41 |
+
type: Literal["jsonl"]
|
| 42 |
+
"""The type of data source. Always `jsonl`."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/create_eval_jsonl_run_data_source_param.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Dict, Union, Iterable
|
| 6 |
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
| 7 |
+
|
| 8 |
+
__all__ = [
|
| 9 |
+
"CreateEvalJSONLRunDataSourceParam",
|
| 10 |
+
"Source",
|
| 11 |
+
"SourceFileContent",
|
| 12 |
+
"SourceFileContentContent",
|
| 13 |
+
"SourceFileID",
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class SourceFileContentContent(TypedDict, total=False):
|
| 18 |
+
item: Required[Dict[str, object]]
|
| 19 |
+
|
| 20 |
+
sample: Dict[str, object]
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class SourceFileContent(TypedDict, total=False):
|
| 24 |
+
content: Required[Iterable[SourceFileContentContent]]
|
| 25 |
+
"""The content of the jsonl file."""
|
| 26 |
+
|
| 27 |
+
type: Required[Literal["file_content"]]
|
| 28 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class SourceFileID(TypedDict, total=False):
|
| 32 |
+
id: Required[str]
|
| 33 |
+
"""The identifier of the file."""
|
| 34 |
+
|
| 35 |
+
type: Required[Literal["file_id"]]
|
| 36 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
Source: TypeAlias = Union[SourceFileContent, SourceFileID]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class CreateEvalJSONLRunDataSourceParam(TypedDict, total=False):
|
| 43 |
+
source: Required[Source]
|
| 44 |
+
"""Determines what populates the `item` namespace in the data source."""
|
| 45 |
+
|
| 46 |
+
type: Required[Literal["jsonl"]]
|
| 47 |
+
"""The type of data source. Always `jsonl`."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/eval_api_error.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from ..._models import BaseModel
|
| 4 |
+
|
| 5 |
+
__all__ = ["EvalAPIError"]
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class EvalAPIError(BaseModel):
|
| 9 |
+
code: str
|
| 10 |
+
"""The error code."""
|
| 11 |
+
|
| 12 |
+
message: str
|
| 13 |
+
"""The error message."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_cancel_response.py
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ..._utils import PropertyInfo
|
| 9 |
+
from ..._models import BaseModel
|
| 10 |
+
from .eval_api_error import EvalAPIError
|
| 11 |
+
from ..responses.tool import Tool
|
| 12 |
+
from ..shared.metadata import Metadata
|
| 13 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 14 |
+
from ..responses.response_input_text import ResponseInputText
|
| 15 |
+
from ..responses.response_input_audio import ResponseInputAudio
|
| 16 |
+
from .create_eval_jsonl_run_data_source import CreateEvalJSONLRunDataSource
|
| 17 |
+
from ..responses.response_format_text_config import ResponseFormatTextConfig
|
| 18 |
+
from .create_eval_completions_run_data_source import CreateEvalCompletionsRunDataSource
|
| 19 |
+
|
| 20 |
+
__all__ = [
|
| 21 |
+
"RunCancelResponse",
|
| 22 |
+
"DataSource",
|
| 23 |
+
"DataSourceResponses",
|
| 24 |
+
"DataSourceResponsesSource",
|
| 25 |
+
"DataSourceResponsesSourceFileContent",
|
| 26 |
+
"DataSourceResponsesSourceFileContentContent",
|
| 27 |
+
"DataSourceResponsesSourceFileID",
|
| 28 |
+
"DataSourceResponsesSourceResponses",
|
| 29 |
+
"DataSourceResponsesInputMessages",
|
| 30 |
+
"DataSourceResponsesInputMessagesTemplate",
|
| 31 |
+
"DataSourceResponsesInputMessagesTemplateTemplate",
|
| 32 |
+
"DataSourceResponsesInputMessagesTemplateTemplateChatMessage",
|
| 33 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItem",
|
| 34 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent",
|
| 35 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 36 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 37 |
+
"DataSourceResponsesInputMessagesItemReference",
|
| 38 |
+
"DataSourceResponsesSamplingParams",
|
| 39 |
+
"DataSourceResponsesSamplingParamsText",
|
| 40 |
+
"PerModelUsage",
|
| 41 |
+
"PerTestingCriteriaResult",
|
| 42 |
+
"ResultCounts",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class DataSourceResponsesSourceFileContentContent(BaseModel):
|
| 47 |
+
item: Dict[str, object]
|
| 48 |
+
|
| 49 |
+
sample: Optional[Dict[str, object]] = None
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class DataSourceResponsesSourceFileContent(BaseModel):
|
| 53 |
+
content: List[DataSourceResponsesSourceFileContentContent]
|
| 54 |
+
"""The content of the jsonl file."""
|
| 55 |
+
|
| 56 |
+
type: Literal["file_content"]
|
| 57 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class DataSourceResponsesSourceFileID(BaseModel):
|
| 61 |
+
id: str
|
| 62 |
+
"""The identifier of the file."""
|
| 63 |
+
|
| 64 |
+
type: Literal["file_id"]
|
| 65 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class DataSourceResponsesSourceResponses(BaseModel):
|
| 69 |
+
type: Literal["responses"]
|
| 70 |
+
"""The type of run data source. Always `responses`."""
|
| 71 |
+
|
| 72 |
+
created_after: Optional[int] = None
|
| 73 |
+
"""Only include items created after this timestamp (inclusive).
|
| 74 |
+
|
| 75 |
+
This is a query parameter used to select responses.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
created_before: Optional[int] = None
|
| 79 |
+
"""Only include items created before this timestamp (inclusive).
|
| 80 |
+
|
| 81 |
+
This is a query parameter used to select responses.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
instructions_search: Optional[str] = None
|
| 85 |
+
"""Optional string to search the 'instructions' field.
|
| 86 |
+
|
| 87 |
+
This is a query parameter used to select responses.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
metadata: Optional[object] = None
|
| 91 |
+
"""Metadata filter for the responses.
|
| 92 |
+
|
| 93 |
+
This is a query parameter used to select responses.
|
| 94 |
+
"""
|
| 95 |
+
|
| 96 |
+
model: Optional[str] = None
|
| 97 |
+
"""The name of the model to find responses for.
|
| 98 |
+
|
| 99 |
+
This is a query parameter used to select responses.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 103 |
+
"""
|
| 104 |
+
Constrains effort on reasoning for
|
| 105 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 106 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 107 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 108 |
+
response.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
temperature: Optional[float] = None
|
| 112 |
+
"""Sampling temperature. This is a query parameter used to select responses."""
|
| 113 |
+
|
| 114 |
+
tools: Optional[List[str]] = None
|
| 115 |
+
"""List of tool names. This is a query parameter used to select responses."""
|
| 116 |
+
|
| 117 |
+
top_p: Optional[float] = None
|
| 118 |
+
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
|
| 119 |
+
|
| 120 |
+
users: Optional[List[str]] = None
|
| 121 |
+
"""List of user identifiers. This is a query parameter used to select responses."""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
DataSourceResponsesSource: TypeAlias = Annotated[
|
| 125 |
+
Union[DataSourceResponsesSourceFileContent, DataSourceResponsesSourceFileID, DataSourceResponsesSourceResponses],
|
| 126 |
+
PropertyInfo(discriminator="type"),
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage(BaseModel):
|
| 131 |
+
content: str
|
| 132 |
+
"""The content of the message."""
|
| 133 |
+
|
| 134 |
+
role: str
|
| 135 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText(BaseModel):
|
| 139 |
+
text: str
|
| 140 |
+
"""The text output from the model."""
|
| 141 |
+
|
| 142 |
+
type: Literal["output_text"]
|
| 143 |
+
"""The type of the output text. Always `output_text`."""
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage(BaseModel):
|
| 147 |
+
image_url: str
|
| 148 |
+
"""The URL of the image input."""
|
| 149 |
+
|
| 150 |
+
type: Literal["input_image"]
|
| 151 |
+
"""The type of the image input. Always `input_image`."""
|
| 152 |
+
|
| 153 |
+
detail: Optional[str] = None
|
| 154 |
+
"""The detail level of the image to be sent to the model.
|
| 155 |
+
|
| 156 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 161 |
+
str,
|
| 162 |
+
ResponseInputText,
|
| 163 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 164 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 165 |
+
ResponseInputAudio,
|
| 166 |
+
List[object],
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem(BaseModel):
|
| 171 |
+
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent
|
| 172 |
+
"""Inputs to the model - can contain template strings."""
|
| 173 |
+
|
| 174 |
+
role: Literal["user", "assistant", "system", "developer"]
|
| 175 |
+
"""The role of the message input.
|
| 176 |
+
|
| 177 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
type: Optional[Literal["message"]] = None
|
| 181 |
+
"""The type of the message input. Always `message`."""
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
DataSourceResponsesInputMessagesTemplateTemplate: TypeAlias = Union[
|
| 185 |
+
DataSourceResponsesInputMessagesTemplateTemplateChatMessage,
|
| 186 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItem,
|
| 187 |
+
]
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class DataSourceResponsesInputMessagesTemplate(BaseModel):
|
| 191 |
+
template: List[DataSourceResponsesInputMessagesTemplateTemplate]
|
| 192 |
+
"""A list of chat messages forming the prompt or context.
|
| 193 |
+
|
| 194 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 195 |
+
"""
|
| 196 |
+
|
| 197 |
+
type: Literal["template"]
|
| 198 |
+
"""The type of input messages. Always `template`."""
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class DataSourceResponsesInputMessagesItemReference(BaseModel):
|
| 202 |
+
item_reference: str
|
| 203 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
|
| 204 |
+
|
| 205 |
+
type: Literal["item_reference"]
|
| 206 |
+
"""The type of input messages. Always `item_reference`."""
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
DataSourceResponsesInputMessages: TypeAlias = Annotated[
|
| 210 |
+
Union[DataSourceResponsesInputMessagesTemplate, DataSourceResponsesInputMessagesItemReference],
|
| 211 |
+
PropertyInfo(discriminator="type"),
|
| 212 |
+
]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class DataSourceResponsesSamplingParamsText(BaseModel):
|
| 216 |
+
format: Optional[ResponseFormatTextConfig] = None
|
| 217 |
+
"""An object specifying the format that the model must output.
|
| 218 |
+
|
| 219 |
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
| 220 |
+
ensures the model will match your supplied JSON schema. Learn more in the
|
| 221 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 222 |
+
|
| 223 |
+
The default format is `{ "type": "text" }` with no additional options.
|
| 224 |
+
|
| 225 |
+
**Not recommended for gpt-4o and newer models:**
|
| 226 |
+
|
| 227 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 228 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 229 |
+
preferred for models that support it.
|
| 230 |
+
"""
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class DataSourceResponsesSamplingParams(BaseModel):
|
| 234 |
+
max_completion_tokens: Optional[int] = None
|
| 235 |
+
"""The maximum number of tokens in the generated output."""
|
| 236 |
+
|
| 237 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 238 |
+
"""
|
| 239 |
+
Constrains effort on reasoning for
|
| 240 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 241 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 242 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 243 |
+
response.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
seed: Optional[int] = None
|
| 247 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 248 |
+
|
| 249 |
+
temperature: Optional[float] = None
|
| 250 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 251 |
+
|
| 252 |
+
text: Optional[DataSourceResponsesSamplingParamsText] = None
|
| 253 |
+
"""Configuration options for a text response from the model.
|
| 254 |
+
|
| 255 |
+
Can be plain text or structured JSON data. Learn more:
|
| 256 |
+
|
| 257 |
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
| 258 |
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
| 259 |
+
"""
|
| 260 |
+
|
| 261 |
+
tools: Optional[List[Tool]] = None
|
| 262 |
+
"""An array of tools the model may call while generating a response.
|
| 263 |
+
|
| 264 |
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
| 265 |
+
|
| 266 |
+
The two categories of tools you can provide the model are:
|
| 267 |
+
|
| 268 |
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
| 269 |
+
capabilities, like
|
| 270 |
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
| 271 |
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
| 272 |
+
Learn more about
|
| 273 |
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
| 274 |
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
| 275 |
+
the model to call your own code. Learn more about
|
| 276 |
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
top_p: Optional[float] = None
|
| 280 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class DataSourceResponses(BaseModel):
|
| 284 |
+
source: DataSourceResponsesSource
|
| 285 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 286 |
+
|
| 287 |
+
type: Literal["responses"]
|
| 288 |
+
"""The type of run data source. Always `responses`."""
|
| 289 |
+
|
| 290 |
+
input_messages: Optional[DataSourceResponsesInputMessages] = None
|
| 291 |
+
"""Used when sampling from a model.
|
| 292 |
+
|
| 293 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 294 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 295 |
+
with variable references to the `item` namespace.
|
| 296 |
+
"""
|
| 297 |
+
|
| 298 |
+
model: Optional[str] = None
|
| 299 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 300 |
+
|
| 301 |
+
sampling_params: Optional[DataSourceResponsesSamplingParams] = None
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
DataSource: TypeAlias = Annotated[
|
| 305 |
+
Union[CreateEvalJSONLRunDataSource, CreateEvalCompletionsRunDataSource, DataSourceResponses],
|
| 306 |
+
PropertyInfo(discriminator="type"),
|
| 307 |
+
]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class PerModelUsage(BaseModel):
|
| 311 |
+
cached_tokens: int
|
| 312 |
+
"""The number of tokens retrieved from cache."""
|
| 313 |
+
|
| 314 |
+
completion_tokens: int
|
| 315 |
+
"""The number of completion tokens generated."""
|
| 316 |
+
|
| 317 |
+
invocation_count: int
|
| 318 |
+
"""The number of invocations."""
|
| 319 |
+
|
| 320 |
+
run_model_name: str = FieldInfo(alias="model_name")
|
| 321 |
+
"""The name of the model."""
|
| 322 |
+
|
| 323 |
+
prompt_tokens: int
|
| 324 |
+
"""The number of prompt tokens used."""
|
| 325 |
+
|
| 326 |
+
total_tokens: int
|
| 327 |
+
"""The total number of tokens used."""
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
class PerTestingCriteriaResult(BaseModel):
|
| 331 |
+
failed: int
|
| 332 |
+
"""Number of tests failed for this criteria."""
|
| 333 |
+
|
| 334 |
+
passed: int
|
| 335 |
+
"""Number of tests passed for this criteria."""
|
| 336 |
+
|
| 337 |
+
testing_criteria: str
|
| 338 |
+
"""A description of the testing criteria."""
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class ResultCounts(BaseModel):
|
| 342 |
+
errored: int
|
| 343 |
+
"""Number of output items that resulted in an error."""
|
| 344 |
+
|
| 345 |
+
failed: int
|
| 346 |
+
"""Number of output items that failed to pass the evaluation."""
|
| 347 |
+
|
| 348 |
+
passed: int
|
| 349 |
+
"""Number of output items that passed the evaluation."""
|
| 350 |
+
|
| 351 |
+
total: int
|
| 352 |
+
"""Total number of executed output items."""
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class RunCancelResponse(BaseModel):
|
| 356 |
+
id: str
|
| 357 |
+
"""Unique identifier for the evaluation run."""
|
| 358 |
+
|
| 359 |
+
created_at: int
|
| 360 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 361 |
+
|
| 362 |
+
data_source: DataSource
|
| 363 |
+
"""Information about the run's data source."""
|
| 364 |
+
|
| 365 |
+
error: EvalAPIError
|
| 366 |
+
"""An object representing an error response from the Eval API."""
|
| 367 |
+
|
| 368 |
+
eval_id: str
|
| 369 |
+
"""The identifier of the associated evaluation."""
|
| 370 |
+
|
| 371 |
+
metadata: Optional[Metadata] = None
|
| 372 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 373 |
+
|
| 374 |
+
This can be useful for storing additional information about the object in a
|
| 375 |
+
structured format, and querying for objects via API or the dashboard.
|
| 376 |
+
|
| 377 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 378 |
+
a maximum length of 512 characters.
|
| 379 |
+
"""
|
| 380 |
+
|
| 381 |
+
model: str
|
| 382 |
+
"""The model that is evaluated, if applicable."""
|
| 383 |
+
|
| 384 |
+
name: str
|
| 385 |
+
"""The name of the evaluation run."""
|
| 386 |
+
|
| 387 |
+
object: Literal["eval.run"]
|
| 388 |
+
"""The type of the object. Always "eval.run"."""
|
| 389 |
+
|
| 390 |
+
per_model_usage: List[PerModelUsage]
|
| 391 |
+
"""Usage statistics for each model during the evaluation run."""
|
| 392 |
+
|
| 393 |
+
per_testing_criteria_results: List[PerTestingCriteriaResult]
|
| 394 |
+
"""Results per testing criteria applied during the evaluation run."""
|
| 395 |
+
|
| 396 |
+
report_url: str
|
| 397 |
+
"""The URL to the rendered evaluation run report on the UI dashboard."""
|
| 398 |
+
|
| 399 |
+
result_counts: ResultCounts
|
| 400 |
+
"""Counters summarizing the outcomes of the evaluation run."""
|
| 401 |
+
|
| 402 |
+
status: str
|
| 403 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_create_params.py
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Dict, Union, Iterable, Optional
|
| 6 |
+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
|
| 7 |
+
|
| 8 |
+
from ..._types import SequenceNotStr
|
| 9 |
+
from ..responses.tool_param import ToolParam
|
| 10 |
+
from ..shared_params.metadata import Metadata
|
| 11 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 12 |
+
from ..responses.response_input_text_param import ResponseInputTextParam
|
| 13 |
+
from ..responses.response_input_audio_param import ResponseInputAudioParam
|
| 14 |
+
from .create_eval_jsonl_run_data_source_param import CreateEvalJSONLRunDataSourceParam
|
| 15 |
+
from ..responses.response_format_text_config_param import ResponseFormatTextConfigParam
|
| 16 |
+
from .create_eval_completions_run_data_source_param import CreateEvalCompletionsRunDataSourceParam
|
| 17 |
+
|
| 18 |
+
__all__ = [
|
| 19 |
+
"RunCreateParams",
|
| 20 |
+
"DataSource",
|
| 21 |
+
"DataSourceCreateEvalResponsesRunDataSource",
|
| 22 |
+
"DataSourceCreateEvalResponsesRunDataSourceSource",
|
| 23 |
+
"DataSourceCreateEvalResponsesRunDataSourceSourceFileContent",
|
| 24 |
+
"DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent",
|
| 25 |
+
"DataSourceCreateEvalResponsesRunDataSourceSourceFileID",
|
| 26 |
+
"DataSourceCreateEvalResponsesRunDataSourceSourceResponses",
|
| 27 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessages",
|
| 28 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate",
|
| 29 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate",
|
| 30 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage",
|
| 31 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem",
|
| 32 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent",
|
| 33 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 34 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 35 |
+
"DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference",
|
| 36 |
+
"DataSourceCreateEvalResponsesRunDataSourceSamplingParams",
|
| 37 |
+
"DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText",
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class RunCreateParams(TypedDict, total=False):
|
| 42 |
+
data_source: Required[DataSource]
|
| 43 |
+
"""Details about the run's data source."""
|
| 44 |
+
|
| 45 |
+
metadata: Optional[Metadata]
|
| 46 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 47 |
+
|
| 48 |
+
This can be useful for storing additional information about the object in a
|
| 49 |
+
structured format, and querying for objects via API or the dashboard.
|
| 50 |
+
|
| 51 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 52 |
+
a maximum length of 512 characters.
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
name: str
|
| 56 |
+
"""The name of the run."""
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent(TypedDict, total=False):
|
| 60 |
+
item: Required[Dict[str, object]]
|
| 61 |
+
|
| 62 |
+
sample: Dict[str, object]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class DataSourceCreateEvalResponsesRunDataSourceSourceFileContent(TypedDict, total=False):
|
| 66 |
+
content: Required[Iterable[DataSourceCreateEvalResponsesRunDataSourceSourceFileContentContent]]
|
| 67 |
+
"""The content of the jsonl file."""
|
| 68 |
+
|
| 69 |
+
type: Required[Literal["file_content"]]
|
| 70 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class DataSourceCreateEvalResponsesRunDataSourceSourceFileID(TypedDict, total=False):
|
| 74 |
+
id: Required[str]
|
| 75 |
+
"""The identifier of the file."""
|
| 76 |
+
|
| 77 |
+
type: Required[Literal["file_id"]]
|
| 78 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class DataSourceCreateEvalResponsesRunDataSourceSourceResponses(TypedDict, total=False):
|
| 82 |
+
type: Required[Literal["responses"]]
|
| 83 |
+
"""The type of run data source. Always `responses`."""
|
| 84 |
+
|
| 85 |
+
created_after: Optional[int]
|
| 86 |
+
"""Only include items created after this timestamp (inclusive).
|
| 87 |
+
|
| 88 |
+
This is a query parameter used to select responses.
|
| 89 |
+
"""
|
| 90 |
+
|
| 91 |
+
created_before: Optional[int]
|
| 92 |
+
"""Only include items created before this timestamp (inclusive).
|
| 93 |
+
|
| 94 |
+
This is a query parameter used to select responses.
|
| 95 |
+
"""
|
| 96 |
+
|
| 97 |
+
instructions_search: Optional[str]
|
| 98 |
+
"""Optional string to search the 'instructions' field.
|
| 99 |
+
|
| 100 |
+
This is a query parameter used to select responses.
|
| 101 |
+
"""
|
| 102 |
+
|
| 103 |
+
metadata: Optional[object]
|
| 104 |
+
"""Metadata filter for the responses.
|
| 105 |
+
|
| 106 |
+
This is a query parameter used to select responses.
|
| 107 |
+
"""
|
| 108 |
+
|
| 109 |
+
model: Optional[str]
|
| 110 |
+
"""The name of the model to find responses for.
|
| 111 |
+
|
| 112 |
+
This is a query parameter used to select responses.
|
| 113 |
+
"""
|
| 114 |
+
|
| 115 |
+
reasoning_effort: Optional[ReasoningEffort]
|
| 116 |
+
"""
|
| 117 |
+
Constrains effort on reasoning for
|
| 118 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 119 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 120 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 121 |
+
response.
|
| 122 |
+
"""
|
| 123 |
+
|
| 124 |
+
temperature: Optional[float]
|
| 125 |
+
"""Sampling temperature. This is a query parameter used to select responses."""
|
| 126 |
+
|
| 127 |
+
tools: Optional[SequenceNotStr[str]]
|
| 128 |
+
"""List of tool names. This is a query parameter used to select responses."""
|
| 129 |
+
|
| 130 |
+
top_p: Optional[float]
|
| 131 |
+
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
|
| 132 |
+
|
| 133 |
+
users: Optional[SequenceNotStr[str]]
|
| 134 |
+
"""List of user identifiers. This is a query parameter used to select responses."""
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
DataSourceCreateEvalResponsesRunDataSourceSource: TypeAlias = Union[
|
| 138 |
+
DataSourceCreateEvalResponsesRunDataSourceSourceFileContent,
|
| 139 |
+
DataSourceCreateEvalResponsesRunDataSourceSourceFileID,
|
| 140 |
+
DataSourceCreateEvalResponsesRunDataSourceSourceResponses,
|
| 141 |
+
]
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage(TypedDict, total=False):
|
| 145 |
+
content: Required[str]
|
| 146 |
+
"""The content of the message."""
|
| 147 |
+
|
| 148 |
+
role: Required[str]
|
| 149 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText(
|
| 153 |
+
TypedDict, total=False
|
| 154 |
+
):
|
| 155 |
+
text: Required[str]
|
| 156 |
+
"""The text output from the model."""
|
| 157 |
+
|
| 158 |
+
type: Required[Literal["output_text"]]
|
| 159 |
+
"""The type of the output text. Always `output_text`."""
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage(
|
| 163 |
+
TypedDict, total=False
|
| 164 |
+
):
|
| 165 |
+
image_url: Required[str]
|
| 166 |
+
"""The URL of the image input."""
|
| 167 |
+
|
| 168 |
+
type: Required[Literal["input_image"]]
|
| 169 |
+
"""The type of the image input. Always `input_image`."""
|
| 170 |
+
|
| 171 |
+
detail: str
|
| 172 |
+
"""The detail level of the image to be sent to the model.
|
| 173 |
+
|
| 174 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 175 |
+
"""
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 179 |
+
str,
|
| 180 |
+
ResponseInputTextParam,
|
| 181 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 182 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 183 |
+
ResponseInputAudioParam,
|
| 184 |
+
Iterable[object],
|
| 185 |
+
]
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem(TypedDict, total=False):
|
| 189 |
+
content: Required[DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItemContent]
|
| 190 |
+
"""Inputs to the model - can contain template strings."""
|
| 191 |
+
|
| 192 |
+
role: Required[Literal["user", "assistant", "system", "developer"]]
|
| 193 |
+
"""The role of the message input.
|
| 194 |
+
|
| 195 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 196 |
+
"""
|
| 197 |
+
|
| 198 |
+
type: Literal["message"]
|
| 199 |
+
"""The type of the message input. Always `message`."""
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate: TypeAlias = Union[
|
| 203 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateChatMessage,
|
| 204 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplateEvalItem,
|
| 205 |
+
]
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate(TypedDict, total=False):
|
| 209 |
+
template: Required[Iterable[DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplateTemplate]]
|
| 210 |
+
"""A list of chat messages forming the prompt or context.
|
| 211 |
+
|
| 212 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 213 |
+
"""
|
| 214 |
+
|
| 215 |
+
type: Required[Literal["template"]]
|
| 216 |
+
"""The type of input messages. Always `template`."""
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
class DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference(TypedDict, total=False):
|
| 220 |
+
item_reference: Required[str]
|
| 221 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
|
| 222 |
+
|
| 223 |
+
type: Required[Literal["item_reference"]]
|
| 224 |
+
"""The type of input messages. Always `item_reference`."""
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessages: TypeAlias = Union[
|
| 228 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesTemplate,
|
| 229 |
+
DataSourceCreateEvalResponsesRunDataSourceInputMessagesItemReference,
|
| 230 |
+
]
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText(TypedDict, total=False):
|
| 234 |
+
format: ResponseFormatTextConfigParam
|
| 235 |
+
"""An object specifying the format that the model must output.
|
| 236 |
+
|
| 237 |
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
| 238 |
+
ensures the model will match your supplied JSON schema. Learn more in the
|
| 239 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 240 |
+
|
| 241 |
+
The default format is `{ "type": "text" }` with no additional options.
|
| 242 |
+
|
| 243 |
+
**Not recommended for gpt-4o and newer models:**
|
| 244 |
+
|
| 245 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 246 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 247 |
+
preferred for models that support it.
|
| 248 |
+
"""
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
class DataSourceCreateEvalResponsesRunDataSourceSamplingParams(TypedDict, total=False):
|
| 252 |
+
max_completion_tokens: int
|
| 253 |
+
"""The maximum number of tokens in the generated output."""
|
| 254 |
+
|
| 255 |
+
reasoning_effort: Optional[ReasoningEffort]
|
| 256 |
+
"""
|
| 257 |
+
Constrains effort on reasoning for
|
| 258 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 259 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 260 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 261 |
+
response.
|
| 262 |
+
"""
|
| 263 |
+
|
| 264 |
+
seed: int
|
| 265 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 266 |
+
|
| 267 |
+
temperature: float
|
| 268 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 269 |
+
|
| 270 |
+
text: DataSourceCreateEvalResponsesRunDataSourceSamplingParamsText
|
| 271 |
+
"""Configuration options for a text response from the model.
|
| 272 |
+
|
| 273 |
+
Can be plain text or structured JSON data. Learn more:
|
| 274 |
+
|
| 275 |
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
| 276 |
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
tools: Iterable[ToolParam]
|
| 280 |
+
"""An array of tools the model may call while generating a response.
|
| 281 |
+
|
| 282 |
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
| 283 |
+
|
| 284 |
+
The two categories of tools you can provide the model are:
|
| 285 |
+
|
| 286 |
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
| 287 |
+
capabilities, like
|
| 288 |
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
| 289 |
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
| 290 |
+
Learn more about
|
| 291 |
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
| 292 |
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
| 293 |
+
the model to call your own code. Learn more about
|
| 294 |
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
| 295 |
+
"""
|
| 296 |
+
|
| 297 |
+
top_p: float
|
| 298 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
class DataSourceCreateEvalResponsesRunDataSource(TypedDict, total=False):
|
| 302 |
+
source: Required[DataSourceCreateEvalResponsesRunDataSourceSource]
|
| 303 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 304 |
+
|
| 305 |
+
type: Required[Literal["responses"]]
|
| 306 |
+
"""The type of run data source. Always `responses`."""
|
| 307 |
+
|
| 308 |
+
input_messages: DataSourceCreateEvalResponsesRunDataSourceInputMessages
|
| 309 |
+
"""Used when sampling from a model.
|
| 310 |
+
|
| 311 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 312 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 313 |
+
with variable references to the `item` namespace.
|
| 314 |
+
"""
|
| 315 |
+
|
| 316 |
+
model: str
|
| 317 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 318 |
+
|
| 319 |
+
sampling_params: DataSourceCreateEvalResponsesRunDataSourceSamplingParams
|
| 320 |
+
|
| 321 |
+
|
| 322 |
+
DataSource: TypeAlias = Union[
|
| 323 |
+
CreateEvalJSONLRunDataSourceParam,
|
| 324 |
+
CreateEvalCompletionsRunDataSourceParam,
|
| 325 |
+
DataSourceCreateEvalResponsesRunDataSource,
|
| 326 |
+
]
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_create_response.py
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ..._utils import PropertyInfo
|
| 9 |
+
from ..._models import BaseModel
|
| 10 |
+
from .eval_api_error import EvalAPIError
|
| 11 |
+
from ..responses.tool import Tool
|
| 12 |
+
from ..shared.metadata import Metadata
|
| 13 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 14 |
+
from ..responses.response_input_text import ResponseInputText
|
| 15 |
+
from ..responses.response_input_audio import ResponseInputAudio
|
| 16 |
+
from .create_eval_jsonl_run_data_source import CreateEvalJSONLRunDataSource
|
| 17 |
+
from ..responses.response_format_text_config import ResponseFormatTextConfig
|
| 18 |
+
from .create_eval_completions_run_data_source import CreateEvalCompletionsRunDataSource
|
| 19 |
+
|
| 20 |
+
__all__ = [
|
| 21 |
+
"RunCreateResponse",
|
| 22 |
+
"DataSource",
|
| 23 |
+
"DataSourceResponses",
|
| 24 |
+
"DataSourceResponsesSource",
|
| 25 |
+
"DataSourceResponsesSourceFileContent",
|
| 26 |
+
"DataSourceResponsesSourceFileContentContent",
|
| 27 |
+
"DataSourceResponsesSourceFileID",
|
| 28 |
+
"DataSourceResponsesSourceResponses",
|
| 29 |
+
"DataSourceResponsesInputMessages",
|
| 30 |
+
"DataSourceResponsesInputMessagesTemplate",
|
| 31 |
+
"DataSourceResponsesInputMessagesTemplateTemplate",
|
| 32 |
+
"DataSourceResponsesInputMessagesTemplateTemplateChatMessage",
|
| 33 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItem",
|
| 34 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent",
|
| 35 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 36 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 37 |
+
"DataSourceResponsesInputMessagesItemReference",
|
| 38 |
+
"DataSourceResponsesSamplingParams",
|
| 39 |
+
"DataSourceResponsesSamplingParamsText",
|
| 40 |
+
"PerModelUsage",
|
| 41 |
+
"PerTestingCriteriaResult",
|
| 42 |
+
"ResultCounts",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class DataSourceResponsesSourceFileContentContent(BaseModel):
|
| 47 |
+
item: Dict[str, object]
|
| 48 |
+
|
| 49 |
+
sample: Optional[Dict[str, object]] = None
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class DataSourceResponsesSourceFileContent(BaseModel):
|
| 53 |
+
content: List[DataSourceResponsesSourceFileContentContent]
|
| 54 |
+
"""The content of the jsonl file."""
|
| 55 |
+
|
| 56 |
+
type: Literal["file_content"]
|
| 57 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class DataSourceResponsesSourceFileID(BaseModel):
|
| 61 |
+
id: str
|
| 62 |
+
"""The identifier of the file."""
|
| 63 |
+
|
| 64 |
+
type: Literal["file_id"]
|
| 65 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class DataSourceResponsesSourceResponses(BaseModel):
|
| 69 |
+
type: Literal["responses"]
|
| 70 |
+
"""The type of run data source. Always `responses`."""
|
| 71 |
+
|
| 72 |
+
created_after: Optional[int] = None
|
| 73 |
+
"""Only include items created after this timestamp (inclusive).
|
| 74 |
+
|
| 75 |
+
This is a query parameter used to select responses.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
created_before: Optional[int] = None
|
| 79 |
+
"""Only include items created before this timestamp (inclusive).
|
| 80 |
+
|
| 81 |
+
This is a query parameter used to select responses.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
instructions_search: Optional[str] = None
|
| 85 |
+
"""Optional string to search the 'instructions' field.
|
| 86 |
+
|
| 87 |
+
This is a query parameter used to select responses.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
metadata: Optional[object] = None
|
| 91 |
+
"""Metadata filter for the responses.
|
| 92 |
+
|
| 93 |
+
This is a query parameter used to select responses.
|
| 94 |
+
"""
|
| 95 |
+
|
| 96 |
+
model: Optional[str] = None
|
| 97 |
+
"""The name of the model to find responses for.
|
| 98 |
+
|
| 99 |
+
This is a query parameter used to select responses.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 103 |
+
"""
|
| 104 |
+
Constrains effort on reasoning for
|
| 105 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 106 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 107 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 108 |
+
response.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
temperature: Optional[float] = None
|
| 112 |
+
"""Sampling temperature. This is a query parameter used to select responses."""
|
| 113 |
+
|
| 114 |
+
tools: Optional[List[str]] = None
|
| 115 |
+
"""List of tool names. This is a query parameter used to select responses."""
|
| 116 |
+
|
| 117 |
+
top_p: Optional[float] = None
|
| 118 |
+
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
|
| 119 |
+
|
| 120 |
+
users: Optional[List[str]] = None
|
| 121 |
+
"""List of user identifiers. This is a query parameter used to select responses."""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
DataSourceResponsesSource: TypeAlias = Annotated[
|
| 125 |
+
Union[DataSourceResponsesSourceFileContent, DataSourceResponsesSourceFileID, DataSourceResponsesSourceResponses],
|
| 126 |
+
PropertyInfo(discriminator="type"),
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage(BaseModel):
|
| 131 |
+
content: str
|
| 132 |
+
"""The content of the message."""
|
| 133 |
+
|
| 134 |
+
role: str
|
| 135 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText(BaseModel):
|
| 139 |
+
text: str
|
| 140 |
+
"""The text output from the model."""
|
| 141 |
+
|
| 142 |
+
type: Literal["output_text"]
|
| 143 |
+
"""The type of the output text. Always `output_text`."""
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage(BaseModel):
|
| 147 |
+
image_url: str
|
| 148 |
+
"""The URL of the image input."""
|
| 149 |
+
|
| 150 |
+
type: Literal["input_image"]
|
| 151 |
+
"""The type of the image input. Always `input_image`."""
|
| 152 |
+
|
| 153 |
+
detail: Optional[str] = None
|
| 154 |
+
"""The detail level of the image to be sent to the model.
|
| 155 |
+
|
| 156 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 161 |
+
str,
|
| 162 |
+
ResponseInputText,
|
| 163 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 164 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 165 |
+
ResponseInputAudio,
|
| 166 |
+
List[object],
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem(BaseModel):
|
| 171 |
+
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent
|
| 172 |
+
"""Inputs to the model - can contain template strings."""
|
| 173 |
+
|
| 174 |
+
role: Literal["user", "assistant", "system", "developer"]
|
| 175 |
+
"""The role of the message input.
|
| 176 |
+
|
| 177 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
type: Optional[Literal["message"]] = None
|
| 181 |
+
"""The type of the message input. Always `message`."""
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
DataSourceResponsesInputMessagesTemplateTemplate: TypeAlias = Union[
|
| 185 |
+
DataSourceResponsesInputMessagesTemplateTemplateChatMessage,
|
| 186 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItem,
|
| 187 |
+
]
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class DataSourceResponsesInputMessagesTemplate(BaseModel):
|
| 191 |
+
template: List[DataSourceResponsesInputMessagesTemplateTemplate]
|
| 192 |
+
"""A list of chat messages forming the prompt or context.
|
| 193 |
+
|
| 194 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 195 |
+
"""
|
| 196 |
+
|
| 197 |
+
type: Literal["template"]
|
| 198 |
+
"""The type of input messages. Always `template`."""
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class DataSourceResponsesInputMessagesItemReference(BaseModel):
|
| 202 |
+
item_reference: str
|
| 203 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
|
| 204 |
+
|
| 205 |
+
type: Literal["item_reference"]
|
| 206 |
+
"""The type of input messages. Always `item_reference`."""
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
DataSourceResponsesInputMessages: TypeAlias = Annotated[
|
| 210 |
+
Union[DataSourceResponsesInputMessagesTemplate, DataSourceResponsesInputMessagesItemReference],
|
| 211 |
+
PropertyInfo(discriminator="type"),
|
| 212 |
+
]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class DataSourceResponsesSamplingParamsText(BaseModel):
|
| 216 |
+
format: Optional[ResponseFormatTextConfig] = None
|
| 217 |
+
"""An object specifying the format that the model must output.
|
| 218 |
+
|
| 219 |
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
| 220 |
+
ensures the model will match your supplied JSON schema. Learn more in the
|
| 221 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 222 |
+
|
| 223 |
+
The default format is `{ "type": "text" }` with no additional options.
|
| 224 |
+
|
| 225 |
+
**Not recommended for gpt-4o and newer models:**
|
| 226 |
+
|
| 227 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 228 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 229 |
+
preferred for models that support it.
|
| 230 |
+
"""
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class DataSourceResponsesSamplingParams(BaseModel):
|
| 234 |
+
max_completion_tokens: Optional[int] = None
|
| 235 |
+
"""The maximum number of tokens in the generated output."""
|
| 236 |
+
|
| 237 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 238 |
+
"""
|
| 239 |
+
Constrains effort on reasoning for
|
| 240 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 241 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 242 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 243 |
+
response.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
seed: Optional[int] = None
|
| 247 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 248 |
+
|
| 249 |
+
temperature: Optional[float] = None
|
| 250 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 251 |
+
|
| 252 |
+
text: Optional[DataSourceResponsesSamplingParamsText] = None
|
| 253 |
+
"""Configuration options for a text response from the model.
|
| 254 |
+
|
| 255 |
+
Can be plain text or structured JSON data. Learn more:
|
| 256 |
+
|
| 257 |
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
| 258 |
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
| 259 |
+
"""
|
| 260 |
+
|
| 261 |
+
tools: Optional[List[Tool]] = None
|
| 262 |
+
"""An array of tools the model may call while generating a response.
|
| 263 |
+
|
| 264 |
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
| 265 |
+
|
| 266 |
+
The two categories of tools you can provide the model are:
|
| 267 |
+
|
| 268 |
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
| 269 |
+
capabilities, like
|
| 270 |
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
| 271 |
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
| 272 |
+
Learn more about
|
| 273 |
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
| 274 |
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
| 275 |
+
the model to call your own code. Learn more about
|
| 276 |
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
top_p: Optional[float] = None
|
| 280 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class DataSourceResponses(BaseModel):
|
| 284 |
+
source: DataSourceResponsesSource
|
| 285 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 286 |
+
|
| 287 |
+
type: Literal["responses"]
|
| 288 |
+
"""The type of run data source. Always `responses`."""
|
| 289 |
+
|
| 290 |
+
input_messages: Optional[DataSourceResponsesInputMessages] = None
|
| 291 |
+
"""Used when sampling from a model.
|
| 292 |
+
|
| 293 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 294 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 295 |
+
with variable references to the `item` namespace.
|
| 296 |
+
"""
|
| 297 |
+
|
| 298 |
+
model: Optional[str] = None
|
| 299 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 300 |
+
|
| 301 |
+
sampling_params: Optional[DataSourceResponsesSamplingParams] = None
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
DataSource: TypeAlias = Annotated[
|
| 305 |
+
Union[CreateEvalJSONLRunDataSource, CreateEvalCompletionsRunDataSource, DataSourceResponses],
|
| 306 |
+
PropertyInfo(discriminator="type"),
|
| 307 |
+
]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class PerModelUsage(BaseModel):
|
| 311 |
+
cached_tokens: int
|
| 312 |
+
"""The number of tokens retrieved from cache."""
|
| 313 |
+
|
| 314 |
+
completion_tokens: int
|
| 315 |
+
"""The number of completion tokens generated."""
|
| 316 |
+
|
| 317 |
+
invocation_count: int
|
| 318 |
+
"""The number of invocations."""
|
| 319 |
+
|
| 320 |
+
run_model_name: str = FieldInfo(alias="model_name")
|
| 321 |
+
"""The name of the model."""
|
| 322 |
+
|
| 323 |
+
prompt_tokens: int
|
| 324 |
+
"""The number of prompt tokens used."""
|
| 325 |
+
|
| 326 |
+
total_tokens: int
|
| 327 |
+
"""The total number of tokens used."""
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
class PerTestingCriteriaResult(BaseModel):
|
| 331 |
+
failed: int
|
| 332 |
+
"""Number of tests failed for this criteria."""
|
| 333 |
+
|
| 334 |
+
passed: int
|
| 335 |
+
"""Number of tests passed for this criteria."""
|
| 336 |
+
|
| 337 |
+
testing_criteria: str
|
| 338 |
+
"""A description of the testing criteria."""
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class ResultCounts(BaseModel):
|
| 342 |
+
errored: int
|
| 343 |
+
"""Number of output items that resulted in an error."""
|
| 344 |
+
|
| 345 |
+
failed: int
|
| 346 |
+
"""Number of output items that failed to pass the evaluation."""
|
| 347 |
+
|
| 348 |
+
passed: int
|
| 349 |
+
"""Number of output items that passed the evaluation."""
|
| 350 |
+
|
| 351 |
+
total: int
|
| 352 |
+
"""Total number of executed output items."""
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class RunCreateResponse(BaseModel):
|
| 356 |
+
id: str
|
| 357 |
+
"""Unique identifier for the evaluation run."""
|
| 358 |
+
|
| 359 |
+
created_at: int
|
| 360 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 361 |
+
|
| 362 |
+
data_source: DataSource
|
| 363 |
+
"""Information about the run's data source."""
|
| 364 |
+
|
| 365 |
+
error: EvalAPIError
|
| 366 |
+
"""An object representing an error response from the Eval API."""
|
| 367 |
+
|
| 368 |
+
eval_id: str
|
| 369 |
+
"""The identifier of the associated evaluation."""
|
| 370 |
+
|
| 371 |
+
metadata: Optional[Metadata] = None
|
| 372 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 373 |
+
|
| 374 |
+
This can be useful for storing additional information about the object in a
|
| 375 |
+
structured format, and querying for objects via API or the dashboard.
|
| 376 |
+
|
| 377 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 378 |
+
a maximum length of 512 characters.
|
| 379 |
+
"""
|
| 380 |
+
|
| 381 |
+
model: str
|
| 382 |
+
"""The model that is evaluated, if applicable."""
|
| 383 |
+
|
| 384 |
+
name: str
|
| 385 |
+
"""The name of the evaluation run."""
|
| 386 |
+
|
| 387 |
+
object: Literal["eval.run"]
|
| 388 |
+
"""The type of the object. Always "eval.run"."""
|
| 389 |
+
|
| 390 |
+
per_model_usage: List[PerModelUsage]
|
| 391 |
+
"""Usage statistics for each model during the evaluation run."""
|
| 392 |
+
|
| 393 |
+
per_testing_criteria_results: List[PerTestingCriteriaResult]
|
| 394 |
+
"""Results per testing criteria applied during the evaluation run."""
|
| 395 |
+
|
| 396 |
+
report_url: str
|
| 397 |
+
"""The URL to the rendered evaluation run report on the UI dashboard."""
|
| 398 |
+
|
| 399 |
+
result_counts: ResultCounts
|
| 400 |
+
"""Counters summarizing the outcomes of the evaluation run."""
|
| 401 |
+
|
| 402 |
+
status: str
|
| 403 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_delete_response.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Optional
|
| 4 |
+
|
| 5 |
+
from ..._models import BaseModel
|
| 6 |
+
|
| 7 |
+
__all__ = ["RunDeleteResponse"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class RunDeleteResponse(BaseModel):
|
| 11 |
+
deleted: Optional[bool] = None
|
| 12 |
+
|
| 13 |
+
object: Optional[str] = None
|
| 14 |
+
|
| 15 |
+
run_id: Optional[str] = None
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_list_params.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing_extensions import Literal, TypedDict
|
| 6 |
+
|
| 7 |
+
__all__ = ["RunListParams"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class RunListParams(TypedDict, total=False):
|
| 11 |
+
after: str
|
| 12 |
+
"""Identifier for the last run from the previous pagination request."""
|
| 13 |
+
|
| 14 |
+
limit: int
|
| 15 |
+
"""Number of runs to retrieve."""
|
| 16 |
+
|
| 17 |
+
order: Literal["asc", "desc"]
|
| 18 |
+
"""Sort order for runs by timestamp.
|
| 19 |
+
|
| 20 |
+
Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
status: Literal["queued", "in_progress", "completed", "canceled", "failed"]
|
| 24 |
+
"""Filter runs by status.
|
| 25 |
+
|
| 26 |
+
One of `queued` | `in_progress` | `failed` | `completed` | `canceled`.
|
| 27 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_list_response.py
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ..._utils import PropertyInfo
|
| 9 |
+
from ..._models import BaseModel
|
| 10 |
+
from .eval_api_error import EvalAPIError
|
| 11 |
+
from ..responses.tool import Tool
|
| 12 |
+
from ..shared.metadata import Metadata
|
| 13 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 14 |
+
from ..responses.response_input_text import ResponseInputText
|
| 15 |
+
from ..responses.response_input_audio import ResponseInputAudio
|
| 16 |
+
from .create_eval_jsonl_run_data_source import CreateEvalJSONLRunDataSource
|
| 17 |
+
from ..responses.response_format_text_config import ResponseFormatTextConfig
|
| 18 |
+
from .create_eval_completions_run_data_source import CreateEvalCompletionsRunDataSource
|
| 19 |
+
|
| 20 |
+
__all__ = [
|
| 21 |
+
"RunListResponse",
|
| 22 |
+
"DataSource",
|
| 23 |
+
"DataSourceResponses",
|
| 24 |
+
"DataSourceResponsesSource",
|
| 25 |
+
"DataSourceResponsesSourceFileContent",
|
| 26 |
+
"DataSourceResponsesSourceFileContentContent",
|
| 27 |
+
"DataSourceResponsesSourceFileID",
|
| 28 |
+
"DataSourceResponsesSourceResponses",
|
| 29 |
+
"DataSourceResponsesInputMessages",
|
| 30 |
+
"DataSourceResponsesInputMessagesTemplate",
|
| 31 |
+
"DataSourceResponsesInputMessagesTemplateTemplate",
|
| 32 |
+
"DataSourceResponsesInputMessagesTemplateTemplateChatMessage",
|
| 33 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItem",
|
| 34 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent",
|
| 35 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 36 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 37 |
+
"DataSourceResponsesInputMessagesItemReference",
|
| 38 |
+
"DataSourceResponsesSamplingParams",
|
| 39 |
+
"DataSourceResponsesSamplingParamsText",
|
| 40 |
+
"PerModelUsage",
|
| 41 |
+
"PerTestingCriteriaResult",
|
| 42 |
+
"ResultCounts",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class DataSourceResponsesSourceFileContentContent(BaseModel):
|
| 47 |
+
item: Dict[str, object]
|
| 48 |
+
|
| 49 |
+
sample: Optional[Dict[str, object]] = None
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class DataSourceResponsesSourceFileContent(BaseModel):
|
| 53 |
+
content: List[DataSourceResponsesSourceFileContentContent]
|
| 54 |
+
"""The content of the jsonl file."""
|
| 55 |
+
|
| 56 |
+
type: Literal["file_content"]
|
| 57 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class DataSourceResponsesSourceFileID(BaseModel):
|
| 61 |
+
id: str
|
| 62 |
+
"""The identifier of the file."""
|
| 63 |
+
|
| 64 |
+
type: Literal["file_id"]
|
| 65 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class DataSourceResponsesSourceResponses(BaseModel):
|
| 69 |
+
type: Literal["responses"]
|
| 70 |
+
"""The type of run data source. Always `responses`."""
|
| 71 |
+
|
| 72 |
+
created_after: Optional[int] = None
|
| 73 |
+
"""Only include items created after this timestamp (inclusive).
|
| 74 |
+
|
| 75 |
+
This is a query parameter used to select responses.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
created_before: Optional[int] = None
|
| 79 |
+
"""Only include items created before this timestamp (inclusive).
|
| 80 |
+
|
| 81 |
+
This is a query parameter used to select responses.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
instructions_search: Optional[str] = None
|
| 85 |
+
"""Optional string to search the 'instructions' field.
|
| 86 |
+
|
| 87 |
+
This is a query parameter used to select responses.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
metadata: Optional[object] = None
|
| 91 |
+
"""Metadata filter for the responses.
|
| 92 |
+
|
| 93 |
+
This is a query parameter used to select responses.
|
| 94 |
+
"""
|
| 95 |
+
|
| 96 |
+
model: Optional[str] = None
|
| 97 |
+
"""The name of the model to find responses for.
|
| 98 |
+
|
| 99 |
+
This is a query parameter used to select responses.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 103 |
+
"""
|
| 104 |
+
Constrains effort on reasoning for
|
| 105 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 106 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 107 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 108 |
+
response.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
temperature: Optional[float] = None
|
| 112 |
+
"""Sampling temperature. This is a query parameter used to select responses."""
|
| 113 |
+
|
| 114 |
+
tools: Optional[List[str]] = None
|
| 115 |
+
"""List of tool names. This is a query parameter used to select responses."""
|
| 116 |
+
|
| 117 |
+
top_p: Optional[float] = None
|
| 118 |
+
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
|
| 119 |
+
|
| 120 |
+
users: Optional[List[str]] = None
|
| 121 |
+
"""List of user identifiers. This is a query parameter used to select responses."""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
DataSourceResponsesSource: TypeAlias = Annotated[
|
| 125 |
+
Union[DataSourceResponsesSourceFileContent, DataSourceResponsesSourceFileID, DataSourceResponsesSourceResponses],
|
| 126 |
+
PropertyInfo(discriminator="type"),
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage(BaseModel):
|
| 131 |
+
content: str
|
| 132 |
+
"""The content of the message."""
|
| 133 |
+
|
| 134 |
+
role: str
|
| 135 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText(BaseModel):
|
| 139 |
+
text: str
|
| 140 |
+
"""The text output from the model."""
|
| 141 |
+
|
| 142 |
+
type: Literal["output_text"]
|
| 143 |
+
"""The type of the output text. Always `output_text`."""
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage(BaseModel):
|
| 147 |
+
image_url: str
|
| 148 |
+
"""The URL of the image input."""
|
| 149 |
+
|
| 150 |
+
type: Literal["input_image"]
|
| 151 |
+
"""The type of the image input. Always `input_image`."""
|
| 152 |
+
|
| 153 |
+
detail: Optional[str] = None
|
| 154 |
+
"""The detail level of the image to be sent to the model.
|
| 155 |
+
|
| 156 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 161 |
+
str,
|
| 162 |
+
ResponseInputText,
|
| 163 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 164 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 165 |
+
ResponseInputAudio,
|
| 166 |
+
List[object],
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem(BaseModel):
|
| 171 |
+
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent
|
| 172 |
+
"""Inputs to the model - can contain template strings."""
|
| 173 |
+
|
| 174 |
+
role: Literal["user", "assistant", "system", "developer"]
|
| 175 |
+
"""The role of the message input.
|
| 176 |
+
|
| 177 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
type: Optional[Literal["message"]] = None
|
| 181 |
+
"""The type of the message input. Always `message`."""
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
DataSourceResponsesInputMessagesTemplateTemplate: TypeAlias = Union[
|
| 185 |
+
DataSourceResponsesInputMessagesTemplateTemplateChatMessage,
|
| 186 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItem,
|
| 187 |
+
]
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class DataSourceResponsesInputMessagesTemplate(BaseModel):
|
| 191 |
+
template: List[DataSourceResponsesInputMessagesTemplateTemplate]
|
| 192 |
+
"""A list of chat messages forming the prompt or context.
|
| 193 |
+
|
| 194 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 195 |
+
"""
|
| 196 |
+
|
| 197 |
+
type: Literal["template"]
|
| 198 |
+
"""The type of input messages. Always `template`."""
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class DataSourceResponsesInputMessagesItemReference(BaseModel):
|
| 202 |
+
item_reference: str
|
| 203 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
|
| 204 |
+
|
| 205 |
+
type: Literal["item_reference"]
|
| 206 |
+
"""The type of input messages. Always `item_reference`."""
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
DataSourceResponsesInputMessages: TypeAlias = Annotated[
|
| 210 |
+
Union[DataSourceResponsesInputMessagesTemplate, DataSourceResponsesInputMessagesItemReference],
|
| 211 |
+
PropertyInfo(discriminator="type"),
|
| 212 |
+
]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class DataSourceResponsesSamplingParamsText(BaseModel):
|
| 216 |
+
format: Optional[ResponseFormatTextConfig] = None
|
| 217 |
+
"""An object specifying the format that the model must output.
|
| 218 |
+
|
| 219 |
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
| 220 |
+
ensures the model will match your supplied JSON schema. Learn more in the
|
| 221 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 222 |
+
|
| 223 |
+
The default format is `{ "type": "text" }` with no additional options.
|
| 224 |
+
|
| 225 |
+
**Not recommended for gpt-4o and newer models:**
|
| 226 |
+
|
| 227 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 228 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 229 |
+
preferred for models that support it.
|
| 230 |
+
"""
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class DataSourceResponsesSamplingParams(BaseModel):
|
| 234 |
+
max_completion_tokens: Optional[int] = None
|
| 235 |
+
"""The maximum number of tokens in the generated output."""
|
| 236 |
+
|
| 237 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 238 |
+
"""
|
| 239 |
+
Constrains effort on reasoning for
|
| 240 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 241 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 242 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 243 |
+
response.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
seed: Optional[int] = None
|
| 247 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 248 |
+
|
| 249 |
+
temperature: Optional[float] = None
|
| 250 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 251 |
+
|
| 252 |
+
text: Optional[DataSourceResponsesSamplingParamsText] = None
|
| 253 |
+
"""Configuration options for a text response from the model.
|
| 254 |
+
|
| 255 |
+
Can be plain text or structured JSON data. Learn more:
|
| 256 |
+
|
| 257 |
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
| 258 |
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
| 259 |
+
"""
|
| 260 |
+
|
| 261 |
+
tools: Optional[List[Tool]] = None
|
| 262 |
+
"""An array of tools the model may call while generating a response.
|
| 263 |
+
|
| 264 |
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
| 265 |
+
|
| 266 |
+
The two categories of tools you can provide the model are:
|
| 267 |
+
|
| 268 |
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
| 269 |
+
capabilities, like
|
| 270 |
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
| 271 |
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
| 272 |
+
Learn more about
|
| 273 |
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
| 274 |
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
| 275 |
+
the model to call your own code. Learn more about
|
| 276 |
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
top_p: Optional[float] = None
|
| 280 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class DataSourceResponses(BaseModel):
|
| 284 |
+
source: DataSourceResponsesSource
|
| 285 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 286 |
+
|
| 287 |
+
type: Literal["responses"]
|
| 288 |
+
"""The type of run data source. Always `responses`."""
|
| 289 |
+
|
| 290 |
+
input_messages: Optional[DataSourceResponsesInputMessages] = None
|
| 291 |
+
"""Used when sampling from a model.
|
| 292 |
+
|
| 293 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 294 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 295 |
+
with variable references to the `item` namespace.
|
| 296 |
+
"""
|
| 297 |
+
|
| 298 |
+
model: Optional[str] = None
|
| 299 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 300 |
+
|
| 301 |
+
sampling_params: Optional[DataSourceResponsesSamplingParams] = None
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
DataSource: TypeAlias = Annotated[
|
| 305 |
+
Union[CreateEvalJSONLRunDataSource, CreateEvalCompletionsRunDataSource, DataSourceResponses],
|
| 306 |
+
PropertyInfo(discriminator="type"),
|
| 307 |
+
]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class PerModelUsage(BaseModel):
|
| 311 |
+
cached_tokens: int
|
| 312 |
+
"""The number of tokens retrieved from cache."""
|
| 313 |
+
|
| 314 |
+
completion_tokens: int
|
| 315 |
+
"""The number of completion tokens generated."""
|
| 316 |
+
|
| 317 |
+
invocation_count: int
|
| 318 |
+
"""The number of invocations."""
|
| 319 |
+
|
| 320 |
+
run_model_name: str = FieldInfo(alias="model_name")
|
| 321 |
+
"""The name of the model."""
|
| 322 |
+
|
| 323 |
+
prompt_tokens: int
|
| 324 |
+
"""The number of prompt tokens used."""
|
| 325 |
+
|
| 326 |
+
total_tokens: int
|
| 327 |
+
"""The total number of tokens used."""
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
class PerTestingCriteriaResult(BaseModel):
|
| 331 |
+
failed: int
|
| 332 |
+
"""Number of tests failed for this criteria."""
|
| 333 |
+
|
| 334 |
+
passed: int
|
| 335 |
+
"""Number of tests passed for this criteria."""
|
| 336 |
+
|
| 337 |
+
testing_criteria: str
|
| 338 |
+
"""A description of the testing criteria."""
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class ResultCounts(BaseModel):
|
| 342 |
+
errored: int
|
| 343 |
+
"""Number of output items that resulted in an error."""
|
| 344 |
+
|
| 345 |
+
failed: int
|
| 346 |
+
"""Number of output items that failed to pass the evaluation."""
|
| 347 |
+
|
| 348 |
+
passed: int
|
| 349 |
+
"""Number of output items that passed the evaluation."""
|
| 350 |
+
|
| 351 |
+
total: int
|
| 352 |
+
"""Total number of executed output items."""
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class RunListResponse(BaseModel):
|
| 356 |
+
id: str
|
| 357 |
+
"""Unique identifier for the evaluation run."""
|
| 358 |
+
|
| 359 |
+
created_at: int
|
| 360 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 361 |
+
|
| 362 |
+
data_source: DataSource
|
| 363 |
+
"""Information about the run's data source."""
|
| 364 |
+
|
| 365 |
+
error: EvalAPIError
|
| 366 |
+
"""An object representing an error response from the Eval API."""
|
| 367 |
+
|
| 368 |
+
eval_id: str
|
| 369 |
+
"""The identifier of the associated evaluation."""
|
| 370 |
+
|
| 371 |
+
metadata: Optional[Metadata] = None
|
| 372 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 373 |
+
|
| 374 |
+
This can be useful for storing additional information about the object in a
|
| 375 |
+
structured format, and querying for objects via API or the dashboard.
|
| 376 |
+
|
| 377 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 378 |
+
a maximum length of 512 characters.
|
| 379 |
+
"""
|
| 380 |
+
|
| 381 |
+
model: str
|
| 382 |
+
"""The model that is evaluated, if applicable."""
|
| 383 |
+
|
| 384 |
+
name: str
|
| 385 |
+
"""The name of the evaluation run."""
|
| 386 |
+
|
| 387 |
+
object: Literal["eval.run"]
|
| 388 |
+
"""The type of the object. Always "eval.run"."""
|
| 389 |
+
|
| 390 |
+
per_model_usage: List[PerModelUsage]
|
| 391 |
+
"""Usage statistics for each model during the evaluation run."""
|
| 392 |
+
|
| 393 |
+
per_testing_criteria_results: List[PerTestingCriteriaResult]
|
| 394 |
+
"""Results per testing criteria applied during the evaluation run."""
|
| 395 |
+
|
| 396 |
+
report_url: str
|
| 397 |
+
"""The URL to the rendered evaluation run report on the UI dashboard."""
|
| 398 |
+
|
| 399 |
+
result_counts: ResultCounts
|
| 400 |
+
"""Counters summarizing the outcomes of the evaluation run."""
|
| 401 |
+
|
| 402 |
+
status: str
|
| 403 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/run_retrieve_response.py
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Dict, List, Union, Optional
|
| 4 |
+
from typing_extensions import Literal, Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ..._utils import PropertyInfo
|
| 9 |
+
from ..._models import BaseModel
|
| 10 |
+
from .eval_api_error import EvalAPIError
|
| 11 |
+
from ..responses.tool import Tool
|
| 12 |
+
from ..shared.metadata import Metadata
|
| 13 |
+
from ..shared.reasoning_effort import ReasoningEffort
|
| 14 |
+
from ..responses.response_input_text import ResponseInputText
|
| 15 |
+
from ..responses.response_input_audio import ResponseInputAudio
|
| 16 |
+
from .create_eval_jsonl_run_data_source import CreateEvalJSONLRunDataSource
|
| 17 |
+
from ..responses.response_format_text_config import ResponseFormatTextConfig
|
| 18 |
+
from .create_eval_completions_run_data_source import CreateEvalCompletionsRunDataSource
|
| 19 |
+
|
| 20 |
+
__all__ = [
|
| 21 |
+
"RunRetrieveResponse",
|
| 22 |
+
"DataSource",
|
| 23 |
+
"DataSourceResponses",
|
| 24 |
+
"DataSourceResponsesSource",
|
| 25 |
+
"DataSourceResponsesSourceFileContent",
|
| 26 |
+
"DataSourceResponsesSourceFileContentContent",
|
| 27 |
+
"DataSourceResponsesSourceFileID",
|
| 28 |
+
"DataSourceResponsesSourceResponses",
|
| 29 |
+
"DataSourceResponsesInputMessages",
|
| 30 |
+
"DataSourceResponsesInputMessagesTemplate",
|
| 31 |
+
"DataSourceResponsesInputMessagesTemplateTemplate",
|
| 32 |
+
"DataSourceResponsesInputMessagesTemplateTemplateChatMessage",
|
| 33 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItem",
|
| 34 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent",
|
| 35 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText",
|
| 36 |
+
"DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage",
|
| 37 |
+
"DataSourceResponsesInputMessagesItemReference",
|
| 38 |
+
"DataSourceResponsesSamplingParams",
|
| 39 |
+
"DataSourceResponsesSamplingParamsText",
|
| 40 |
+
"PerModelUsage",
|
| 41 |
+
"PerTestingCriteriaResult",
|
| 42 |
+
"ResultCounts",
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class DataSourceResponsesSourceFileContentContent(BaseModel):
|
| 47 |
+
item: Dict[str, object]
|
| 48 |
+
|
| 49 |
+
sample: Optional[Dict[str, object]] = None
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class DataSourceResponsesSourceFileContent(BaseModel):
|
| 53 |
+
content: List[DataSourceResponsesSourceFileContentContent]
|
| 54 |
+
"""The content of the jsonl file."""
|
| 55 |
+
|
| 56 |
+
type: Literal["file_content"]
|
| 57 |
+
"""The type of jsonl source. Always `file_content`."""
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
class DataSourceResponsesSourceFileID(BaseModel):
|
| 61 |
+
id: str
|
| 62 |
+
"""The identifier of the file."""
|
| 63 |
+
|
| 64 |
+
type: Literal["file_id"]
|
| 65 |
+
"""The type of jsonl source. Always `file_id`."""
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
class DataSourceResponsesSourceResponses(BaseModel):
|
| 69 |
+
type: Literal["responses"]
|
| 70 |
+
"""The type of run data source. Always `responses`."""
|
| 71 |
+
|
| 72 |
+
created_after: Optional[int] = None
|
| 73 |
+
"""Only include items created after this timestamp (inclusive).
|
| 74 |
+
|
| 75 |
+
This is a query parameter used to select responses.
|
| 76 |
+
"""
|
| 77 |
+
|
| 78 |
+
created_before: Optional[int] = None
|
| 79 |
+
"""Only include items created before this timestamp (inclusive).
|
| 80 |
+
|
| 81 |
+
This is a query parameter used to select responses.
|
| 82 |
+
"""
|
| 83 |
+
|
| 84 |
+
instructions_search: Optional[str] = None
|
| 85 |
+
"""Optional string to search the 'instructions' field.
|
| 86 |
+
|
| 87 |
+
This is a query parameter used to select responses.
|
| 88 |
+
"""
|
| 89 |
+
|
| 90 |
+
metadata: Optional[object] = None
|
| 91 |
+
"""Metadata filter for the responses.
|
| 92 |
+
|
| 93 |
+
This is a query parameter used to select responses.
|
| 94 |
+
"""
|
| 95 |
+
|
| 96 |
+
model: Optional[str] = None
|
| 97 |
+
"""The name of the model to find responses for.
|
| 98 |
+
|
| 99 |
+
This is a query parameter used to select responses.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 103 |
+
"""
|
| 104 |
+
Constrains effort on reasoning for
|
| 105 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 106 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 107 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 108 |
+
response.
|
| 109 |
+
"""
|
| 110 |
+
|
| 111 |
+
temperature: Optional[float] = None
|
| 112 |
+
"""Sampling temperature. This is a query parameter used to select responses."""
|
| 113 |
+
|
| 114 |
+
tools: Optional[List[str]] = None
|
| 115 |
+
"""List of tool names. This is a query parameter used to select responses."""
|
| 116 |
+
|
| 117 |
+
top_p: Optional[float] = None
|
| 118 |
+
"""Nucleus sampling parameter. This is a query parameter used to select responses."""
|
| 119 |
+
|
| 120 |
+
users: Optional[List[str]] = None
|
| 121 |
+
"""List of user identifiers. This is a query parameter used to select responses."""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
DataSourceResponsesSource: TypeAlias = Annotated[
|
| 125 |
+
Union[DataSourceResponsesSourceFileContent, DataSourceResponsesSourceFileID, DataSourceResponsesSourceResponses],
|
| 126 |
+
PropertyInfo(discriminator="type"),
|
| 127 |
+
]
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class DataSourceResponsesInputMessagesTemplateTemplateChatMessage(BaseModel):
|
| 131 |
+
content: str
|
| 132 |
+
"""The content of the message."""
|
| 133 |
+
|
| 134 |
+
role: str
|
| 135 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText(BaseModel):
|
| 139 |
+
text: str
|
| 140 |
+
"""The text output from the model."""
|
| 141 |
+
|
| 142 |
+
type: Literal["output_text"]
|
| 143 |
+
"""The type of the output text. Always `output_text`."""
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage(BaseModel):
|
| 147 |
+
image_url: str
|
| 148 |
+
"""The URL of the image input."""
|
| 149 |
+
|
| 150 |
+
type: Literal["input_image"]
|
| 151 |
+
"""The type of the image input. Always `input_image`."""
|
| 152 |
+
|
| 153 |
+
detail: Optional[str] = None
|
| 154 |
+
"""The detail level of the image to be sent to the model.
|
| 155 |
+
|
| 156 |
+
One of `high`, `low`, or `auto`. Defaults to `auto`.
|
| 157 |
+
"""
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent: TypeAlias = Union[
|
| 161 |
+
str,
|
| 162 |
+
ResponseInputText,
|
| 163 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentOutputText,
|
| 164 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItemContentInputImage,
|
| 165 |
+
ResponseInputAudio,
|
| 166 |
+
List[object],
|
| 167 |
+
]
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
class DataSourceResponsesInputMessagesTemplateTemplateEvalItem(BaseModel):
|
| 171 |
+
content: DataSourceResponsesInputMessagesTemplateTemplateEvalItemContent
|
| 172 |
+
"""Inputs to the model - can contain template strings."""
|
| 173 |
+
|
| 174 |
+
role: Literal["user", "assistant", "system", "developer"]
|
| 175 |
+
"""The role of the message input.
|
| 176 |
+
|
| 177 |
+
One of `user`, `assistant`, `system`, or `developer`.
|
| 178 |
+
"""
|
| 179 |
+
|
| 180 |
+
type: Optional[Literal["message"]] = None
|
| 181 |
+
"""The type of the message input. Always `message`."""
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
DataSourceResponsesInputMessagesTemplateTemplate: TypeAlias = Union[
|
| 185 |
+
DataSourceResponsesInputMessagesTemplateTemplateChatMessage,
|
| 186 |
+
DataSourceResponsesInputMessagesTemplateTemplateEvalItem,
|
| 187 |
+
]
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class DataSourceResponsesInputMessagesTemplate(BaseModel):
|
| 191 |
+
template: List[DataSourceResponsesInputMessagesTemplateTemplate]
|
| 192 |
+
"""A list of chat messages forming the prompt or context.
|
| 193 |
+
|
| 194 |
+
May include variable references to the `item` namespace, ie {{item.name}}.
|
| 195 |
+
"""
|
| 196 |
+
|
| 197 |
+
type: Literal["template"]
|
| 198 |
+
"""The type of input messages. Always `template`."""
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class DataSourceResponsesInputMessagesItemReference(BaseModel):
|
| 202 |
+
item_reference: str
|
| 203 |
+
"""A reference to a variable in the `item` namespace. Ie, "item.name" """
|
| 204 |
+
|
| 205 |
+
type: Literal["item_reference"]
|
| 206 |
+
"""The type of input messages. Always `item_reference`."""
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
DataSourceResponsesInputMessages: TypeAlias = Annotated[
|
| 210 |
+
Union[DataSourceResponsesInputMessagesTemplate, DataSourceResponsesInputMessagesItemReference],
|
| 211 |
+
PropertyInfo(discriminator="type"),
|
| 212 |
+
]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
class DataSourceResponsesSamplingParamsText(BaseModel):
|
| 216 |
+
format: Optional[ResponseFormatTextConfig] = None
|
| 217 |
+
"""An object specifying the format that the model must output.
|
| 218 |
+
|
| 219 |
+
Configuring `{ "type": "json_schema" }` enables Structured Outputs, which
|
| 220 |
+
ensures the model will match your supplied JSON schema. Learn more in the
|
| 221 |
+
[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
| 222 |
+
|
| 223 |
+
The default format is `{ "type": "text" }` with no additional options.
|
| 224 |
+
|
| 225 |
+
**Not recommended for gpt-4o and newer models:**
|
| 226 |
+
|
| 227 |
+
Setting to `{ "type": "json_object" }` enables the older JSON mode, which
|
| 228 |
+
ensures the message the model generates is valid JSON. Using `json_schema` is
|
| 229 |
+
preferred for models that support it.
|
| 230 |
+
"""
|
| 231 |
+
|
| 232 |
+
|
| 233 |
+
class DataSourceResponsesSamplingParams(BaseModel):
|
| 234 |
+
max_completion_tokens: Optional[int] = None
|
| 235 |
+
"""The maximum number of tokens in the generated output."""
|
| 236 |
+
|
| 237 |
+
reasoning_effort: Optional[ReasoningEffort] = None
|
| 238 |
+
"""
|
| 239 |
+
Constrains effort on reasoning for
|
| 240 |
+
[reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
| 241 |
+
supported values are `minimal`, `low`, `medium`, and `high`. Reducing reasoning
|
| 242 |
+
effort can result in faster responses and fewer tokens used on reasoning in a
|
| 243 |
+
response.
|
| 244 |
+
"""
|
| 245 |
+
|
| 246 |
+
seed: Optional[int] = None
|
| 247 |
+
"""A seed value to initialize the randomness, during sampling."""
|
| 248 |
+
|
| 249 |
+
temperature: Optional[float] = None
|
| 250 |
+
"""A higher temperature increases randomness in the outputs."""
|
| 251 |
+
|
| 252 |
+
text: Optional[DataSourceResponsesSamplingParamsText] = None
|
| 253 |
+
"""Configuration options for a text response from the model.
|
| 254 |
+
|
| 255 |
+
Can be plain text or structured JSON data. Learn more:
|
| 256 |
+
|
| 257 |
+
- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)
|
| 258 |
+
- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)
|
| 259 |
+
"""
|
| 260 |
+
|
| 261 |
+
tools: Optional[List[Tool]] = None
|
| 262 |
+
"""An array of tools the model may call while generating a response.
|
| 263 |
+
|
| 264 |
+
You can specify which tool to use by setting the `tool_choice` parameter.
|
| 265 |
+
|
| 266 |
+
The two categories of tools you can provide the model are:
|
| 267 |
+
|
| 268 |
+
- **Built-in tools**: Tools that are provided by OpenAI that extend the model's
|
| 269 |
+
capabilities, like
|
| 270 |
+
[web search](https://platform.openai.com/docs/guides/tools-web-search) or
|
| 271 |
+
[file search](https://platform.openai.com/docs/guides/tools-file-search).
|
| 272 |
+
Learn more about
|
| 273 |
+
[built-in tools](https://platform.openai.com/docs/guides/tools).
|
| 274 |
+
- **Function calls (custom tools)**: Functions that are defined by you, enabling
|
| 275 |
+
the model to call your own code. Learn more about
|
| 276 |
+
[function calling](https://platform.openai.com/docs/guides/function-calling).
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
top_p: Optional[float] = None
|
| 280 |
+
"""An alternative to temperature for nucleus sampling; 1.0 includes all tokens."""
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
class DataSourceResponses(BaseModel):
|
| 284 |
+
source: DataSourceResponsesSource
|
| 285 |
+
"""Determines what populates the `item` namespace in this run's data source."""
|
| 286 |
+
|
| 287 |
+
type: Literal["responses"]
|
| 288 |
+
"""The type of run data source. Always `responses`."""
|
| 289 |
+
|
| 290 |
+
input_messages: Optional[DataSourceResponsesInputMessages] = None
|
| 291 |
+
"""Used when sampling from a model.
|
| 292 |
+
|
| 293 |
+
Dictates the structure of the messages passed into the model. Can either be a
|
| 294 |
+
reference to a prebuilt trajectory (ie, `item.input_trajectory`), or a template
|
| 295 |
+
with variable references to the `item` namespace.
|
| 296 |
+
"""
|
| 297 |
+
|
| 298 |
+
model: Optional[str] = None
|
| 299 |
+
"""The name of the model to use for generating completions (e.g. "o3-mini")."""
|
| 300 |
+
|
| 301 |
+
sampling_params: Optional[DataSourceResponsesSamplingParams] = None
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
DataSource: TypeAlias = Annotated[
|
| 305 |
+
Union[CreateEvalJSONLRunDataSource, CreateEvalCompletionsRunDataSource, DataSourceResponses],
|
| 306 |
+
PropertyInfo(discriminator="type"),
|
| 307 |
+
]
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class PerModelUsage(BaseModel):
|
| 311 |
+
cached_tokens: int
|
| 312 |
+
"""The number of tokens retrieved from cache."""
|
| 313 |
+
|
| 314 |
+
completion_tokens: int
|
| 315 |
+
"""The number of completion tokens generated."""
|
| 316 |
+
|
| 317 |
+
invocation_count: int
|
| 318 |
+
"""The number of invocations."""
|
| 319 |
+
|
| 320 |
+
run_model_name: str = FieldInfo(alias="model_name")
|
| 321 |
+
"""The name of the model."""
|
| 322 |
+
|
| 323 |
+
prompt_tokens: int
|
| 324 |
+
"""The number of prompt tokens used."""
|
| 325 |
+
|
| 326 |
+
total_tokens: int
|
| 327 |
+
"""The total number of tokens used."""
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
class PerTestingCriteriaResult(BaseModel):
|
| 331 |
+
failed: int
|
| 332 |
+
"""Number of tests failed for this criteria."""
|
| 333 |
+
|
| 334 |
+
passed: int
|
| 335 |
+
"""Number of tests passed for this criteria."""
|
| 336 |
+
|
| 337 |
+
testing_criteria: str
|
| 338 |
+
"""A description of the testing criteria."""
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
class ResultCounts(BaseModel):
|
| 342 |
+
errored: int
|
| 343 |
+
"""Number of output items that resulted in an error."""
|
| 344 |
+
|
| 345 |
+
failed: int
|
| 346 |
+
"""Number of output items that failed to pass the evaluation."""
|
| 347 |
+
|
| 348 |
+
passed: int
|
| 349 |
+
"""Number of output items that passed the evaluation."""
|
| 350 |
+
|
| 351 |
+
total: int
|
| 352 |
+
"""Total number of executed output items."""
|
| 353 |
+
|
| 354 |
+
|
| 355 |
+
class RunRetrieveResponse(BaseModel):
|
| 356 |
+
id: str
|
| 357 |
+
"""Unique identifier for the evaluation run."""
|
| 358 |
+
|
| 359 |
+
created_at: int
|
| 360 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 361 |
+
|
| 362 |
+
data_source: DataSource
|
| 363 |
+
"""Information about the run's data source."""
|
| 364 |
+
|
| 365 |
+
error: EvalAPIError
|
| 366 |
+
"""An object representing an error response from the Eval API."""
|
| 367 |
+
|
| 368 |
+
eval_id: str
|
| 369 |
+
"""The identifier of the associated evaluation."""
|
| 370 |
+
|
| 371 |
+
metadata: Optional[Metadata] = None
|
| 372 |
+
"""Set of 16 key-value pairs that can be attached to an object.
|
| 373 |
+
|
| 374 |
+
This can be useful for storing additional information about the object in a
|
| 375 |
+
structured format, and querying for objects via API or the dashboard.
|
| 376 |
+
|
| 377 |
+
Keys are strings with a maximum length of 64 characters. Values are strings with
|
| 378 |
+
a maximum length of 512 characters.
|
| 379 |
+
"""
|
| 380 |
+
|
| 381 |
+
model: str
|
| 382 |
+
"""The model that is evaluated, if applicable."""
|
| 383 |
+
|
| 384 |
+
name: str
|
| 385 |
+
"""The name of the evaluation run."""
|
| 386 |
+
|
| 387 |
+
object: Literal["eval.run"]
|
| 388 |
+
"""The type of the object. Always "eval.run"."""
|
| 389 |
+
|
| 390 |
+
per_model_usage: List[PerModelUsage]
|
| 391 |
+
"""Usage statistics for each model during the evaluation run."""
|
| 392 |
+
|
| 393 |
+
per_testing_criteria_results: List[PerTestingCriteriaResult]
|
| 394 |
+
"""Results per testing criteria applied during the evaluation run."""
|
| 395 |
+
|
| 396 |
+
report_url: str
|
| 397 |
+
"""The URL to the rendered evaluation run report on the UI dashboard."""
|
| 398 |
+
|
| 399 |
+
result_counts: ResultCounts
|
| 400 |
+
"""Counters summarizing the outcomes of the evaluation run."""
|
| 401 |
+
|
| 402 |
+
status: str
|
| 403 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/runs/__init__.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .output_item_list_params import OutputItemListParams as OutputItemListParams
|
| 6 |
+
from .output_item_list_response import OutputItemListResponse as OutputItemListResponse
|
| 7 |
+
from .output_item_retrieve_response import OutputItemRetrieveResponse as OutputItemRetrieveResponse
|
.venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_list_params.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing_extensions import Literal, Required, TypedDict
|
| 6 |
+
|
| 7 |
+
__all__ = ["OutputItemListParams"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class OutputItemListParams(TypedDict, total=False):
|
| 11 |
+
eval_id: Required[str]
|
| 12 |
+
|
| 13 |
+
after: str
|
| 14 |
+
"""Identifier for the last output item from the previous pagination request."""
|
| 15 |
+
|
| 16 |
+
limit: int
|
| 17 |
+
"""Number of output items to retrieve."""
|
| 18 |
+
|
| 19 |
+
order: Literal["asc", "desc"]
|
| 20 |
+
"""Sort order for output items by timestamp.
|
| 21 |
+
|
| 22 |
+
Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
status: Literal["fail", "pass"]
|
| 26 |
+
"""Filter output items by status.
|
| 27 |
+
|
| 28 |
+
Use `failed` to filter by failed output items or `pass` to filter by passed
|
| 29 |
+
output items.
|
| 30 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_list_response.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Dict, List, Optional
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ...._models import BaseModel
|
| 9 |
+
from ..eval_api_error import EvalAPIError
|
| 10 |
+
|
| 11 |
+
__all__ = ["OutputItemListResponse", "Result", "Sample", "SampleInput", "SampleOutput", "SampleUsage"]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class Result(BaseModel):
|
| 15 |
+
name: str
|
| 16 |
+
"""The name of the grader."""
|
| 17 |
+
|
| 18 |
+
passed: bool
|
| 19 |
+
"""Whether the grader considered the output a pass."""
|
| 20 |
+
|
| 21 |
+
score: float
|
| 22 |
+
"""The numeric score produced by the grader."""
|
| 23 |
+
|
| 24 |
+
sample: Optional[Dict[str, object]] = None
|
| 25 |
+
"""Optional sample or intermediate data produced by the grader."""
|
| 26 |
+
|
| 27 |
+
type: Optional[str] = None
|
| 28 |
+
"""The grader type (for example, "string-check-grader")."""
|
| 29 |
+
|
| 30 |
+
if TYPE_CHECKING:
|
| 31 |
+
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
| 32 |
+
# value to this field, so for compatibility we avoid doing it at runtime.
|
| 33 |
+
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
| 34 |
+
|
| 35 |
+
# Stub to indicate that arbitrary properties are accepted.
|
| 36 |
+
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
| 37 |
+
# `getattr(obj, '$type')`
|
| 38 |
+
def __getattr__(self, attr: str) -> object: ...
|
| 39 |
+
else:
|
| 40 |
+
__pydantic_extra__: Dict[str, object]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class SampleInput(BaseModel):
|
| 44 |
+
content: str
|
| 45 |
+
"""The content of the message."""
|
| 46 |
+
|
| 47 |
+
role: str
|
| 48 |
+
"""The role of the message sender (e.g., system, user, developer)."""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class SampleOutput(BaseModel):
|
| 52 |
+
content: Optional[str] = None
|
| 53 |
+
"""The content of the message."""
|
| 54 |
+
|
| 55 |
+
role: Optional[str] = None
|
| 56 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class SampleUsage(BaseModel):
|
| 60 |
+
cached_tokens: int
|
| 61 |
+
"""The number of tokens retrieved from cache."""
|
| 62 |
+
|
| 63 |
+
completion_tokens: int
|
| 64 |
+
"""The number of completion tokens generated."""
|
| 65 |
+
|
| 66 |
+
prompt_tokens: int
|
| 67 |
+
"""The number of prompt tokens used."""
|
| 68 |
+
|
| 69 |
+
total_tokens: int
|
| 70 |
+
"""The total number of tokens used."""
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class Sample(BaseModel):
|
| 74 |
+
error: EvalAPIError
|
| 75 |
+
"""An object representing an error response from the Eval API."""
|
| 76 |
+
|
| 77 |
+
finish_reason: str
|
| 78 |
+
"""The reason why the sample generation was finished."""
|
| 79 |
+
|
| 80 |
+
input: List[SampleInput]
|
| 81 |
+
"""An array of input messages."""
|
| 82 |
+
|
| 83 |
+
max_completion_tokens: int
|
| 84 |
+
"""The maximum number of tokens allowed for completion."""
|
| 85 |
+
|
| 86 |
+
model: str
|
| 87 |
+
"""The model used for generating the sample."""
|
| 88 |
+
|
| 89 |
+
output: List[SampleOutput]
|
| 90 |
+
"""An array of output messages."""
|
| 91 |
+
|
| 92 |
+
seed: int
|
| 93 |
+
"""The seed used for generating the sample."""
|
| 94 |
+
|
| 95 |
+
temperature: float
|
| 96 |
+
"""The sampling temperature used."""
|
| 97 |
+
|
| 98 |
+
top_p: float
|
| 99 |
+
"""The top_p value used for sampling."""
|
| 100 |
+
|
| 101 |
+
usage: SampleUsage
|
| 102 |
+
"""Token usage details for the sample."""
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class OutputItemListResponse(BaseModel):
|
| 106 |
+
id: str
|
| 107 |
+
"""Unique identifier for the evaluation run output item."""
|
| 108 |
+
|
| 109 |
+
created_at: int
|
| 110 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 111 |
+
|
| 112 |
+
datasource_item: Dict[str, object]
|
| 113 |
+
"""Details of the input data source item."""
|
| 114 |
+
|
| 115 |
+
datasource_item_id: int
|
| 116 |
+
"""The identifier for the data source item."""
|
| 117 |
+
|
| 118 |
+
eval_id: str
|
| 119 |
+
"""The identifier of the evaluation group."""
|
| 120 |
+
|
| 121 |
+
object: Literal["eval.run.output_item"]
|
| 122 |
+
"""The type of the object. Always "eval.run.output_item"."""
|
| 123 |
+
|
| 124 |
+
results: List[Result]
|
| 125 |
+
"""A list of grader results for this output item."""
|
| 126 |
+
|
| 127 |
+
run_id: str
|
| 128 |
+
"""The identifier of the evaluation run associated with this output item."""
|
| 129 |
+
|
| 130 |
+
sample: Sample
|
| 131 |
+
"""A sample containing the input and output of the evaluation run."""
|
| 132 |
+
|
| 133 |
+
status: str
|
| 134 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/evals/runs/output_item_retrieve_response.py
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Dict, List, Optional
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from pydantic import Field as FieldInfo
|
| 7 |
+
|
| 8 |
+
from ...._models import BaseModel
|
| 9 |
+
from ..eval_api_error import EvalAPIError
|
| 10 |
+
|
| 11 |
+
__all__ = ["OutputItemRetrieveResponse", "Result", "Sample", "SampleInput", "SampleOutput", "SampleUsage"]
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class Result(BaseModel):
|
| 15 |
+
name: str
|
| 16 |
+
"""The name of the grader."""
|
| 17 |
+
|
| 18 |
+
passed: bool
|
| 19 |
+
"""Whether the grader considered the output a pass."""
|
| 20 |
+
|
| 21 |
+
score: float
|
| 22 |
+
"""The numeric score produced by the grader."""
|
| 23 |
+
|
| 24 |
+
sample: Optional[Dict[str, object]] = None
|
| 25 |
+
"""Optional sample or intermediate data produced by the grader."""
|
| 26 |
+
|
| 27 |
+
type: Optional[str] = None
|
| 28 |
+
"""The grader type (for example, "string-check-grader")."""
|
| 29 |
+
|
| 30 |
+
if TYPE_CHECKING:
|
| 31 |
+
# Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a
|
| 32 |
+
# value to this field, so for compatibility we avoid doing it at runtime.
|
| 33 |
+
__pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride]
|
| 34 |
+
|
| 35 |
+
# Stub to indicate that arbitrary properties are accepted.
|
| 36 |
+
# To access properties that are not valid identifiers you can use `getattr`, e.g.
|
| 37 |
+
# `getattr(obj, '$type')`
|
| 38 |
+
def __getattr__(self, attr: str) -> object: ...
|
| 39 |
+
else:
|
| 40 |
+
__pydantic_extra__: Dict[str, object]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class SampleInput(BaseModel):
|
| 44 |
+
content: str
|
| 45 |
+
"""The content of the message."""
|
| 46 |
+
|
| 47 |
+
role: str
|
| 48 |
+
"""The role of the message sender (e.g., system, user, developer)."""
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class SampleOutput(BaseModel):
|
| 52 |
+
content: Optional[str] = None
|
| 53 |
+
"""The content of the message."""
|
| 54 |
+
|
| 55 |
+
role: Optional[str] = None
|
| 56 |
+
"""The role of the message (e.g. "system", "assistant", "user")."""
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class SampleUsage(BaseModel):
|
| 60 |
+
cached_tokens: int
|
| 61 |
+
"""The number of tokens retrieved from cache."""
|
| 62 |
+
|
| 63 |
+
completion_tokens: int
|
| 64 |
+
"""The number of completion tokens generated."""
|
| 65 |
+
|
| 66 |
+
prompt_tokens: int
|
| 67 |
+
"""The number of prompt tokens used."""
|
| 68 |
+
|
| 69 |
+
total_tokens: int
|
| 70 |
+
"""The total number of tokens used."""
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class Sample(BaseModel):
|
| 74 |
+
error: EvalAPIError
|
| 75 |
+
"""An object representing an error response from the Eval API."""
|
| 76 |
+
|
| 77 |
+
finish_reason: str
|
| 78 |
+
"""The reason why the sample generation was finished."""
|
| 79 |
+
|
| 80 |
+
input: List[SampleInput]
|
| 81 |
+
"""An array of input messages."""
|
| 82 |
+
|
| 83 |
+
max_completion_tokens: int
|
| 84 |
+
"""The maximum number of tokens allowed for completion."""
|
| 85 |
+
|
| 86 |
+
model: str
|
| 87 |
+
"""The model used for generating the sample."""
|
| 88 |
+
|
| 89 |
+
output: List[SampleOutput]
|
| 90 |
+
"""An array of output messages."""
|
| 91 |
+
|
| 92 |
+
seed: int
|
| 93 |
+
"""The seed used for generating the sample."""
|
| 94 |
+
|
| 95 |
+
temperature: float
|
| 96 |
+
"""The sampling temperature used."""
|
| 97 |
+
|
| 98 |
+
top_p: float
|
| 99 |
+
"""The top_p value used for sampling."""
|
| 100 |
+
|
| 101 |
+
usage: SampleUsage
|
| 102 |
+
"""Token usage details for the sample."""
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
class OutputItemRetrieveResponse(BaseModel):
|
| 106 |
+
id: str
|
| 107 |
+
"""Unique identifier for the evaluation run output item."""
|
| 108 |
+
|
| 109 |
+
created_at: int
|
| 110 |
+
"""Unix timestamp (in seconds) when the evaluation run was created."""
|
| 111 |
+
|
| 112 |
+
datasource_item: Dict[str, object]
|
| 113 |
+
"""Details of the input data source item."""
|
| 114 |
+
|
| 115 |
+
datasource_item_id: int
|
| 116 |
+
"""The identifier for the data source item."""
|
| 117 |
+
|
| 118 |
+
eval_id: str
|
| 119 |
+
"""The identifier of the evaluation group."""
|
| 120 |
+
|
| 121 |
+
object: Literal["eval.run.output_item"]
|
| 122 |
+
"""The type of the object. Always "eval.run.output_item"."""
|
| 123 |
+
|
| 124 |
+
results: List[Result]
|
| 125 |
+
"""A list of grader results for this output item."""
|
| 126 |
+
|
| 127 |
+
run_id: str
|
| 128 |
+
"""The identifier of the evaluation run associated with this output item."""
|
| 129 |
+
|
| 130 |
+
sample: Sample
|
| 131 |
+
"""A sample containing the input and output of the evaluation run."""
|
| 132 |
+
|
| 133 |
+
status: str
|
| 134 |
+
"""The status of the evaluation run."""
|
.venv/lib/python3.13/site-packages/openai/types/file_chunking_strategy.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Union
|
| 4 |
+
from typing_extensions import Annotated, TypeAlias
|
| 5 |
+
|
| 6 |
+
from .._utils import PropertyInfo
|
| 7 |
+
from .other_file_chunking_strategy_object import OtherFileChunkingStrategyObject
|
| 8 |
+
from .static_file_chunking_strategy_object import StaticFileChunkingStrategyObject
|
| 9 |
+
|
| 10 |
+
__all__ = ["FileChunkingStrategy"]
|
| 11 |
+
|
| 12 |
+
FileChunkingStrategy: TypeAlias = Annotated[
|
| 13 |
+
Union[StaticFileChunkingStrategyObject, OtherFileChunkingStrategyObject], PropertyInfo(discriminator="type")
|
| 14 |
+
]
|
.venv/lib/python3.13/site-packages/openai/types/file_chunking_strategy_param.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Union
|
| 6 |
+
from typing_extensions import TypeAlias
|
| 7 |
+
|
| 8 |
+
from .auto_file_chunking_strategy_param import AutoFileChunkingStrategyParam
|
| 9 |
+
from .static_file_chunking_strategy_object_param import StaticFileChunkingStrategyObjectParam
|
| 10 |
+
|
| 11 |
+
__all__ = ["FileChunkingStrategyParam"]
|
| 12 |
+
|
| 13 |
+
FileChunkingStrategyParam: TypeAlias = Union[AutoFileChunkingStrategyParam, StaticFileChunkingStrategyObjectParam]
|
.venv/lib/python3.13/site-packages/openai/types/file_content.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing_extensions import TypeAlias
|
| 4 |
+
|
| 5 |
+
__all__ = ["FileContent"]
|
| 6 |
+
|
| 7 |
+
FileContent: TypeAlias = str
|
.venv/lib/python3.13/site-packages/openai/types/file_create_params.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing_extensions import Literal, Required, TypedDict
|
| 6 |
+
|
| 7 |
+
from .._types import FileTypes
|
| 8 |
+
from .file_purpose import FilePurpose
|
| 9 |
+
|
| 10 |
+
__all__ = ["FileCreateParams", "ExpiresAfter"]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class FileCreateParams(TypedDict, total=False):
|
| 14 |
+
file: Required[FileTypes]
|
| 15 |
+
"""The File object (not file name) to be uploaded."""
|
| 16 |
+
|
| 17 |
+
purpose: Required[FilePurpose]
|
| 18 |
+
"""The intended purpose of the uploaded file.
|
| 19 |
+
|
| 20 |
+
One of: - `assistants`: Used in the Assistants API - `batch`: Used in the Batch
|
| 21 |
+
API - `fine-tune`: Used for fine-tuning - `vision`: Images used for vision
|
| 22 |
+
fine-tuning - `user_data`: Flexible file type for any purpose - `evals`: Used
|
| 23 |
+
for eval data sets
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
expires_after: ExpiresAfter
|
| 27 |
+
"""The expiration policy for a file.
|
| 28 |
+
|
| 29 |
+
By default, files with `purpose=batch` expire after 30 days and all other files
|
| 30 |
+
are persisted until they are manually deleted.
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class ExpiresAfter(TypedDict, total=False):
|
| 35 |
+
anchor: Required[Literal["created_at"]]
|
| 36 |
+
"""Anchor timestamp after which the expiration policy applies.
|
| 37 |
+
|
| 38 |
+
Supported anchors: `created_at`.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
seconds: Required[int]
|
| 42 |
+
"""The number of seconds after the anchor time that the file will expire.
|
| 43 |
+
|
| 44 |
+
Must be between 3600 (1 hour) and 2592000 (30 days).
|
| 45 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/file_deleted.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing_extensions import Literal
|
| 4 |
+
|
| 5 |
+
from .._models import BaseModel
|
| 6 |
+
|
| 7 |
+
__all__ = ["FileDeleted"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class FileDeleted(BaseModel):
|
| 11 |
+
id: str
|
| 12 |
+
|
| 13 |
+
deleted: bool
|
| 14 |
+
|
| 15 |
+
object: Literal["file"]
|
.venv/lib/python3.13/site-packages/openai/types/file_list_params.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing_extensions import Literal, TypedDict
|
| 6 |
+
|
| 7 |
+
__all__ = ["FileListParams"]
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class FileListParams(TypedDict, total=False):
|
| 11 |
+
after: str
|
| 12 |
+
"""A cursor for use in pagination.
|
| 13 |
+
|
| 14 |
+
`after` is an object ID that defines your place in the list. For instance, if
|
| 15 |
+
you make a list request and receive 100 objects, ending with obj_foo, your
|
| 16 |
+
subsequent call can include after=obj_foo in order to fetch the next page of the
|
| 17 |
+
list.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
limit: int
|
| 21 |
+
"""A limit on the number of objects to be returned.
|
| 22 |
+
|
| 23 |
+
Limit can range between 1 and 10,000, and the default is 10,000.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
order: Literal["asc", "desc"]
|
| 27 |
+
"""Sort order by the `created_at` timestamp of the objects.
|
| 28 |
+
|
| 29 |
+
`asc` for ascending order and `desc` for descending order.
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
purpose: str
|
| 33 |
+
"""Only return files with the given purpose."""
|
.venv/lib/python3.13/site-packages/openai/types/file_object.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing import Optional
|
| 4 |
+
from typing_extensions import Literal
|
| 5 |
+
|
| 6 |
+
from .._models import BaseModel
|
| 7 |
+
|
| 8 |
+
__all__ = ["FileObject"]
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class FileObject(BaseModel):
|
| 12 |
+
id: str
|
| 13 |
+
"""The file identifier, which can be referenced in the API endpoints."""
|
| 14 |
+
|
| 15 |
+
bytes: int
|
| 16 |
+
"""The size of the file, in bytes."""
|
| 17 |
+
|
| 18 |
+
created_at: int
|
| 19 |
+
"""The Unix timestamp (in seconds) for when the file was created."""
|
| 20 |
+
|
| 21 |
+
filename: str
|
| 22 |
+
"""The name of the file."""
|
| 23 |
+
|
| 24 |
+
object: Literal["file"]
|
| 25 |
+
"""The object type, which is always `file`."""
|
| 26 |
+
|
| 27 |
+
purpose: Literal[
|
| 28 |
+
"assistants",
|
| 29 |
+
"assistants_output",
|
| 30 |
+
"batch",
|
| 31 |
+
"batch_output",
|
| 32 |
+
"fine-tune",
|
| 33 |
+
"fine-tune-results",
|
| 34 |
+
"vision",
|
| 35 |
+
"user_data",
|
| 36 |
+
]
|
| 37 |
+
"""The intended purpose of the file.
|
| 38 |
+
|
| 39 |
+
Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`,
|
| 40 |
+
`fine-tune`, `fine-tune-results`, `vision`, and `user_data`.
|
| 41 |
+
"""
|
| 42 |
+
|
| 43 |
+
status: Literal["uploaded", "processed", "error"]
|
| 44 |
+
"""Deprecated.
|
| 45 |
+
|
| 46 |
+
The current status of the file, which can be either `uploaded`, `processed`, or
|
| 47 |
+
`error`.
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
expires_at: Optional[int] = None
|
| 51 |
+
"""The Unix timestamp (in seconds) for when the file will expire."""
|
| 52 |
+
|
| 53 |
+
status_details: Optional[str] = None
|
| 54 |
+
"""Deprecated.
|
| 55 |
+
|
| 56 |
+
For details on why a fine-tuning training file failed validation, see the
|
| 57 |
+
`error` field on `fine_tuning.job`.
|
| 58 |
+
"""
|
.venv/lib/python3.13/site-packages/openai/types/file_purpose.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from typing_extensions import Literal, TypeAlias
|
| 4 |
+
|
| 5 |
+
__all__ = ["FilePurpose"]
|
| 6 |
+
|
| 7 |
+
FilePurpose: TypeAlias = Literal["assistants", "batch", "fine-tune", "vision", "user_data", "evals"]
|
.venv/lib/python3.13/site-packages/openai/types/fine_tuning/__init__.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .dpo_method import DpoMethod as DpoMethod
|
| 6 |
+
from .fine_tuning_job import FineTuningJob as FineTuningJob
|
| 7 |
+
from .job_list_params import JobListParams as JobListParams
|
| 8 |
+
from .dpo_method_param import DpoMethodParam as DpoMethodParam
|
| 9 |
+
from .job_create_params import JobCreateParams as JobCreateParams
|
| 10 |
+
from .supervised_method import SupervisedMethod as SupervisedMethod
|
| 11 |
+
from .dpo_hyperparameters import DpoHyperparameters as DpoHyperparameters
|
| 12 |
+
from .reinforcement_method import ReinforcementMethod as ReinforcementMethod
|
| 13 |
+
from .fine_tuning_job_event import FineTuningJobEvent as FineTuningJobEvent
|
| 14 |
+
from .job_list_events_params import JobListEventsParams as JobListEventsParams
|
| 15 |
+
from .supervised_method_param import SupervisedMethodParam as SupervisedMethodParam
|
| 16 |
+
from .dpo_hyperparameters_param import DpoHyperparametersParam as DpoHyperparametersParam
|
| 17 |
+
from .reinforcement_method_param import ReinforcementMethodParam as ReinforcementMethodParam
|
| 18 |
+
from .supervised_hyperparameters import SupervisedHyperparameters as SupervisedHyperparameters
|
| 19 |
+
from .fine_tuning_job_integration import FineTuningJobIntegration as FineTuningJobIntegration
|
| 20 |
+
from .reinforcement_hyperparameters import ReinforcementHyperparameters as ReinforcementHyperparameters
|
| 21 |
+
from .supervised_hyperparameters_param import SupervisedHyperparametersParam as SupervisedHyperparametersParam
|
| 22 |
+
from .fine_tuning_job_wandb_integration import FineTuningJobWandbIntegration as FineTuningJobWandbIntegration
|
| 23 |
+
from .reinforcement_hyperparameters_param import ReinforcementHyperparametersParam as ReinforcementHyperparametersParam
|
| 24 |
+
from .fine_tuning_job_wandb_integration_object import (
|
| 25 |
+
FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject,
|
| 26 |
+
)
|
.venv/lib/python3.13/site-packages/openai/types/fine_tuning/alpha/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from .grader_run_params import GraderRunParams as GraderRunParams
|
| 6 |
+
from .grader_run_response import GraderRunResponse as GraderRunResponse
|
| 7 |
+
from .grader_validate_params import GraderValidateParams as GraderValidateParams
|
| 8 |
+
from .grader_validate_response import GraderValidateResponse as GraderValidateResponse
|
.venv/lib/python3.13/site-packages/openai/types/fine_tuning/alpha/grader_run_params.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
from typing import Union
|
| 6 |
+
from typing_extensions import Required, TypeAlias, TypedDict
|
| 7 |
+
|
| 8 |
+
from ...graders.multi_grader_param import MultiGraderParam
|
| 9 |
+
from ...graders.python_grader_param import PythonGraderParam
|
| 10 |
+
from ...graders.score_model_grader_param import ScoreModelGraderParam
|
| 11 |
+
from ...graders.string_check_grader_param import StringCheckGraderParam
|
| 12 |
+
from ...graders.text_similarity_grader_param import TextSimilarityGraderParam
|
| 13 |
+
|
| 14 |
+
__all__ = ["GraderRunParams", "Grader"]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class GraderRunParams(TypedDict, total=False):
|
| 18 |
+
grader: Required[Grader]
|
| 19 |
+
"""The grader used for the fine-tuning job."""
|
| 20 |
+
|
| 21 |
+
model_sample: Required[str]
|
| 22 |
+
"""The model sample to be evaluated.
|
| 23 |
+
|
| 24 |
+
This value will be used to populate the `sample` namespace. See
|
| 25 |
+
[the guide](https://platform.openai.com/docs/guides/graders) for more details.
|
| 26 |
+
The `output_json` variable will be populated if the model sample is a valid JSON
|
| 27 |
+
string.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
item: object
|
| 31 |
+
"""The dataset item provided to the grader.
|
| 32 |
+
|
| 33 |
+
This will be used to populate the `item` namespace. See
|
| 34 |
+
[the guide](https://platform.openai.com/docs/guides/graders) for more details.
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
Grader: TypeAlias = Union[
|
| 39 |
+
StringCheckGraderParam, TextSimilarityGraderParam, PythonGraderParam, ScoreModelGraderParam, MultiGraderParam
|
| 40 |
+
]
|