Skip to content

Commit

Permalink
feat(api): api update (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Dec 12, 2024
1 parent 9f06d6f commit 3021a8f
Show file tree
Hide file tree
Showing 7 changed files with 200 additions and 181 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ Methods:
- <code title="get /admin/training_datasets/next_unverified">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">get_next_unverified</a>(\*\*<a href="src/structify/types/admin/training_dataset_get_next_unverified_params.py">params</a>) -> <a href="./src/structify/types/admin/training_datum_response.py">TrainingDatumResponse</a></code>
- <code title="get /admin/training_datasets/get_step_by_id">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">get_step_by_id</a>(\*\*<a href="src/structify/types/admin/training_dataset_get_step_by_id_params.py">params</a>) -> <a href="./src/structify/types/admin/training_datum_response.py">TrainingDatumResponse</a></code>
- <code title="get /admin/training_datasets/list_datums">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">list_datums</a>(\*\*<a href="src/structify/types/admin/training_dataset_list_datums_params.py">params</a>) -> <a href="./src/structify/types/admin/training_dataset_list_datums_response.py">TrainingDatasetListDatumsResponse</a></code>
- <code title="post /admin/training_datasets/mark_suspicious_datum">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">mark_suspicious_datum</a>(\*\*<a href="src/structify/types/admin/training_dataset_mark_suspicious_datum_params.py">params</a>) -> None</code>
- <code title="delete /admin/training_datasets/remove_datum">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">remove_datum</a>(\*\*<a href="src/structify/types/admin/training_dataset_remove_datum_params.py">params</a>) -> None</code>
- <code title="post /admin/training_datasets/reset_pending">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">reset_pending</a>(\*\*<a href="src/structify/types/admin/training_dataset_reset_pending_params.py">params</a>) -> None</code>
- <code title="post /admin/training_datasets/size">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">size</a>(\*\*<a href="src/structify/types/admin/training_dataset_size_params.py">params</a>) -> <a href="./src/structify/types/admin/training_dataset_size_response.py">TrainingDatasetSizeResponse</a></code>
- <code title="put /admin/training_datasets/update_datum">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">update_datum</a>(\*\*<a href="src/structify/types/admin/training_dataset_update_datum_params.py">params</a>) -> None</code>
- <code title="post /admin/training_datasets/update_datum_status">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">update_datum_status</a>(\*\*<a href="src/structify/types/admin/training_dataset_update_datum_status_params.py">params</a>) -> None</code>
- <code title="post /admin/training_datasets/upload_datum">client.admin.training_datasets.<a href="./src/structify/resources/admin/training_datasets.py">upload_datum</a>(\*\*<a href="src/structify/types/admin/training_dataset_upload_datum_params.py">params</a>) -> None</code>

# Datasets
Expand Down
188 changes: 93 additions & 95 deletions src/structify/resources/admin/training_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
*,
Expand Down Expand Up @@ -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,
*,
Expand Down Expand Up @@ -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,
*,
Expand Down Expand Up @@ -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,
*,
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
Expand Down Expand Up @@ -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,
)
Expand All @@ -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,
)
6 changes: 3 additions & 3 deletions src/structify/types/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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]
Loading

0 comments on commit 3021a8f

Please sign in to comment.