From 9c9dc09ccb2fc63d31ffb598072457bf1ed52b5b Mon Sep 17 00:00:00 2001 From: markstuart-oai <323302876+markstuart-oai@users.noreply.github.com> Date: Mon, 30 Nov 2026 20:25:06 +0000 Subject: [PATCH] feat(api): deprecate Evals and saved prompt references Castiron-Internal-PR: https://github.com/openai/openai-python-internal/pull/463 Castiron-Source-SHA: a56df95c1ae7a57b57a4e6dc0f516771ae5ac7f3 Castiron-Public-Base-SHA: 782f5c76c345a1fcbffa647d6de243f77df99bfb --- .castiron.stats.yml | 12 +- api_reference/openapi.transformed.yml | 67 +- scripts/castiron/generated-files.json | 56 +- .../resources/beta/responses/responses.py | 30 +- src/openai/resources/evals/evals.py | 81 +- .../resources/evals/runs/output_items.py | 39 +- src/openai/resources/evals/runs/runs.py | 79 +- src/openai/resources/realtime/calls.py | 10 +- src/openai/resources/responses/responses.py | 30 +- src/openai/types/beta/beta_response.py | 8 +- src/openai/types/beta/beta_response_prompt.py | 8 +- .../types/beta/beta_response_prompt_param.py | 8 +- .../types/beta/beta_responses_client_event.py | 8 +- .../beta/beta_responses_client_event_param.py | 8 +- .../types/beta/response_create_params.py | 8 +- .../types/realtime/call_accept_params.py | 8 +- .../realtime_response_create_params.py | 8 +- .../realtime_response_create_params_param.py | 8 +- ...nse_create_params_with_references_param.py | 8 +- .../realtime_session_create_request.py | 8 +- .../realtime_session_create_request_param.py | 8 +- .../realtime_session_create_response.py | 8 +- src/openai/types/responses/response.py | 8 +- .../types/responses/response_create_params.py | 8 +- src/openai/types/responses/response_prompt.py | 8 +- .../types/responses/response_prompt_param.py | 8 +- .../types/responses/responses_client_event.py | 8 +- .../responses/responses_client_event_param.py | 8 +- .../evals/runs/test_output_items.py | 314 ++++---- tests/api_resources/evals/test_runs.py | 696 +++++++++-------- tests/api_resources/test_evals.py | 702 ++++++++++-------- 31 files changed, 1363 insertions(+), 905 deletions(-) diff --git a/.castiron.stats.yml b/.castiron.stats.yml index 4b8a4d7ba0..01e08cac35 100644 --- a/.castiron.stats.yml +++ b/.castiron.stats.yml @@ -1,7 +1,7 @@ schema_version: 1 -generation_id: 8defad98-453a-468b-8464-781e09fd2762 -openapi_spec_hash: bf74c2ea8d8af0a1b2420a9507ce4c86 -openapi_transformed_spec_hash: fd3d7f02692ebe761c69b0271e4c0335 -config_hash: 98b84a99474d4d011c1aaa92435f067a -codegen_sha: 72337d33ad3b239e57dd5963ff8e6223272acad4 -codegen_hash: 8ec58a11d0a9e1f5ac7c424a6b3371149dde4d3565d15aa6813c4bbb330adb8b +generation_id: e9941d21-1360-4441-acb7-35fcb6439809 +openapi_spec_hash: 6344d2a2a6ab50df7d02b921f345e91f +openapi_transformed_spec_hash: ad19fe297b0058807523edf890c052b5 +config_hash: a072a0df910fc0e910e6c914c16d88f7 +codegen_sha: 751bc5ae151ab7e69327362cc2edee5282e8628e +codegen_hash: 827ca96a36c6c2aa60cbe9171e384670aefe1270b2706f95b0974797b0c92080 diff --git a/api_reference/openapi.transformed.yml b/api_reference/openapi.transformed.yml index f66eab7448..cb80548fce 100644 --- a/api_reference/openapi.transformed.yml +++ b/api_reference/openapi.transformed.yml @@ -5066,12 +5066,16 @@ paths: } /evals: get: + deprecated: true operationId: listEvals tags: - Evals summary: List evals description: | List evaluations for a project. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: after in: query @@ -5213,6 +5217,7 @@ paths: "has_more": true } post: + deprecated: true operationId: createEval tags: - Evals @@ -5221,6 +5226,9 @@ paths: Create the structure of an evaluation that can be used to test a model's performance. An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources. For more information, see the [Evals guide](https://developers.openai.com/api/docs/guides/evals). + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). requestBody: required: true content: @@ -5402,12 +5410,16 @@ paths: } /evals/{eval_id}: get: + deprecated: true operationId: getEval tags: - Evals summary: Get an eval description: | Get an evaluation by ID. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -5497,12 +5509,16 @@ paths: "metadata": {} } post: + deprecated: true operationId: updateEval tags: - Evals summary: Update an eval description: | Update certain properties of an evaluation. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -5622,12 +5638,16 @@ paths: "metadata": {"description": "Updated description"} } delete: + deprecated: true operationId: deleteEval tags: - Evals summary: Delete an eval description: | Delete an evaluation. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -5699,12 +5719,16 @@ paths: } /evals/{eval_id}/runs: get: + deprecated: true operationId: getEvalRuns tags: - Evals summary: Get eval runs description: | Get a list of runs for an evaluation. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -5870,12 +5894,16 @@ paths: "has_more": true } post: + deprecated: true operationId: createEvalRun tags: - Evals summary: Create eval run description: | Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - in: path name: eval_id @@ -6071,12 +6099,16 @@ paths: } /evals/{eval_id}/runs/{run_id}: get: + deprecated: true operationId: getEvalRun tags: - Evals summary: Get an eval run description: | Get an evaluation run by ID. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -6284,12 +6316,16 @@ paths: "metadata": {} } delete: + deprecated: true operationId: deleteEvalRun tags: - Evals summary: Delete eval run description: | Delete an eval run. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -6371,12 +6407,16 @@ paths: } /evals/{eval_id}/runs/{run_id}/cancel: post: + deprecated: true operationId: cancelEvalRun tags: - Evals summary: Cancel eval run description: | Cancel an ongoing evaluation run. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -6574,12 +6614,16 @@ paths: } /evals/{eval_id}/runs/{run_id}/output_items: get: + deprecated: true operationId: getEvalRunOutputItems tags: - Evals summary: Get eval run output items description: | Get a list of output items for an evaluation run. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -6748,12 +6792,16 @@ paths: } /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}: get: + deprecated: true operationId: getEvalRunOutputItem tags: - Evals summary: Get an output item of an eval run description: | Get an evaluation run output item by ID. + + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). parameters: - name: eval_id in: path @@ -56042,7 +56090,10 @@ components: - type: object description: | Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. required: - id properties: @@ -56853,6 +56904,7 @@ components: metadata: $ref: '#/components/schemas/Metadata' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' input: type: array @@ -60108,6 +60160,7 @@ components: metadata: $ref: '#/components/schemas/Metadata' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' input: type: array @@ -60430,6 +60483,7 @@ components: metadata: $ref: '#/components/schemas/Metadata' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' input: type: array @@ -63132,6 +63186,7 @@ components: format: unixtime description: Expiration timestamp for the session, in seconds since epoch. prompt: + deprecated: true anyOf: - $ref: '#/components/schemas/Prompt' - type: 'null' @@ -63331,6 +63386,7 @@ components: truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' required: - client_secret @@ -63583,6 +63639,7 @@ components: truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' required: - type @@ -64013,6 +64070,7 @@ components: truncation: $ref: '#/components/schemas/RealtimeTruncation' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' required: - type @@ -67546,6 +67604,7 @@ components: tool_choice: $ref: '#/components/schemas/ToolChoiceParam' prompt: + deprecated: true $ref: '#/components/schemas/Prompt' ResponseQueuedEvent: type: object @@ -108556,13 +108615,17 @@ components: tool_choice: $ref: '#/components/schemas/BetaToolChoiceParam' prompt: + deprecated: true $ref: '#/components/schemas/BetaPrompt' BetaPrompt: anyOf: - type: object description: | Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. required: - id properties: diff --git a/scripts/castiron/generated-files.json b/scripts/castiron/generated-files.json index 60acd8527f..0cfc8abbb2 100644 --- a/scripts/castiron/generated-files.json +++ b/scripts/castiron/generated-files.json @@ -395,7 +395,7 @@ }, "src/openai/resources/beta/responses/responses.py": { "mode": "100644", - "sha256": "a2eee9db7ce07296026787e29ba0a5581237369bf048c4baad9b585e1595a8b3" + "sha256": "ee542c9cd3be63ed1dbb0f6e44e8b0e213b7a89d04d818689f80a45203cea836" }, "src/openai/resources/beta/threads/__init__.py": { "mode": "100644", @@ -499,7 +499,7 @@ }, "src/openai/resources/evals/evals.py": { "mode": "100644", - "sha256": "9b76a833be1ac7d6089ae391328ef7f9e9f1e0757e0e92e6a6c7f2ab807d950c" + "sha256": "4575233ed8c967aa87340694405a64d0395e0911e041e6dba40fa70513bd5539" }, "src/openai/resources/evals/runs/__init__.py": { "mode": "100644", @@ -507,11 +507,11 @@ }, "src/openai/resources/evals/runs/output_items.py": { "mode": "100644", - "sha256": "e4c6e5d021c03bb29e21a3529f9f920b2cdb3e8b5ac84f8a649e6498c2e94c2f" + "sha256": "25b6ed09c49e64862f5af3c9842480f748204655baf44720941ac0c4027691f0" }, "src/openai/resources/evals/runs/runs.py": { "mode": "100644", - "sha256": "603c16d692e9b7ef39daaa523b22dfd53949c5f2393191b057aedf695be1e54c" + "sha256": "bdabe3aa9aacec739f0ac83aaa4a5a932d7419f93da3a3cf5fa46c44ef3166c1" }, "src/openai/resources/files.py": { "mode": "100644", @@ -607,7 +607,7 @@ }, "src/openai/resources/realtime/calls.py": { "mode": "100644", - "sha256": "8160372345273d9483ecafd003a8c40e24119e50f83fc9e55e92dec4cc63a0fb" + "sha256": "708ab326ef1b075b0890f9a66960bbdccd41a9ee894dc7767b9c002ba587c40c" }, "src/openai/resources/realtime/client_secrets.py": { "mode": "100644", @@ -647,7 +647,7 @@ }, "src/openai/resources/responses/responses.py": { "mode": "100644", - "sha256": "93bf79b0582e191a4164901f841bbac82fc5fa2b7680ff81e1830c7b3d282dcd" + "sha256": "476ea6811a6bb1fb787529b3b940bda60af5c3e0b58da1dc5f75c1ec8797eb10" }, "src/openai/resources/safety/__init__.py": { "mode": "100644", @@ -2507,7 +2507,7 @@ }, "src/openai/types/beta/beta_response.py": { "mode": "100644", - "sha256": "51bd4ed5b3c1e3432c5871983a1a45a90ebc9296c3b55b3914dd0e05a0c7e69f" + "sha256": "e517dd57e69d2ffe95cf492112fae02cd2fbffa1e3a46be12bdcd8e0f626b70f" }, "src/openai/types/beta/beta_response_apply_patch_tool_call.py": { "mode": "100644", @@ -2991,11 +2991,11 @@ }, "src/openai/types/beta/beta_response_prompt.py": { "mode": "100644", - "sha256": "588d1f3121eaf35323f45a8851f2e516cf66939f65fe053231c69e5cbb42e529" + "sha256": "882c3fc4206a256bec3ce0ce7e1433f00c8cfa37e670b737bd7e7081205a3829" }, "src/openai/types/beta/beta_response_prompt_param.py": { "mode": "100644", - "sha256": "d56a103bd6f43dc75bde984e29fc618ab86a896fbb79c209be13d108764b8dcd" + "sha256": "df69e78cd4e451aa3cf138b14a0af3421a9be796eda9422f6559f8448455fe47" }, "src/openai/types/beta/beta_response_queued_event.py": { "mode": "100644", @@ -3167,11 +3167,11 @@ }, "src/openai/types/beta/beta_responses_client_event.py": { "mode": "100644", - "sha256": "bcce1698b1846e1eb507fbf425d5536cfbb05070c41d150c69e1476af390176d" + "sha256": "95d894ed1aa6cb3c1e2e270fbcafd91ae3b36c97beff049b8a43c3f4610b56b2" }, "src/openai/types/beta/beta_responses_client_event_param.py": { "mode": "100644", - "sha256": "b38aea416c568ab4446afff5a720b056faf188ceeb8e61819983b3f708462ba3" + "sha256": "0972e80b25d21f7d3405abc912921e0764e4e9721b3a48bf48c68d0c223529c3" }, "src/openai/types/beta/beta_responses_server_event.py": { "mode": "100644", @@ -3503,7 +3503,7 @@ }, "src/openai/types/beta/response_create_params.py": { "mode": "100644", - "sha256": "e892f8af42e4855bba831b36ddef83b7577cdfd5a47d246c7c663161ac420ede" + "sha256": "d75fe48bd95c301eaa7a70adc587782a3c8bc76a7a10548723d0cc08c79d1d1d" }, "src/openai/types/beta/response_retrieve_params.py": { "mode": "100644", @@ -5231,7 +5231,7 @@ }, "src/openai/types/realtime/call_accept_params.py": { "mode": "100644", - "sha256": "ca5a354965d8a8fcfb5ae0c6644752507085270f857542e24790895bfbe5acb9" + "sha256": "22e428d24436447cd1c8fcd93f519fa60c655667eac4060b9194044000997d2a" }, "src/openai/types/realtime/call_create_params.py": { "mode": "100644", @@ -5615,15 +5615,15 @@ }, "src/openai/types/realtime/realtime_response_create_params.py": { "mode": "100644", - "sha256": "79e29f32b8ee2735c2fdeb6fc89f4cb6edaa77ec94ab7e22ed743c3afc4a831e" + "sha256": "7101d3f93305959e863ded5c9f4e268c6fa49dda6bee40b5ef36e45a1d0a591f" }, "src/openai/types/realtime/realtime_response_create_params_param.py": { "mode": "100644", - "sha256": "8505e7ae557e06ce89fe7d5e1ab582c0f4a42b35c6c78e9faa8c4fe519b536d6" + "sha256": "31bb320ca75624ca676ddf015c5a220f1cbc52685ee0128f2b6557cc309886ba" }, "src/openai/types/realtime/realtime_response_create_params_with_references_param.py": { "mode": "100644", - "sha256": "47fd5f24ec33fb6059ff1c916208b3db17e5a67642af14f9ab80450255f3ca7c" + "sha256": "c2830db9cc6cf10cebab68364683d7b2af91f4b3fd53f8b34e8d45c52eafe26a" }, "src/openai/types/realtime/realtime_response_status.py": { "mode": "100644", @@ -5647,15 +5647,15 @@ }, "src/openai/types/realtime/realtime_session_create_request.py": { "mode": "100644", - "sha256": "9638e6e645ed0f9df54094dcc456ab90f69c39a06ff772e51b07fcdfb61b9ad1" + "sha256": "58925fa138c4556c8ded3b42543f6ec07d6e4b993a889560c384051933edf9e0" }, "src/openai/types/realtime/realtime_session_create_request_param.py": { "mode": "100644", - "sha256": "649222e828bee6965cb0a8e056d3df0e6c564051f30456f3a545002c954a3c31" + "sha256": "38c16c9555ae3ab3bc664c6dbd86af5948a049b694aba1b3de26d2dd99693007" }, "src/openai/types/realtime/realtime_session_create_response.py": { "mode": "100644", - "sha256": "48ef93b3e2ed55fed14b76f2e65ce81e8512bfab2fd03e1e733c9761bf6ef94e" + "sha256": "6d362e553a808eb67507a4ac641c13383fdbe95610d97519fa3118fbd9bcebe1" }, "src/openai/types/realtime/realtime_tool_choice_config.py": { "mode": "100644", @@ -6147,7 +6147,7 @@ }, "src/openai/types/responses/response.py": { "mode": "100644", - "sha256": "82236208e0cc3e5ba99a459cf687f25b40110be9cf1a1e997d70b5f94f36d4d3" + "sha256": "dd834cbcc1421480b316155ac7860ba2319f23c6f1d4005d7bd61cab8d7ca10a" }, "src/openai/types/responses/response_apply_patch_tool_call.py": { "mode": "100644", @@ -6279,7 +6279,7 @@ }, "src/openai/types/responses/response_create_params.py": { "mode": "100644", - "sha256": "245f990686bf3260231f7847ad9b30b73e6221bde152314be329caa4b98d75cf" + "sha256": "8fd5e10301027e0198997ac57d019223b107a88adb8d3a8023e7650c54554192" }, "src/openai/types/responses/response_created_event.py": { "mode": "100644", @@ -6635,11 +6635,11 @@ }, "src/openai/types/responses/response_prompt.py": { "mode": "100644", - "sha256": "addd57465ffa3715d280af822c16787aff1c908739af3f08ed5b3b0fe64f80d4" + "sha256": "a6a8eeba06b42828a07458022a11eb2ca425e13c8bf5b5ab933f5994863adf37" }, "src/openai/types/responses/response_prompt_param.py": { "mode": "100644", - "sha256": "ce15520af6f01924c7ea4be8f036a454c134abd587347da3fcc1d0cdcdfa7001" + "sha256": "3174507cf925370acde79d7a7e5e9f19cab868dd8534c4b7e1075c67cb926775" }, "src/openai/types/responses/response_queued_event.py": { "mode": "100644", @@ -6815,11 +6815,11 @@ }, "src/openai/types/responses/responses_client_event.py": { "mode": "100644", - "sha256": "716783a89ccd5c1eebfc12919e05141b30ea828c302981d9b421113cd1b3bbf6" + "sha256": "e5f970632ca92162bf516c1a955f16be395e797ca9261043697d01ccc1298dcd" }, "src/openai/types/responses/responses_client_event_param.py": { "mode": "100644", - "sha256": "0355facca5a8e3a7c54069e64bd3be1066086955f81d271a2596864f186470db" + "sha256": "325d97fcdee02b245fc57e5a1b1823a1150e8b8da091c3fb51d4b5d290d7d374" }, "src/openai/types/responses/responses_server_event.py": { "mode": "100644", @@ -7939,11 +7939,11 @@ }, "tests/api_resources/evals/runs/test_output_items.py": { "mode": "100644", - "sha256": "68e08a5df46bf3ba4aea27269ce474c5bc3ca06c71e287ad22660f07afa57fb3" + "sha256": "3a29317f4b85d3efbc0531e6a7dd62207e00fcaf43f0b7dd16bda142756462f2" }, "tests/api_resources/evals/test_runs.py": { "mode": "100644", - "sha256": "e5124de8f2b1fceff9cbe03b9f78fb5ba73448d389012d19a1229dedb3fc1d9d" + "sha256": "e914a6d7973da7d4e6c9984eb83446292fa0918a5fc12cb113c71271b62bad7d" }, "tests/api_resources/fine_tuning/__init__.py": { "mode": "100644", @@ -8091,7 +8091,7 @@ }, "tests/api_resources/test_evals.py": { "mode": "100644", - "sha256": "ef261c7348da19f1a584687cd56b8fcdf2773442542632645602584f62254b96" + "sha256": "8d07d4bbbdec6729026bf735e11e959384aaff72af36471184fc5d2523beeac0" }, "tests/api_resources/test_files.py": { "mode": "100644", diff --git a/src/openai/resources/beta/responses/responses.py b/src/openai/resources/beta/responses/responses.py index f269a61a32..81c12ea95f 100644 --- a/src/openai/resources/beta/responses/responses.py +++ b/src/openai/resources/beta/responses/responses.py @@ -466,7 +466,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -979,7 +982,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -1485,7 +1491,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -2881,7 +2890,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -3394,7 +3406,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -3900,7 +3915,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. diff --git a/src/openai/resources/evals/evals.py b/src/openai/resources/evals/evals.py index 94f43eb369..4da31c7f90 100644 --- a/src/openai/resources/evals/evals.py +++ b/src/openai/resources/evals/evals.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Iterable, Optional from typing_extensions import Literal @@ -61,6 +62,9 @@ def with_streaming_response(self) -> EvalsWithStreamingResponse: """ return EvalsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def create( self, *, @@ -83,6 +87,10 @@ def create( We support several types of graders and datasources. For more information, see the [Evals guide](https://developers.openai.com/api/docs/guides/evals). + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: data_source_config: The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation. @@ -129,6 +137,9 @@ def create( cast_to=EvalCreateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def retrieve( self, eval_id: str, @@ -143,6 +154,10 @@ def retrieve( """ Get an evaluation by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -166,6 +181,9 @@ def retrieve( cast_to=EvalRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def update( self, eval_id: str, @@ -182,6 +200,10 @@ def update( """ Update certain properties of an evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. @@ -220,6 +242,9 @@ def update( cast_to=EvalUpdateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, *, @@ -234,8 +259,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> SyncCursorPage[EvalListResponse]: - """ - List evaluations for a project. + """List evaluations for a project. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last eval from the previous pagination request. @@ -278,6 +308,9 @@ def list( model=EvalListResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def delete( self, eval_id: str, @@ -292,6 +325,10 @@ def delete( """ Delete an evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -343,6 +380,9 @@ def with_streaming_response(self) -> AsyncEvalsWithStreamingResponse: """ return AsyncEvalsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def create( self, *, @@ -365,6 +405,10 @@ async def create( We support several types of graders and datasources. For more information, see the [Evals guide](https://developers.openai.com/api/docs/guides/evals). + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: data_source_config: The configuration for the data source used for the evaluation runs. Dictates the schema of the data used in the evaluation. @@ -411,6 +455,9 @@ async def create( cast_to=EvalCreateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def retrieve( self, eval_id: str, @@ -425,6 +472,10 @@ async def retrieve( """ Get an evaluation by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -448,6 +499,9 @@ async def retrieve( cast_to=EvalRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def update( self, eval_id: str, @@ -464,6 +518,10 @@ async def update( """ Update certain properties of an evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. @@ -502,6 +560,9 @@ async def update( cast_to=EvalUpdateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, *, @@ -516,8 +577,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[EvalListResponse, AsyncCursorPage[EvalListResponse]]: - """ - List evaluations for a project. + """List evaluations for a project. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last eval from the previous pagination request. @@ -560,6 +626,9 @@ def list( model=EvalListResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def delete( self, eval_id: str, @@ -574,6 +643,10 @@ async def delete( """ Delete an evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers diff --git a/src/openai/resources/evals/runs/output_items.py b/src/openai/resources/evals/runs/output_items.py index 4a26ccf26c..6292e515ad 100644 --- a/src/openai/resources/evals/runs/output_items.py +++ b/src/openai/resources/evals/runs/output_items.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing_extensions import Literal import httpx2 @@ -43,6 +44,9 @@ def with_streaming_response(self) -> OutputItemsWithStreamingResponse: """ return OutputItemsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def retrieve( self, output_item_id: str, @@ -59,6 +63,10 @@ def retrieve( """ Get an evaluation run output item by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -91,6 +99,9 @@ def retrieve( cast_to=OutputItemRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, run_id: str, @@ -107,8 +118,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> SyncCursorPage[OutputItemListResponse]: - """ - Get a list of output items for an evaluation run. + """Get a list of output items for an evaluation run. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last output item from the previous pagination request. @@ -178,6 +194,9 @@ def with_streaming_response(self) -> AsyncOutputItemsWithStreamingResponse: """ return AsyncOutputItemsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def retrieve( self, output_item_id: str, @@ -194,6 +213,10 @@ async def retrieve( """ Get an evaluation run output item by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -226,6 +249,9 @@ async def retrieve( cast_to=OutputItemRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, run_id: str, @@ -242,8 +268,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[OutputItemListResponse, AsyncCursorPage[OutputItemListResponse]]: - """ - Get a list of output items for an evaluation run. + """Get a list of output items for an evaluation run. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last output item from the previous pagination request. diff --git a/src/openai/resources/evals/runs/runs.py b/src/openai/resources/evals/runs/runs.py index 7ae1570aee..b8da8953ad 100644 --- a/src/openai/resources/evals/runs/runs.py +++ b/src/openai/resources/evals/runs/runs.py @@ -2,6 +2,7 @@ from __future__ import annotations +import typing_extensions from typing import Optional from typing_extensions import Literal @@ -61,6 +62,9 @@ def with_streaming_response(self) -> RunsWithStreamingResponse: """ return RunsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def create( self, eval_id: str, @@ -80,6 +84,9 @@ def create( model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: data_source: Details about the run's data source. @@ -121,6 +128,9 @@ def create( cast_to=RunCreateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def retrieve( self, run_id: str, @@ -136,6 +146,10 @@ def retrieve( """ Get an evaluation run by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -161,6 +175,9 @@ def retrieve( cast_to=RunRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, eval_id: str, @@ -176,8 +193,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> SyncCursorPage[RunListResponse]: - """ - Get a list of runs for an evaluation. + """Get a list of runs for an evaluation. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last run from the previous pagination request. @@ -222,6 +244,9 @@ def list( model=RunListResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def delete( self, run_id: str, @@ -237,6 +262,10 @@ def delete( """ Delete an eval run. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -262,6 +291,9 @@ def delete( cast_to=RunDeleteResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def cancel( self, run_id: str, @@ -277,6 +309,10 @@ def cancel( """ Cancel an ongoing evaluation run. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -330,6 +366,9 @@ def with_streaming_response(self) -> AsyncRunsWithStreamingResponse: """ return AsyncRunsWithStreamingResponse(self) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def create( self, eval_id: str, @@ -349,6 +388,9 @@ async def create( model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: data_source: Details about the run's data source. @@ -390,6 +432,9 @@ async def create( cast_to=RunCreateResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def retrieve( self, run_id: str, @@ -405,6 +450,10 @@ async def retrieve( """ Get an evaluation run by ID. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -430,6 +479,9 @@ async def retrieve( cast_to=RunRetrieveResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) def list( self, eval_id: str, @@ -445,8 +497,13 @@ def list( extra_body: Body | None = None, timeout: float | httpx2.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RunListResponse, AsyncCursorPage[RunListResponse]]: - """ - Get a list of runs for an evaluation. + """Get a list of runs for an evaluation. + + Deprecated. + + OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). Args: after: Identifier for the last run from the previous pagination request. @@ -491,6 +548,9 @@ def list( model=RunListResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def delete( self, run_id: str, @@ -506,6 +566,10 @@ async def delete( """ Delete an eval run. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers @@ -531,6 +595,9 @@ async def delete( cast_to=RunDeleteResponse, ) + @typing_extensions.deprecated( + "The Evals API is deprecated. OpenAI scheduled its shutdown for November 30, 2026. Use Promptfoo instead." + ) async def cancel( self, run_id: str, @@ -546,6 +613,10 @@ async def cancel( """ Cancel an ongoing evaluation run. + Deprecated. OpenAI scheduled the shutdown of the Evals API for November 30, + 2026. + [Migrate to Promptfoo](https://developers.openai.com/cookbook/examples/evaluation/moving-from-openai-evals-to-promptfoo). + Args: extra_headers: Send extra headers diff --git a/src/openai/resources/realtime/calls.py b/src/openai/resources/realtime/calls.py index 4920094971..02c1ecdf97 100644 --- a/src/openai/resources/realtime/calls.py +++ b/src/openai/resources/realtime/calls.py @@ -225,7 +225,10 @@ def accept( reasoning Realtime models such as `gpt-realtime-2`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. reasoning: Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. @@ -613,7 +616,10 @@ async def accept( reasoning Realtime models such as `gpt-realtime-2`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. reasoning: Configuration for reasoning-capable Realtime models such as `gpt-realtime-2`. diff --git a/src/openai/resources/responses/responses.py b/src/openai/resources/responses/responses.py index 46bcbf3fbf..6bd16fb816 100644 --- a/src/openai/resources/responses/responses.py +++ b/src/openai/resources/responses/responses.py @@ -602,7 +602,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -910,7 +913,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -1211,7 +1217,10 @@ def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -2582,7 +2591,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -2890,7 +2902,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. @@ -3191,7 +3206,10 @@ async def create( Cannot be used in conjunction with `conversation`. prompt: Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. prompt_cache_key: Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. diff --git a/src/openai/types/beta/beta_response.py b/src/openai/types/beta/beta_response.py index 184ffa4db5..7d0f7218f4 100644 --- a/src/openai/types/beta/beta_response.py +++ b/src/openai/types/beta/beta_response.py @@ -777,9 +777,11 @@ class BetaResponse(BaseModel): """ prompt: Optional[BetaResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_diagnostics: Optional[PromptCacheDiagnostics] = None diff --git a/src/openai/types/beta/beta_response_prompt.py b/src/openai/types/beta/beta_response_prompt.py index c8fb425512..83e5deb4df 100644 --- a/src/openai/types/beta/beta_response_prompt.py +++ b/src/openai/types/beta/beta_response_prompt.py @@ -14,9 +14,11 @@ class BetaResponsePrompt(BaseModel): - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ id: str diff --git a/src/openai/types/beta/beta_response_prompt_param.py b/src/openai/types/beta/beta_response_prompt_param.py index e024eb95d2..67819c4863 100644 --- a/src/openai/types/beta/beta_response_prompt_param.py +++ b/src/openai/types/beta/beta_response_prompt_param.py @@ -15,9 +15,11 @@ class BetaResponsePromptParam(TypedDict, total=False): - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ id: Required[str] diff --git a/src/openai/types/beta/beta_responses_client_event.py b/src/openai/types/beta/beta_responses_client_event.py index e9852ffeb1..10a7bfbf44 100644 --- a/src/openai/types/beta/beta_responses_client_event.py +++ b/src/openai/types/beta/beta_responses_client_event.py @@ -629,9 +629,11 @@ class ResponseCreate(BaseModel): """ prompt: Optional[BetaResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] = None diff --git a/src/openai/types/beta/beta_responses_client_event_param.py b/src/openai/types/beta/beta_responses_client_event_param.py index 21a84c9d3c..89bff59fbe 100644 --- a/src/openai/types/beta/beta_responses_client_event_param.py +++ b/src/openai/types/beta/beta_responses_client_event_param.py @@ -628,9 +628,11 @@ class ResponseCreate(TypedDict, total=False): """ prompt: Optional[BetaResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] diff --git a/src/openai/types/beta/response_create_params.py b/src/openai/types/beta/response_create_params.py index 09c1592982..0ee09d0699 100644 --- a/src/openai/types/beta/response_create_params.py +++ b/src/openai/types/beta/response_create_params.py @@ -369,9 +369,11 @@ class ResponseCreateParamsBase(TypedDict, total=False): """ prompt: Optional[BetaResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] diff --git a/src/openai/types/realtime/call_accept_params.py b/src/openai/types/realtime/call_accept_params.py index a76b80604a..4ffe82e2a4 100644 --- a/src/openai/types/realtime/call_accept_params.py +++ b/src/openai/types/realtime/call_accept_params.py @@ -103,9 +103,11 @@ class CallAcceptParams(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: RealtimeReasoningParam diff --git a/src/openai/types/realtime/realtime_response_create_params.py b/src/openai/types/realtime/realtime_response_create_params.py index 2a16f4ec80..9820165757 100644 --- a/src/openai/types/realtime/realtime_response_create_params.py +++ b/src/openai/types/realtime/realtime_response_create_params.py @@ -92,9 +92,11 @@ class RealtimeResponseCreateParams(BaseModel): """ prompt: Optional[ResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: Optional[RealtimeReasoning] = None diff --git a/src/openai/types/realtime/realtime_response_create_params_param.py b/src/openai/types/realtime/realtime_response_create_params_param.py index 8cb16d4d89..b992a058eb 100644 --- a/src/openai/types/realtime/realtime_response_create_params_param.py +++ b/src/openai/types/realtime/realtime_response_create_params_param.py @@ -93,9 +93,11 @@ class RealtimeResponseCreateParamsParam(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: RealtimeReasoningParam diff --git a/src/openai/types/realtime/realtime_response_create_params_with_references_param.py b/src/openai/types/realtime/realtime_response_create_params_with_references_param.py index 2d387a9bb2..d8da75c302 100644 --- a/src/openai/types/realtime/realtime_response_create_params_with_references_param.py +++ b/src/openai/types/realtime/realtime_response_create_params_with_references_param.py @@ -94,9 +94,11 @@ class RealtimeResponseCreateParamsWithReferencesParam(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: RealtimeReasoningParam diff --git a/src/openai/types/realtime/realtime_session_create_request.py b/src/openai/types/realtime/realtime_session_create_request.py index 4cf76c021f..ac9dd88d12 100644 --- a/src/openai/types/realtime/realtime_session_create_request.py +++ b/src/openai/types/realtime/realtime_session_create_request.py @@ -105,9 +105,11 @@ class RealtimeSessionCreateRequest(BaseModel): """ prompt: Optional[ResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: Optional[RealtimeReasoning] = None diff --git a/src/openai/types/realtime/realtime_session_create_request_param.py b/src/openai/types/realtime/realtime_session_create_request_param.py index c2eaa1ba6e..c6e49073ea 100644 --- a/src/openai/types/realtime/realtime_session_create_request_param.py +++ b/src/openai/types/realtime/realtime_session_create_request_param.py @@ -105,9 +105,11 @@ class RealtimeSessionCreateRequestParam(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: RealtimeReasoningParam diff --git a/src/openai/types/realtime/realtime_session_create_response.py b/src/openai/types/realtime/realtime_session_create_response.py index 09db314f43..1e593c7b14 100644 --- a/src/openai/types/realtime/realtime_session_create_response.py +++ b/src/openai/types/realtime/realtime_session_create_response.py @@ -520,9 +520,11 @@ class RealtimeSessionCreateResponse(BaseModel): """ prompt: Optional[ResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ reasoning: Optional[RealtimeReasoning] = None diff --git a/src/openai/types/responses/response.py b/src/openai/types/responses/response.py index 99d5159055..2915bf8bbe 100644 --- a/src/openai/types/responses/response.py +++ b/src/openai/types/responses/response.py @@ -527,9 +527,11 @@ class Response(BaseModel): """ prompt: Optional[ResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_diagnostics: Optional[PromptCacheDiagnostics] = None diff --git a/src/openai/types/responses/response_create_params.py b/src/openai/types/responses/response_create_params.py index 7b500f27a7..5cc164f64a 100644 --- a/src/openai/types/responses/response_create_params.py +++ b/src/openai/types/responses/response_create_params.py @@ -166,9 +166,11 @@ class ResponseCreateParamsBase(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] diff --git a/src/openai/types/responses/response_prompt.py b/src/openai/types/responses/response_prompt.py index e5080af5d5..e19651d2ad 100644 --- a/src/openai/types/responses/response_prompt.py +++ b/src/openai/types/responses/response_prompt.py @@ -14,9 +14,11 @@ class ResponsePrompt(BaseModel): - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ id: str diff --git a/src/openai/types/responses/response_prompt_param.py b/src/openai/types/responses/response_prompt_param.py index 2db1bd1893..159f0553ca 100644 --- a/src/openai/types/responses/response_prompt_param.py +++ b/src/openai/types/responses/response_prompt_param.py @@ -15,9 +15,11 @@ class ResponsePromptParam(TypedDict, total=False): - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ id: Required[str] diff --git a/src/openai/types/responses/responses_client_event.py b/src/openai/types/responses/responses_client_event.py index cc8555f524..27921bc66a 100644 --- a/src/openai/types/responses/responses_client_event.py +++ b/src/openai/types/responses/responses_client_event.py @@ -366,9 +366,11 @@ class ResponseCreate(BaseModel): """ prompt: Optional[ResponsePrompt] = None - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] = None diff --git a/src/openai/types/responses/responses_client_event_param.py b/src/openai/types/responses/responses_client_event_param.py index ee40c3cf7e..3a2fb4d930 100644 --- a/src/openai/types/responses/responses_client_event_param.py +++ b/src/openai/types/responses/responses_client_event_param.py @@ -366,9 +366,11 @@ class ResponseCreate(TypedDict, total=False): """ prompt: Optional[ResponsePromptParam] - """ - Reference to a prompt template and its variables. - [Learn more](https://developers.openai.com/api/docs/guides/text?api-mode=responses#version-prompts-in-code). + """Reference to a prompt template and its variables. + + This field is deprecated in favor of + [prompts in application code](https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object). + OpenAI scheduled the shutdown of saved prompts for November 30, 2026. """ prompt_cache_key: Optional[str] diff --git a/tests/api_resources/evals/runs/test_output_items.py b/tests/api_resources/evals/runs/test_output_items.py index 154fcb9e43..5e23a39d26 100644 --- a/tests/api_resources/evals/runs/test_output_items.py +++ b/tests/api_resources/evals/runs/test_output_items.py @@ -20,20 +20,23 @@ class TestOutputItems: @parametrize def test_method_retrieve(self, client: OpenAI) -> None: - output_item = client.evals.runs.output_items.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + output_item = client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OpenAI) -> None: - response = client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -42,68 +45,75 @@ def test_raw_response_retrieve(self, client: OpenAI) -> None: @parametrize def test_streaming_response_retrieve(self, client: OpenAI) -> None: - with client.evals.runs.output_items.with_streaming_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.output_items.with_streaming_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - output_item = response.parse() - assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) + output_item = response.parse() + assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="", + run_id="run_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_item_id` but received ''"): + client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="", + eval_id="eval_id", + run_id="run_id", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_item_id` but received ''"): - client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="", - eval_id="eval_id", + @parametrize + def test_method_list(self, client: OpenAI) -> None: + with pytest.warns(DeprecationWarning): + output_item = client.evals.runs.output_items.list( run_id="run_id", + eval_id="eval_id", ) - @parametrize - def test_method_list(self, client: OpenAI) -> None: - output_item = client.evals.runs.output_items.list( - run_id="run_id", - eval_id="eval_id", - ) assert_matches_type(SyncCursorPage[OutputItemListResponse], output_item, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OpenAI) -> None: - output_item = client.evals.runs.output_items.list( - run_id="run_id", - eval_id="eval_id", - after="after", - limit=0, - order="asc", - status="fail", - ) + with pytest.warns(DeprecationWarning): + output_item = client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + after="after", + limit=0, + order="asc", + status="fail", + ) + assert_matches_type(SyncCursorPage[OutputItemListResponse], output_item, path=["response"]) @parametrize def test_raw_response_list(self, client: OpenAI) -> None: - response = client.evals.runs.output_items.with_raw_response.list( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.output_items.with_raw_response.list( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,31 +122,33 @@ def test_raw_response_list(self, client: OpenAI) -> None: @parametrize def test_streaming_response_list(self, client: OpenAI) -> None: - with client.evals.runs.output_items.with_streaming_response.list( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.output_items.with_streaming_response.list( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - output_item = response.parse() - assert_matches_type(SyncCursorPage[OutputItemListResponse], output_item, path=["response"]) + output_item = response.parse() + assert_matches_type(SyncCursorPage[OutputItemListResponse], output_item, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.output_items.with_raw_response.list( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.output_items.with_raw_response.list( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.evals.runs.output_items.with_raw_response.list( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + client.evals.runs.output_items.with_raw_response.list( + run_id="", + eval_id="eval_id", + ) class TestAsyncOutputItems: @@ -146,20 +158,23 @@ class TestAsyncOutputItems: @parametrize async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: - output_item = await async_client.evals.runs.output_items.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + output_item = await async_client.evals.runs.output_items.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) + assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -168,68 +183,75 @@ async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.output_items.with_streaming_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="run_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.output_items.with_streaming_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="run_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - output_item = await response.parse() - assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) + output_item = await response.parse() + assert_matches_type(OutputItemRetrieveResponse, output_item, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="", - run_id="run_id", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="", + run_id="run_id", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + await async_client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="output_item_id", + eval_id="eval_id", + run_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_item_id` but received ''"): + await async_client.evals.runs.output_items.with_raw_response.retrieve( + output_item_id="", + eval_id="eval_id", + run_id="run_id", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="output_item_id", - eval_id="eval_id", - run_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `output_item_id` but received ''"): - await async_client.evals.runs.output_items.with_raw_response.retrieve( - output_item_id="", - eval_id="eval_id", + @parametrize + async def test_method_list(self, async_client: AsyncOpenAI) -> None: + with pytest.warns(DeprecationWarning): + output_item = await async_client.evals.runs.output_items.list( run_id="run_id", + eval_id="eval_id", ) - @parametrize - async def test_method_list(self, async_client: AsyncOpenAI) -> None: - output_item = await async_client.evals.runs.output_items.list( - run_id="run_id", - eval_id="eval_id", - ) assert_matches_type(AsyncCursorPage[OutputItemListResponse], output_item, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: - output_item = await async_client.evals.runs.output_items.list( - run_id="run_id", - eval_id="eval_id", - after="after", - limit=0, - order="asc", - status="fail", - ) + with pytest.warns(DeprecationWarning): + output_item = await async_client.evals.runs.output_items.list( + run_id="run_id", + eval_id="eval_id", + after="after", + limit=0, + order="asc", + status="fail", + ) + assert_matches_type(AsyncCursorPage[OutputItemListResponse], output_item, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.output_items.with_raw_response.list( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.output_items.with_raw_response.list( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -238,28 +260,30 @@ async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.output_items.with_streaming_response.list( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.output_items.with_streaming_response.list( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - output_item = await response.parse() - assert_matches_type(AsyncCursorPage[OutputItemListResponse], output_item, path=["response"]) + output_item = await response.parse() + assert_matches_type(AsyncCursorPage[OutputItemListResponse], output_item, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.output_items.with_raw_response.list( - run_id="run_id", - eval_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.evals.runs.output_items.with_raw_response.list( - run_id="", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.output_items.with_raw_response.list( + run_id="run_id", + eval_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + await async_client.evals.runs.output_items.with_raw_response.list( + run_id="", + eval_id="eval_id", + ) diff --git a/tests/api_resources/evals/test_runs.py b/tests/api_resources/evals/test_runs.py index 816e47fa61..381bc549f0 100644 --- a/tests/api_resources/evals/test_runs.py +++ b/tests/api_resources/evals/test_runs.py @@ -26,51 +26,56 @@ class TestRuns: @parametrize def test_method_create(self, client: OpenAI) -> None: - run = client.evals.runs.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) + assert_matches_type(RunCreateResponse, run, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: OpenAI) -> None: - run = client.evals.runs.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [ - { - "item": {"foo": "bar"}, - "sample": {"foo": "bar"}, - } - ], - "type": "file_content", + with pytest.warns(DeprecationWarning): + run = client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [ + { + "item": {"foo": "bar"}, + "sample": {"foo": "bar"}, + } + ], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - metadata={"foo": "string"}, - name="name", - ) + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(RunCreateResponse, run, path=["response"]) @parametrize def test_raw_response_create(self, client: OpenAI) -> None: - response = client.evals.runs.with_raw_response.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + response = client.evals.runs.with_raw_response.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -79,52 +84,57 @@ def test_raw_response_create(self, client: OpenAI) -> None: @parametrize def test_streaming_response_create(self, client: OpenAI) -> None: - with client.evals.runs.with_streaming_response.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + with client.evals.runs.with_streaming_response.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunCreateResponse, run, path=["response"]) + run = response.parse() + assert_matches_type(RunCreateResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_create(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.with_raw_response.create( - eval_id="", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.with_raw_response.create( + eval_id="", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) @parametrize def test_method_retrieve(self, client: OpenAI) -> None: - run = client.evals.runs.retrieve( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunRetrieveResponse, run, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OpenAI) -> None: - response = client.evals.runs.with_raw_response.retrieve( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.with_raw_response.retrieve( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -133,55 +143,62 @@ def test_raw_response_retrieve(self, client: OpenAI) -> None: @parametrize def test_streaming_response_retrieve(self, client: OpenAI) -> None: - with client.evals.runs.with_streaming_response.retrieve( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.with_streaming_response.retrieve( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunRetrieveResponse, run, path=["response"]) + run = response.parse() + assert_matches_type(RunRetrieveResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.with_raw_response.retrieve( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.with_raw_response.retrieve( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.evals.runs.with_raw_response.retrieve( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + client.evals.runs.with_raw_response.retrieve( + run_id="", + eval_id="eval_id", + ) @parametrize def test_method_list(self, client: OpenAI) -> None: - run = client.evals.runs.list( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = client.evals.runs.list( + eval_id="eval_id", + ) + assert_matches_type(SyncCursorPage[RunListResponse], run, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OpenAI) -> None: - run = client.evals.runs.list( - eval_id="eval_id", - after="after", - limit=0, - order="asc", - status="queued", - ) + with pytest.warns(DeprecationWarning): + run = client.evals.runs.list( + eval_id="eval_id", + after="after", + limit=0, + order="asc", + status="queued", + ) + assert_matches_type(SyncCursorPage[RunListResponse], run, path=["response"]) @parametrize def test_raw_response_list(self, client: OpenAI) -> None: - response = client.evals.runs.with_raw_response.list( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.with_raw_response.list( + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -190,38 +207,43 @@ def test_raw_response_list(self, client: OpenAI) -> None: @parametrize def test_streaming_response_list(self, client: OpenAI) -> None: - with client.evals.runs.with_streaming_response.list( - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.with_streaming_response.list( + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(SyncCursorPage[RunListResponse], run, path=["response"]) + run = response.parse() + assert_matches_type(SyncCursorPage[RunListResponse], run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_list(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.with_raw_response.list( - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.with_raw_response.list( + eval_id="", + ) @parametrize def test_method_delete(self, client: OpenAI) -> None: - run = client.evals.runs.delete( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunDeleteResponse, run, path=["response"]) @parametrize def test_raw_response_delete(self, client: OpenAI) -> None: - response = client.evals.runs.with_raw_response.delete( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.with_raw_response.delete( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,46 +252,51 @@ def test_raw_response_delete(self, client: OpenAI) -> None: @parametrize def test_streaming_response_delete(self, client: OpenAI) -> None: - with client.evals.runs.with_streaming_response.delete( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.with_streaming_response.delete( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunDeleteResponse, run, path=["response"]) + run = response.parse() + assert_matches_type(RunDeleteResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.with_raw_response.delete( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.with_raw_response.delete( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.evals.runs.with_raw_response.delete( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + client.evals.runs.with_raw_response.delete( + run_id="", + eval_id="eval_id", + ) @parametrize def test_method_cancel(self, client: OpenAI) -> None: - run = client.evals.runs.cancel( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunCancelResponse, run, path=["response"]) @parametrize def test_raw_response_cancel(self, client: OpenAI) -> None: - response = client.evals.runs.with_raw_response.cancel( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.runs.with_raw_response.cancel( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -278,31 +305,33 @@ def test_raw_response_cancel(self, client: OpenAI) -> None: @parametrize def test_streaming_response_cancel(self, client: OpenAI) -> None: - with client.evals.runs.with_streaming_response.cancel( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.runs.with_streaming_response.cancel( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = response.parse() - assert_matches_type(RunCancelResponse, run, path=["response"]) + run = response.parse() + assert_matches_type(RunCancelResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_cancel(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.runs.with_raw_response.cancel( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.runs.with_raw_response.cancel( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - client.evals.runs.with_raw_response.cancel( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + client.evals.runs.with_raw_response.cancel( + run_id="", + eval_id="eval_id", + ) class TestAsyncRuns: @@ -312,51 +341,56 @@ class TestAsyncRuns: @parametrize async def test_method_create(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) + assert_matches_type(RunCreateResponse, run, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [ - { - "item": {"foo": "bar"}, - "sample": {"foo": "bar"}, - } - ], - "type": "file_content", + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [ + { + "item": {"foo": "bar"}, + "sample": {"foo": "bar"}, + } + ], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - metadata={"foo": "string"}, - name="name", - ) + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(RunCreateResponse, run, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.with_raw_response.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.with_raw_response.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -365,52 +399,57 @@ async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.with_streaming_response.create( - eval_id="eval_id", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.with_streaming_response.create( + eval_id="eval_id", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunCreateResponse, run, path=["response"]) + run = await response.parse() + assert_matches_type(RunCreateResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_create(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.with_raw_response.create( - eval_id="", - data_source={ - "source": { - "content": [{"item": {"foo": "bar"}}], - "type": "file_content", + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.with_raw_response.create( + eval_id="", + data_source={ + "source": { + "content": [{"item": {"foo": "bar"}}], + "type": "file_content", + }, + "type": "jsonl", }, - "type": "jsonl", - }, - ) + ) @parametrize async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.retrieve( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.retrieve( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunRetrieveResponse, run, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.with_raw_response.retrieve( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.with_raw_response.retrieve( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -419,55 +458,62 @@ async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.with_streaming_response.retrieve( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.with_streaming_response.retrieve( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunRetrieveResponse, run, path=["response"]) + run = await response.parse() + assert_matches_type(RunRetrieveResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.with_raw_response.retrieve( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.with_raw_response.retrieve( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.evals.runs.with_raw_response.retrieve( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + await async_client.evals.runs.with_raw_response.retrieve( + run_id="", + eval_id="eval_id", + ) @parametrize async def test_method_list(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.list( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.list( + eval_id="eval_id", + ) + assert_matches_type(AsyncCursorPage[RunListResponse], run, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.list( - eval_id="eval_id", - after="after", - limit=0, - order="asc", - status="queued", - ) + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.list( + eval_id="eval_id", + after="after", + limit=0, + order="asc", + status="queued", + ) + assert_matches_type(AsyncCursorPage[RunListResponse], run, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.with_raw_response.list( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.with_raw_response.list( + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -476,38 +522,43 @@ async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.with_streaming_response.list( - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.with_streaming_response.list( + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(AsyncCursorPage[RunListResponse], run, path=["response"]) + run = await response.parse() + assert_matches_type(AsyncCursorPage[RunListResponse], run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_list(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.with_raw_response.list( - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.with_raw_response.list( + eval_id="", + ) @parametrize async def test_method_delete(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.delete( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.delete( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunDeleteResponse, run, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.with_raw_response.delete( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.with_raw_response.delete( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -516,46 +567,51 @@ async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.with_streaming_response.delete( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.with_streaming_response.delete( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunDeleteResponse, run, path=["response"]) + run = await response.parse() + assert_matches_type(RunDeleteResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.with_raw_response.delete( - run_id="run_id", - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.with_raw_response.delete( + run_id="run_id", + eval_id="", + ) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.evals.runs.with_raw_response.delete( - run_id="", - eval_id="eval_id", - ) + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + await async_client.evals.runs.with_raw_response.delete( + run_id="", + eval_id="eval_id", + ) @parametrize async def test_method_cancel(self, async_client: AsyncOpenAI) -> None: - run = await async_client.evals.runs.cancel( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + run = await async_client.evals.runs.cancel( + run_id="run_id", + eval_id="eval_id", + ) + assert_matches_type(RunCancelResponse, run, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.runs.with_raw_response.cancel( - run_id="run_id", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.runs.with_raw_response.cancel( + run_id="run_id", + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -564,28 +620,30 @@ async def test_raw_response_cancel(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_cancel(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.runs.with_streaming_response.cancel( - run_id="run_id", - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.runs.with_streaming_response.cancel( + run_id="run_id", + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - run = await response.parse() - assert_matches_type(RunCancelResponse, run, path=["response"]) + run = await response.parse() + assert_matches_type(RunCancelResponse, run, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_cancel(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.runs.with_raw_response.cancel( - run_id="run_id", - eval_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): - await async_client.evals.runs.with_raw_response.cancel( - run_id="", - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.runs.with_raw_response.cancel( + run_id="run_id", + eval_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `run_id` but received ''"): + await async_client.evals.runs.with_raw_response.cancel( + run_id="", + eval_id="eval_id", + ) diff --git a/tests/api_resources/test_evals.py b/tests/api_resources/test_evals.py index 80fd2a7f6c..953e0a77ae 100644 --- a/tests/api_resources/test_evals.py +++ b/tests/api_resources/test_evals.py @@ -26,80 +26,85 @@ class TestEvals: @parametrize def test_method_create(self, client: OpenAI) -> None: - eval = client.evals.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) + assert_matches_type(EvalCreateResponse, eval, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: OpenAI) -> None: - eval = client.evals.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - "include_sample_schema": True, - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - metadata={"foo": "string"}, - name="name", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + "include_sample_schema": True, + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(EvalCreateResponse, eval, path=["response"]) @parametrize def test_raw_response_create(self, client: OpenAI) -> None: - response = client.evals.with_raw_response.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = client.evals.with_raw_response.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,47 +113,51 @@ def test_raw_response_create(self, client: OpenAI) -> None: @parametrize def test_streaming_response_create(self, client: OpenAI) -> None: - with client.evals.with_streaming_response.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - eval = response.parse() - assert_matches_type(EvalCreateResponse, eval, path=["response"]) + with pytest.warns(DeprecationWarning): + with client.evals.with_streaming_response.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + eval = response.parse() + assert_matches_type(EvalCreateResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: OpenAI) -> None: - eval = client.evals.retrieve( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.retrieve( + "eval_id", + ) + assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: OpenAI) -> None: - response = client.evals.with_raw_response.retrieve( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.with_raw_response.retrieve( + "eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -157,45 +166,52 @@ def test_raw_response_retrieve(self, client: OpenAI) -> None: @parametrize def test_streaming_response_retrieve(self, client: OpenAI) -> None: - with client.evals.with_streaming_response.retrieve( - "eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.with_streaming_response.retrieve( + "eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = response.parse() - assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) + eval = response.parse() + assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.with_raw_response.retrieve( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.with_raw_response.retrieve( + "", + ) @parametrize def test_method_update(self, client: OpenAI) -> None: - eval = client.evals.update( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.update( + eval_id="eval_id", + ) + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: OpenAI) -> None: - eval = client.evals.update( - eval_id="eval_id", - metadata={"foo": "string"}, - name="name", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.update( + eval_id="eval_id", + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) @parametrize def test_raw_response_update(self, client: OpenAI) -> None: - response = client.evals.with_raw_response.update( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.with_raw_response.update( + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -204,42 +220,49 @@ def test_raw_response_update(self, client: OpenAI) -> None: @parametrize def test_streaming_response_update(self, client: OpenAI) -> None: - with client.evals.with_streaming_response.update( - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.with_streaming_response.update( + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = response.parse() - assert_matches_type(EvalUpdateResponse, eval, path=["response"]) + eval = response.parse() + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_update(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.with_raw_response.update( - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.with_raw_response.update( + eval_id="", + ) @parametrize def test_method_list(self, client: OpenAI) -> None: - eval = client.evals.list() + with pytest.warns(DeprecationWarning): + eval = client.evals.list() + assert_matches_type(SyncCursorPage[EvalListResponse], eval, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: OpenAI) -> None: - eval = client.evals.list( - after="after", - limit=0, - order="asc", - order_by="created_at", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.list( + after="after", + limit=0, + order="asc", + order_by="created_at", + ) + assert_matches_type(SyncCursorPage[EvalListResponse], eval, path=["response"]) @parametrize def test_raw_response_list(self, client: OpenAI) -> None: - response = client.evals.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = client.evals.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -248,27 +271,31 @@ def test_raw_response_list(self, client: OpenAI) -> None: @parametrize def test_streaming_response_list(self, client: OpenAI) -> None: - with client.evals.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = response.parse() - assert_matches_type(SyncCursorPage[EvalListResponse], eval, path=["response"]) + eval = response.parse() + assert_matches_type(SyncCursorPage[EvalListResponse], eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_delete(self, client: OpenAI) -> None: - eval = client.evals.delete( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = client.evals.delete( + "eval_id", + ) + assert_matches_type(EvalDeleteResponse, eval, path=["response"]) @parametrize def test_raw_response_delete(self, client: OpenAI) -> None: - response = client.evals.with_raw_response.delete( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + response = client.evals.with_raw_response.delete( + "eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -277,23 +304,25 @@ def test_raw_response_delete(self, client: OpenAI) -> None: @parametrize def test_streaming_response_delete(self, client: OpenAI) -> None: - with client.evals.with_streaming_response.delete( - "eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + with client.evals.with_streaming_response.delete( + "eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = response.parse() - assert_matches_type(EvalDeleteResponse, eval, path=["response"]) + eval = response.parse() + assert_matches_type(EvalDeleteResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_delete(self, client: OpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - client.evals.with_raw_response.delete( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + client.evals.with_raw_response.delete( + "", + ) class TestAsyncEvals: @@ -303,80 +332,85 @@ class TestAsyncEvals: @parametrize async def test_method_create(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) + assert_matches_type(EvalCreateResponse, eval, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - "include_sample_schema": True, - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - metadata={"foo": "string"}, - name="name", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + "include_sample_schema": True, + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(EvalCreateResponse, eval, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.with_raw_response.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.with_raw_response.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -385,47 +419,51 @@ async def test_raw_response_create(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.with_streaming_response.create( - data_source_config={ - "item_schema": {"foo": "bar"}, - "type": "custom", - }, - testing_criteria=[ - { - "input": [ - { - "content": "content", - "role": "role", - } - ], - "labels": ["string"], - "model": "model", - "name": "name", - "passing_labels": ["string"], - "type": "label_model", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - eval = await response.parse() - assert_matches_type(EvalCreateResponse, eval, path=["response"]) + with pytest.warns(DeprecationWarning): + async with async_client.evals.with_streaming_response.create( + data_source_config={ + "item_schema": {"foo": "bar"}, + "type": "custom", + }, + testing_criteria=[ + { + "input": [ + { + "content": "content", + "role": "role", + } + ], + "labels": ["string"], + "model": "model", + "name": "name", + "passing_labels": ["string"], + "type": "label_model", + } + ], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + eval = await response.parse() + assert_matches_type(EvalCreateResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.retrieve( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.retrieve( + "eval_id", + ) + assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.with_raw_response.retrieve( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.with_raw_response.retrieve( + "eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -434,45 +472,52 @@ async def test_raw_response_retrieve(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.with_streaming_response.retrieve( - "eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.with_streaming_response.retrieve( + "eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = await response.parse() - assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) + eval = await response.parse() + assert_matches_type(EvalRetrieveResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.with_raw_response.retrieve( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.with_raw_response.retrieve( + "", + ) @parametrize async def test_method_update(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.update( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.update( + eval_id="eval_id", + ) + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.update( - eval_id="eval_id", - metadata={"foo": "string"}, - name="name", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.update( + eval_id="eval_id", + metadata={"foo": "string"}, + name="name", + ) + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) @parametrize async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.with_raw_response.update( - eval_id="eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.with_raw_response.update( + eval_id="eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -481,42 +526,49 @@ async def test_raw_response_update(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_update(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.with_streaming_response.update( - eval_id="eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.with_streaming_response.update( + eval_id="eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = await response.parse() - assert_matches_type(EvalUpdateResponse, eval, path=["response"]) + eval = await response.parse() + assert_matches_type(EvalUpdateResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_update(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.with_raw_response.update( - eval_id="", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.with_raw_response.update( + eval_id="", + ) @parametrize async def test_method_list(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.list() + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.list() + assert_matches_type(AsyncCursorPage[EvalListResponse], eval, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.list( - after="after", - limit=0, - order="asc", - order_by="created_at", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.list( + after="after", + limit=0, + order="asc", + order_by="created_at", + ) + assert_matches_type(AsyncCursorPage[EvalListResponse], eval, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.with_raw_response.list() + with pytest.warns(DeprecationWarning): + response = await async_client.evals.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -525,27 +577,31 @@ async def test_raw_response_list(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = await response.parse() - assert_matches_type(AsyncCursorPage[EvalListResponse], eval, path=["response"]) + eval = await response.parse() + assert_matches_type(AsyncCursorPage[EvalListResponse], eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_delete(self, async_client: AsyncOpenAI) -> None: - eval = await async_client.evals.delete( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + eval = await async_client.evals.delete( + "eval_id", + ) + assert_matches_type(EvalDeleteResponse, eval, path=["response"]) @parametrize async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: - response = await async_client.evals.with_raw_response.delete( - "eval_id", - ) + with pytest.warns(DeprecationWarning): + response = await async_client.evals.with_raw_response.delete( + "eval_id", + ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -554,20 +610,22 @@ async def test_raw_response_delete(self, async_client: AsyncOpenAI) -> None: @parametrize async def test_streaming_response_delete(self, async_client: AsyncOpenAI) -> None: - async with async_client.evals.with_streaming_response.delete( - "eval_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" + with pytest.warns(DeprecationWarning): + async with async_client.evals.with_streaming_response.delete( + "eval_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" - eval = await response.parse() - assert_matches_type(EvalDeleteResponse, eval, path=["response"]) + eval = await response.parse() + assert_matches_type(EvalDeleteResponse, eval, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_delete(self, async_client: AsyncOpenAI) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): - await async_client.evals.with_raw_response.delete( - "", - ) + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `eval_id` but received ''"): + await async_client.evals.with_raw_response.delete( + "", + )