-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): update via SDK Studio (#262)
- Loading branch information
1 parent
1b800ac
commit 5d70200
Showing
9 changed files
with
446 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 8 | ||
configured_endpoints: 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Optional | ||
|
||
import httpx | ||
|
||
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven | ||
from ..._utils import ( | ||
maybe_transform, | ||
async_maybe_transform, | ||
) | ||
from ..._compat import cached_property | ||
from ..._resource import SyncAPIResource, AsyncAPIResource | ||
from ..._response import ( | ||
to_raw_response_wrapper, | ||
to_streamed_response_wrapper, | ||
async_to_raw_response_wrapper, | ||
async_to_streamed_response_wrapper, | ||
) | ||
from ..._base_client import make_request_options | ||
from ...types.inference_pipelines import row_stream_params | ||
from ...types.inference_pipelines.row_stream_response import RowStreamResponse | ||
|
||
__all__ = ["RowsResource", "AsyncRowsResource"] | ||
|
||
|
||
class RowsResource(SyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> RowsResourceWithRawResponse: | ||
return RowsResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> RowsResourceWithStreamingResponse: | ||
return RowsResourceWithStreamingResponse(self) | ||
|
||
def stream( | ||
self, | ||
inference_pipeline_id: str, | ||
*, | ||
inference_id: str, | ||
row: object, | ||
config: Optional[row_stream_params.Config] | 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, | ||
) -> RowStreamResponse: | ||
""" | ||
Update an inference data point in an inference pipeline. | ||
Args: | ||
inference_id: Specify the inference id as a query param. | ||
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}" | ||
) | ||
return self._put( | ||
f"/inference-pipelines/{inference_pipeline_id}/rows", | ||
body=maybe_transform( | ||
{ | ||
"row": row, | ||
"config": config, | ||
}, | ||
row_stream_params.RowStreamParams, | ||
), | ||
options=make_request_options( | ||
extra_headers=extra_headers, | ||
extra_query=extra_query, | ||
extra_body=extra_body, | ||
timeout=timeout, | ||
query=maybe_transform({"inference_id": inference_id}, row_stream_params.RowStreamParams), | ||
), | ||
cast_to=RowStreamResponse, | ||
) | ||
|
||
|
||
class AsyncRowsResource(AsyncAPIResource): | ||
@cached_property | ||
def with_raw_response(self) -> AsyncRowsResourceWithRawResponse: | ||
return AsyncRowsResourceWithRawResponse(self) | ||
|
||
@cached_property | ||
def with_streaming_response(self) -> AsyncRowsResourceWithStreamingResponse: | ||
return AsyncRowsResourceWithStreamingResponse(self) | ||
|
||
async def stream( | ||
self, | ||
inference_pipeline_id: str, | ||
*, | ||
inference_id: str, | ||
row: object, | ||
config: Optional[row_stream_params.Config] | 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, | ||
) -> RowStreamResponse: | ||
""" | ||
Update an inference data point in an inference pipeline. | ||
Args: | ||
inference_id: Specify the inference id as a query param. | ||
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}" | ||
) | ||
return await self._put( | ||
f"/inference-pipelines/{inference_pipeline_id}/rows", | ||
body=await async_maybe_transform( | ||
{ | ||
"row": row, | ||
"config": config, | ||
}, | ||
row_stream_params.RowStreamParams, | ||
), | ||
options=make_request_options( | ||
extra_headers=extra_headers, | ||
extra_query=extra_query, | ||
extra_body=extra_body, | ||
timeout=timeout, | ||
query=await async_maybe_transform({"inference_id": inference_id}, row_stream_params.RowStreamParams), | ||
), | ||
cast_to=RowStreamResponse, | ||
) | ||
|
||
|
||
class RowsResourceWithRawResponse: | ||
def __init__(self, rows: RowsResource) -> None: | ||
self._rows = rows | ||
|
||
self.stream = to_raw_response_wrapper( | ||
rows.stream, | ||
) | ||
|
||
|
||
class AsyncRowsResourceWithRawResponse: | ||
def __init__(self, rows: AsyncRowsResource) -> None: | ||
self._rows = rows | ||
|
||
self.stream = async_to_raw_response_wrapper( | ||
rows.stream, | ||
) | ||
|
||
|
||
class RowsResourceWithStreamingResponse: | ||
def __init__(self, rows: RowsResource) -> None: | ||
self._rows = rows | ||
|
||
self.stream = to_streamed_response_wrapper( | ||
rows.stream, | ||
) | ||
|
||
|
||
class AsyncRowsResourceWithStreamingResponse: | ||
def __init__(self, rows: AsyncRowsResource) -> None: | ||
self._rows = rows | ||
|
||
self.stream = async_to_streamed_response_wrapper( | ||
rows.stream, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/openlayer/types/inference_pipelines/row_stream_params.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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 Required, Annotated, TypedDict | ||
|
||
from ..._utils import PropertyInfo | ||
|
||
__all__ = ["RowStreamParams", "Config"] | ||
|
||
|
||
class RowStreamParams(TypedDict, total=False): | ||
inference_id: Required[Annotated[str, PropertyInfo(alias="inferenceId")]] | ||
"""Specify the inference id as a query param.""" | ||
|
||
row: Required[object] | ||
|
||
config: Optional[Config] | ||
|
||
|
||
class Config(TypedDict, total=False): | ||
ground_truth_column_name: Annotated[Optional[str], PropertyInfo(alias="groundTruthColumnName")] | ||
"""Name of the column with the ground truths.""" | ||
|
||
human_feedback_column_name: Annotated[Optional[str], PropertyInfo(alias="humanFeedbackColumnName")] | ||
"""Name of the column with human feedback.""" | ||
|
||
inference_id_column_name: Annotated[Optional[str], PropertyInfo(alias="inferenceIdColumnName")] | ||
"""Name of the column with the inference ids. | ||
This is useful if you want to update rows at a later point in time. If not | ||
provided, a unique id is generated by Openlayer. | ||
""" | ||
|
||
latency_column_name: Annotated[Optional[str], PropertyInfo(alias="latencyColumnName")] | ||
"""Name of the column with the latencies.""" | ||
|
||
timestamp_column_name: Annotated[Optional[str], PropertyInfo(alias="timestampColumnName")] | ||
"""Name of the column with the timestamps. | ||
Timestamps must be in UNIX sec format. If not provided, the upload timestamp is | ||
used. | ||
""" |
11 changes: 11 additions & 0 deletions
11
src/openlayer/types/inference_pipelines/row_stream_response.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
from typing_extensions import Literal | ||
|
||
from ..._models import BaseModel | ||
|
||
__all__ = ["RowStreamResponse"] | ||
|
||
|
||
class RowStreamResponse(BaseModel): | ||
success: Literal[True] |
Oops, something went wrong.