diff --git a/.stats.yml b/.stats.yml index 9d3f021d..8cd88b09 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 69 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-ff0d729948c168849f182f3ade5515a5d7ba313e3e5bf072042ca7f225e83113.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-8a5f5d240accf9b035735a201c3828c9e5caf66047ba83c1bee98ae407fe296a.yml diff --git a/api.md b/api.md index ea969596..301ff8fc 100644 --- a/api.md +++ b/api.md @@ -76,11 +76,11 @@ Methods: - client.admin.training_datasets.get_next_unverified(\*\*params) -> TrainingDatumResponse - client.admin.training_datasets.get_step_by_id(\*\*params) -> TrainingDatumResponse - client.admin.training_datasets.list_datums(\*\*params) -> TrainingDatasetListDatumsResponse -- client.admin.training_datasets.mark_suspicious_datum(\*\*params) -> None - client.admin.training_datasets.remove_datum(\*\*params) -> None - client.admin.training_datasets.reset_pending(\*\*params) -> None - client.admin.training_datasets.size(\*\*params) -> TrainingDatasetSizeResponse - client.admin.training_datasets.update_datum(\*\*params) -> None +- client.admin.training_datasets.update_datum_status(\*\*params) -> None - client.admin.training_datasets.upload_datum(\*\*params) -> None # Datasets diff --git a/src/structify/resources/admin/training_datasets.py b/src/structify/resources/admin/training_datasets.py index a94e5277..3b25698e 100644 --- a/src/structify/resources/admin/training_datasets.py +++ b/src/structify/resources/admin/training_datasets.py @@ -35,7 +35,7 @@ training_dataset_get_step_by_id_params, training_dataset_get_labeller_stats_params, training_dataset_get_next_unverified_params, - training_dataset_mark_suspicious_datum_params, + training_dataset_update_datum_status_params, ) from ..._base_client import make_request_options from ...types.admin.training_datum_response import TrainingDatumResponse @@ -326,47 +326,6 @@ def list_datums( cast_to=TrainingDatasetListDatumsResponse, ) - def mark_suspicious_datum( - self, - *, - reason: str, - step_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._post( - "/admin/training_datasets/mark_suspicious_datum", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "reason": reason, - "step_id": step_id, - }, - training_dataset_mark_suspicious_datum_params.TrainingDatasetMarkSuspiciousDatumParams, - ), - ), - cast_to=NoneType, - ) - def remove_datum( self, *, @@ -531,6 +490,46 @@ def update_datum( cast_to=NoneType, ) + def update_datum_status( + self, + *, + id: str, + status: Literal["Unlabeled", "Labeled", "Verified", "Pending", "Skipped", "Suspicious"], + review_message: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._post( + "/admin/training_datasets/update_datum_status", + body=maybe_transform( + { + "id": id, + "status": status, + "review_message": review_message, + }, + training_dataset_update_datum_status_params.TrainingDatasetUpdateDatumStatusParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + def upload_datum( self, *, @@ -857,47 +856,6 @@ async def list_datums( cast_to=TrainingDatasetListDatumsResponse, ) - async def mark_suspicious_datum( - self, - *, - reason: str, - step_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> None: - """ - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._post( - "/admin/training_datasets/mark_suspicious_datum", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "reason": reason, - "step_id": step_id, - }, - training_dataset_mark_suspicious_datum_params.TrainingDatasetMarkSuspiciousDatumParams, - ), - ), - cast_to=NoneType, - ) - async def remove_datum( self, *, @@ -1062,6 +1020,46 @@ async def update_datum( cast_to=NoneType, ) + async def update_datum_status( + self, + *, + id: str, + status: Literal["Unlabeled", "Labeled", "Verified", "Pending", "Skipped", "Suspicious"], + review_message: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> None: + """ + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._post( + "/admin/training_datasets/update_datum_status", + body=await async_maybe_transform( + { + "id": id, + "status": status, + "review_message": review_message, + }, + training_dataset_update_datum_status_params.TrainingDatasetUpdateDatumStatusParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + async def upload_datum( self, *, @@ -1136,9 +1134,6 @@ def __init__(self, training_datasets: TrainingDatasetsResource) -> None: self.list_datums = to_raw_response_wrapper( training_datasets.list_datums, ) - self.mark_suspicious_datum = to_raw_response_wrapper( - training_datasets.mark_suspicious_datum, - ) self.remove_datum = to_raw_response_wrapper( training_datasets.remove_datum, ) @@ -1151,6 +1146,9 @@ def __init__(self, training_datasets: TrainingDatasetsResource) -> None: self.update_datum = to_raw_response_wrapper( training_datasets.update_datum, ) + self.update_datum_status = to_raw_response_wrapper( + training_datasets.update_datum_status, + ) self.upload_datum = to_raw_response_wrapper( training_datasets.upload_datum, ) @@ -1181,9 +1179,6 @@ def __init__(self, training_datasets: AsyncTrainingDatasetsResource) -> None: self.list_datums = async_to_raw_response_wrapper( training_datasets.list_datums, ) - self.mark_suspicious_datum = async_to_raw_response_wrapper( - training_datasets.mark_suspicious_datum, - ) self.remove_datum = async_to_raw_response_wrapper( training_datasets.remove_datum, ) @@ -1196,6 +1191,9 @@ def __init__(self, training_datasets: AsyncTrainingDatasetsResource) -> None: self.update_datum = async_to_raw_response_wrapper( training_datasets.update_datum, ) + self.update_datum_status = async_to_raw_response_wrapper( + training_datasets.update_datum_status, + ) self.upload_datum = async_to_raw_response_wrapper( training_datasets.upload_datum, ) @@ -1226,9 +1224,6 @@ def __init__(self, training_datasets: TrainingDatasetsResource) -> None: self.list_datums = to_streamed_response_wrapper( training_datasets.list_datums, ) - self.mark_suspicious_datum = to_streamed_response_wrapper( - training_datasets.mark_suspicious_datum, - ) self.remove_datum = to_streamed_response_wrapper( training_datasets.remove_datum, ) @@ -1241,6 +1236,9 @@ def __init__(self, training_datasets: TrainingDatasetsResource) -> None: self.update_datum = to_streamed_response_wrapper( training_datasets.update_datum, ) + self.update_datum_status = to_streamed_response_wrapper( + training_datasets.update_datum_status, + ) self.upload_datum = to_streamed_response_wrapper( training_datasets.upload_datum, ) @@ -1271,9 +1269,6 @@ def __init__(self, training_datasets: AsyncTrainingDatasetsResource) -> None: self.list_datums = async_to_streamed_response_wrapper( training_datasets.list_datums, ) - self.mark_suspicious_datum = async_to_streamed_response_wrapper( - training_datasets.mark_suspicious_datum, - ) self.remove_datum = async_to_streamed_response_wrapper( training_datasets.remove_datum, ) @@ -1286,6 +1281,9 @@ def __init__(self, training_datasets: AsyncTrainingDatasetsResource) -> None: self.update_datum = async_to_streamed_response_wrapper( training_datasets.update_datum, ) + self.update_datum_status = async_to_streamed_response_wrapper( + training_datasets.update_datum_status, + ) self.upload_datum = async_to_streamed_response_wrapper( training_datasets.upload_datum, ) diff --git a/src/structify/types/admin/__init__.py b/src/structify/types/admin/__init__.py index 7d5ec13e..1f5bfe2a 100644 --- a/src/structify/types/admin/__init__.py +++ b/src/structify/types/admin/__init__.py @@ -38,9 +38,9 @@ from .training_dataset_get_next_unverified_params import ( TrainingDatasetGetNextUnverifiedParams as TrainingDatasetGetNextUnverifiedParams, ) +from .training_dataset_update_datum_status_params import ( + TrainingDatasetUpdateDatumStatusParams as TrainingDatasetUpdateDatumStatusParams, +) from .training_dataset_get_labeller_stats_response import ( TrainingDatasetGetLabellerStatsResponse as TrainingDatasetGetLabellerStatsResponse, ) -from .training_dataset_mark_suspicious_datum_params import ( - TrainingDatasetMarkSuspiciousDatumParams as TrainingDatasetMarkSuspiciousDatumParams, -) diff --git a/src/structify/types/admin/training_dataset_mark_suspicious_datum_params.py b/src/structify/types/admin/training_dataset_mark_suspicious_datum_params.py deleted file mode 100644 index 0eda61d2..00000000 --- a/src/structify/types/admin/training_dataset_mark_suspicious_datum_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["TrainingDatasetMarkSuspiciousDatumParams"] - - -class TrainingDatasetMarkSuspiciousDatumParams(TypedDict, total=False): - reason: Required[str] - - step_id: Required[str] diff --git a/src/structify/types/admin/training_dataset_update_datum_status_params.py b/src/structify/types/admin/training_dataset_update_datum_status_params.py new file mode 100644 index 00000000..d1e0e6df --- /dev/null +++ b/src/structify/types/admin/training_dataset_update_datum_status_params.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["TrainingDatasetUpdateDatumStatusParams"] + + +class TrainingDatasetUpdateDatumStatusParams(TypedDict, total=False): + id: Required[str] + + status: Required[Literal["Unlabeled", "Labeled", "Verified", "Pending", "Skipped", "Suspicious"]] + + review_message: Optional[str] diff --git a/tests/api_resources/admin/test_training_datasets.py b/tests/api_resources/admin/test_training_datasets.py index 9b279c83..f5245830 100644 --- a/tests/api_resources/admin/test_training_datasets.py +++ b/tests/api_resources/admin/test_training_datasets.py @@ -251,40 +251,6 @@ def test_streaming_response_list_datums(self, client: Structify) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_mark_suspicious_datum(self, client: Structify) -> None: - training_dataset = client.admin.training_datasets.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert training_dataset is None - - @parametrize - def test_raw_response_mark_suspicious_datum(self, client: Structify) -> None: - response = client.admin.training_datasets.with_raw_response.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training_dataset = response.parse() - assert training_dataset is None - - @parametrize - def test_streaming_response_mark_suspicious_datum(self, client: Structify) -> None: - with client.admin.training_datasets.with_streaming_response.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training_dataset = response.parse() - assert training_dataset is None - - assert cast(Any, response.is_closed) is True - @parametrize def test_method_remove_datum(self, client: Structify) -> None: training_dataset = client.admin.training_datasets.remove_datum( @@ -440,6 +406,49 @@ def test_streaming_response_update_datum(self, client: Structify) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_update_datum_status(self, client: Structify) -> None: + training_dataset = client.admin.training_datasets.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) + assert training_dataset is None + + @parametrize + def test_method_update_datum_status_with_all_params(self, client: Structify) -> None: + training_dataset = client.admin.training_datasets.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + review_message="review_message", + ) + assert training_dataset is None + + @parametrize + def test_raw_response_update_datum_status(self, client: Structify) -> None: + response = client.admin.training_datasets.with_raw_response.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + training_dataset = response.parse() + assert training_dataset is None + + @parametrize + def test_streaming_response_update_datum_status(self, client: Structify) -> None: + with client.admin.training_datasets.with_streaming_response.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + training_dataset = response.parse() + assert training_dataset is None + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_upload_datum(self, client: Structify) -> None: training_dataset = client.admin.training_datasets.upload_datum( @@ -705,40 +714,6 @@ async def test_streaming_response_list_datums(self, async_client: AsyncStructify assert cast(Any, response.is_closed) is True - @parametrize - async def test_method_mark_suspicious_datum(self, async_client: AsyncStructify) -> None: - training_dataset = await async_client.admin.training_datasets.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - assert training_dataset is None - - @parametrize - async def test_raw_response_mark_suspicious_datum(self, async_client: AsyncStructify) -> None: - response = await async_client.admin.training_datasets.with_raw_response.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training_dataset = await response.parse() - assert training_dataset is None - - @parametrize - async def test_streaming_response_mark_suspicious_datum(self, async_client: AsyncStructify) -> None: - async with async_client.admin.training_datasets.with_streaming_response.mark_suspicious_datum( - reason="reason", - step_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training_dataset = await response.parse() - assert training_dataset is None - - assert cast(Any, response.is_closed) is True - @parametrize async def test_method_remove_datum(self, async_client: AsyncStructify) -> None: training_dataset = await async_client.admin.training_datasets.remove_datum( @@ -894,6 +869,49 @@ async def test_streaming_response_update_datum(self, async_client: AsyncStructif assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_update_datum_status(self, async_client: AsyncStructify) -> None: + training_dataset = await async_client.admin.training_datasets.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) + assert training_dataset is None + + @parametrize + async def test_method_update_datum_status_with_all_params(self, async_client: AsyncStructify) -> None: + training_dataset = await async_client.admin.training_datasets.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + review_message="review_message", + ) + assert training_dataset is None + + @parametrize + async def test_raw_response_update_datum_status(self, async_client: AsyncStructify) -> None: + response = await async_client.admin.training_datasets.with_raw_response.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + training_dataset = await response.parse() + assert training_dataset is None + + @parametrize + async def test_streaming_response_update_datum_status(self, async_client: AsyncStructify) -> None: + async with async_client.admin.training_datasets.with_streaming_response.update_datum_status( + id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + status="Unlabeled", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + training_dataset = await response.parse() + assert training_dataset is None + + assert cast(Any, response.is_closed) is True + @parametrize async def test_method_upload_datum(self, async_client: AsyncStructify) -> None: training_dataset = await async_client.admin.training_datasets.upload_datum(