diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 354c2fa8..c9da8cc1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.23.1" + ".": "0.23.2" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9f47e6b1..ae97cfa3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ -configured_endpoints: 29 -openapi_spec_hash: 20caa671b1b1a87c0a5cb6ebd7e4b064 -config_hash: aaf12ae1da71c62ca5195fc2b66f657c +configured_endpoints: 31 +openapi_spec_hash: a574ef9082e992c25120554886a9ab7a +config_hash: f8fb410519268f9f228074c9344acc1f diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ce42d88..f2606382 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.23.2 (2026-04-10) + +Full Changelog: [v0.23.1...v0.23.2](https://github.com/openlayer-ai/openlayer-python/compare/v0.23.1...v0.23.2) + +### Documentation + +* **closes OPEN-9953:** expose endpoints to get and delete a row ([1f08bda](https://github.com/openlayer-ai/openlayer-python/commit/1f08bda3f3295151b54f82f36e8ef11aaabac05e)) + ## 0.23.1 (2026-04-08) Full Changelog: [v0.23.0...v0.23.1](https://github.com/openlayer-ai/openlayer-python/compare/v0.23.0...v0.23.1) diff --git a/api.md b/api.md index 6b64c75b..40934640 100644 --- a/api.md +++ b/api.md @@ -152,13 +152,19 @@ Methods: Types: ```python -from openlayer.types.inference_pipelines import RowUpdateResponse, RowListResponse +from openlayer.types.inference_pipelines import ( + RowRetrieveResponse, + RowUpdateResponse, + RowListResponse, +) ``` Methods: +- client.inference_pipelines.rows.retrieve(inference_id, \*, inference_pipeline_id) -> RowRetrieveResponse - client.inference_pipelines.rows.update(inference_pipeline_id, \*\*params) -> RowUpdateResponse - client.inference_pipelines.rows.list(inference_pipeline_id, \*\*params) -> RowListResponse +- client.inference_pipelines.rows.delete(inference_id, \*, inference_pipeline_id) -> None ## TestResults diff --git a/pyproject.toml b/pyproject.toml index 809e5943..33895b9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openlayer" -version = "0.23.1" +version = "0.23.2" description = "The official Python library for the openlayer API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openlayer/_version.py b/src/openlayer/_version.py index 0e0c0a74..03527711 100644 --- a/src/openlayer/_version.py +++ b/src/openlayer/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "openlayer" -__version__ = "0.23.1" # x-release-please-version +__version__ = "0.23.2" # x-release-please-version diff --git a/src/openlayer/resources/inference_pipelines/rows.py b/src/openlayer/resources/inference_pipelines/rows.py index 16426073..5f2b18cc 100644 --- a/src/openlayer/resources/inference_pipelines/rows.py +++ b/src/openlayer/resources/inference_pipelines/rows.py @@ -6,7 +6,7 @@ import httpx -from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -20,6 +20,7 @@ from ...types.inference_pipelines import row_list_params, row_update_params from ...types.inference_pipelines.row_list_response import RowListResponse from ...types.inference_pipelines.row_update_response import RowUpdateResponse +from ...types.inference_pipelines.row_retrieve_response import RowRetrieveResponse __all__ = ["RowsResource", "AsyncRowsResource"] @@ -44,6 +45,48 @@ def with_streaming_response(self) -> RowsResourceWithStreamingResponse: """ return RowsResourceWithStreamingResponse(self) + def retrieve( + self, + inference_id: str, + *, + inference_pipeline_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, + ) -> RowRetrieveResponse: + """ + Fetch a single inference pipeline row by inference ID, including OTel steps. + + 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 + """ + if not inference_pipeline_id: + raise ValueError( + f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}" + ) + if not inference_id: + raise ValueError(f"Expected a non-empty value for `inference_id` but received {inference_id!r}") + return self._get( + path_template( + "/inference-pipelines/{inference_pipeline_id}/rows/{inference_id}", + inference_pipeline_id=inference_pipeline_id, + inference_id=inference_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RowRetrieveResponse, + ) + def update( self, inference_pipeline_id: str, @@ -177,6 +220,51 @@ def list( cast_to=RowListResponse, ) + def delete( + self, + inference_id: str, + *, + inference_pipeline_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: + """Delete a single inference pipeline row by inference ID. + + Only project admins can + perform this action. + + 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 + """ + if not inference_pipeline_id: + raise ValueError( + f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}" + ) + if not inference_id: + raise ValueError(f"Expected a non-empty value for `inference_id` but received {inference_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + path_template( + "/inference-pipelines/{inference_pipeline_id}/rows/{inference_id}", + inference_pipeline_id=inference_pipeline_id, + inference_id=inference_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class AsyncRowsResource(AsyncAPIResource): @cached_property @@ -198,6 +286,48 @@ def with_streaming_response(self) -> AsyncRowsResourceWithStreamingResponse: """ return AsyncRowsResourceWithStreamingResponse(self) + async def retrieve( + self, + inference_id: str, + *, + inference_pipeline_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, + ) -> RowRetrieveResponse: + """ + Fetch a single inference pipeline row by inference ID, including OTel steps. + + 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 + """ + if not inference_pipeline_id: + raise ValueError( + f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}" + ) + if not inference_id: + raise ValueError(f"Expected a non-empty value for `inference_id` but received {inference_id!r}") + return await self._get( + path_template( + "/inference-pipelines/{inference_pipeline_id}/rows/{inference_id}", + inference_pipeline_id=inference_pipeline_id, + inference_id=inference_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=RowRetrieveResponse, + ) + async def update( self, inference_pipeline_id: str, @@ -331,50 +461,119 @@ async def list( cast_to=RowListResponse, ) + async def delete( + self, + inference_id: str, + *, + inference_pipeline_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: + """Delete a single inference pipeline row by inference ID. + + Only project admins can + perform this action. + + 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 + """ + if not inference_pipeline_id: + raise ValueError( + f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}" + ) + if not inference_id: + raise ValueError(f"Expected a non-empty value for `inference_id` but received {inference_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + path_template( + "/inference-pipelines/{inference_pipeline_id}/rows/{inference_id}", + inference_pipeline_id=inference_pipeline_id, + inference_id=inference_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class RowsResourceWithRawResponse: def __init__(self, rows: RowsResource) -> None: self._rows = rows + self.retrieve = to_raw_response_wrapper( + rows.retrieve, + ) self.update = to_raw_response_wrapper( rows.update, ) self.list = to_raw_response_wrapper( rows.list, ) + self.delete = to_raw_response_wrapper( + rows.delete, + ) class AsyncRowsResourceWithRawResponse: def __init__(self, rows: AsyncRowsResource) -> None: self._rows = rows + self.retrieve = async_to_raw_response_wrapper( + rows.retrieve, + ) self.update = async_to_raw_response_wrapper( rows.update, ) self.list = async_to_raw_response_wrapper( rows.list, ) + self.delete = async_to_raw_response_wrapper( + rows.delete, + ) class RowsResourceWithStreamingResponse: def __init__(self, rows: RowsResource) -> None: self._rows = rows + self.retrieve = to_streamed_response_wrapper( + rows.retrieve, + ) self.update = to_streamed_response_wrapper( rows.update, ) self.list = to_streamed_response_wrapper( rows.list, ) + self.delete = to_streamed_response_wrapper( + rows.delete, + ) class AsyncRowsResourceWithStreamingResponse: def __init__(self, rows: AsyncRowsResource) -> None: self._rows = rows + self.retrieve = async_to_streamed_response_wrapper( + rows.retrieve, + ) self.update = async_to_streamed_response_wrapper( rows.update, ) self.list = async_to_streamed_response_wrapper( rows.list, ) + self.delete = async_to_streamed_response_wrapper( + rows.delete, + ) diff --git a/src/openlayer/types/inference_pipelines/__init__.py b/src/openlayer/types/inference_pipelines/__init__.py index d18f6463..e21d43f6 100644 --- a/src/openlayer/types/inference_pipelines/__init__.py +++ b/src/openlayer/types/inference_pipelines/__init__.py @@ -8,5 +8,6 @@ from .data_stream_params import DataStreamParams as DataStreamParams from .row_update_response import RowUpdateResponse as RowUpdateResponse from .data_stream_response import DataStreamResponse as DataStreamResponse +from .row_retrieve_response import RowRetrieveResponse as RowRetrieveResponse from .test_result_list_params import TestResultListParams as TestResultListParams from .test_result_list_response import TestResultListResponse as TestResultListResponse diff --git a/src/openlayer/types/inference_pipelines/row_retrieve_response.py b/src/openlayer/types/inference_pipelines/row_retrieve_response.py new file mode 100644 index 00000000..2255773d --- /dev/null +++ b/src/openlayer/types/inference_pipelines/row_retrieve_response.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["RowRetrieveResponse"] + + +class RowRetrieveResponse(BaseModel): + row: Optional[object] = None + + success: Optional[bool] = None diff --git a/tests/api_resources/inference_pipelines/test_rows.py b/tests/api_resources/inference_pipelines/test_rows.py index 4111e517..710efd12 100644 --- a/tests/api_resources/inference_pipelines/test_rows.py +++ b/tests/api_resources/inference_pipelines/test_rows.py @@ -9,7 +9,11 @@ from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.inference_pipelines import RowListResponse, RowUpdateResponse +from openlayer.types.inference_pipelines import ( + RowListResponse, + RowUpdateResponse, + RowRetrieveResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -17,6 +21,54 @@ class TestRows: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_retrieve(self, client: Openlayer) -> None: + row = client.inference_pipelines.rows.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Openlayer) -> None: + response = client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + row = response.parse() + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Openlayer) -> None: + with client.inference_pipelines.rows.with_streaming_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + row = response.parse() + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Openlayer) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_pipeline_id` but received ''"): + client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_id` but received ''"): + client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + @parametrize def test_method_update(self, client: Openlayer) -> None: row = client.inference_pipelines.rows.update( @@ -141,12 +193,108 @@ def test_path_params_list(self, client: Openlayer) -> None: inference_pipeline_id="", ) + @parametrize + def test_method_delete(self, client: Openlayer) -> None: + row = client.inference_pipelines.rows.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert row is None + + @parametrize + def test_raw_response_delete(self, client: Openlayer) -> None: + response = client.inference_pipelines.rows.with_raw_response.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + row = response.parse() + assert row is None + + @parametrize + def test_streaming_response_delete(self, client: Openlayer) -> None: + with client.inference_pipelines.rows.with_streaming_response.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + row = response.parse() + assert row is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_delete(self, client: Openlayer) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_pipeline_id` but received ''"): + client.inference_pipelines.rows.with_raw_response.delete( + inference_id="inferenceId", + inference_pipeline_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_id` but received ''"): + client.inference_pipelines.rows.with_raw_response.delete( + inference_id="", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + class TestAsyncRows: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) + @parametrize + async def test_method_retrieve(self, async_client: AsyncOpenlayer) -> None: + row = await async_client.inference_pipelines.rows.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncOpenlayer) -> None: + response = await async_client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + row = await response.parse() + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncOpenlayer) -> None: + async with async_client.inference_pipelines.rows.with_streaming_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + row = await response.parse() + assert_matches_type(RowRetrieveResponse, row, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncOpenlayer) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_pipeline_id` but received ''"): + await async_client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="inferenceId", + inference_pipeline_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_id` but received ''"): + await async_client.inference_pipelines.rows.with_raw_response.retrieve( + inference_id="", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + @parametrize async def test_method_update(self, async_client: AsyncOpenlayer) -> None: row = await async_client.inference_pipelines.rows.update( @@ -270,3 +418,51 @@ async def test_path_params_list(self, async_client: AsyncOpenlayer) -> None: await async_client.inference_pipelines.rows.with_raw_response.list( inference_pipeline_id="", ) + + @parametrize + async def test_method_delete(self, async_client: AsyncOpenlayer) -> None: + row = await async_client.inference_pipelines.rows.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert row is None + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncOpenlayer) -> None: + response = await async_client.inference_pipelines.rows.with_raw_response.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + row = await response.parse() + assert row is None + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncOpenlayer) -> None: + async with async_client.inference_pipelines.rows.with_streaming_response.delete( + inference_id="inferenceId", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + row = await response.parse() + assert row is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_delete(self, async_client: AsyncOpenlayer) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_pipeline_id` but received ''"): + await async_client.inference_pipelines.rows.with_raw_response.delete( + inference_id="inferenceId", + inference_pipeline_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inference_id` but received ''"): + await async_client.inference_pipelines.rows.with_raw_response.delete( + inference_id="", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + )