Skip to content

Commit b8718de

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): update via SDK Studio (#262)
1 parent b8bcee3 commit b8718de

File tree

9 files changed

+446
-1
lines changed

9 files changed

+446
-1
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 8
1+
configured_endpoints: 9

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ Methods:
6464

6565
- <code title="post /inference-pipelines/{inferencePipelineId}/data-stream">client.inference_pipelines.data.<a href="./src/openlayer/resources/inference_pipelines/data.py">stream</a>(inference_pipeline_id, \*\*<a href="src/openlayer/types/inference_pipelines/data_stream_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipelines/data_stream_response.py">DataStreamResponse</a></code>
6666

67+
## Rows
68+
69+
Types:
70+
71+
```python
72+
from openlayer.types.inference_pipelines import RowStreamResponse
73+
```
74+
75+
Methods:
76+
77+
- <code title="put /inference-pipelines/{inferencePipelineId}/rows">client.inference_pipelines.rows.<a href="./src/openlayer/resources/inference_pipelines/rows.py">stream</a>(inference_pipeline_id, \*\*<a href="src/openlayer/types/inference_pipelines/row_stream_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipelines/row_stream_response.py">RowStreamResponse</a></code>
78+
6779
## TestResults
6880

6981
Types:

src/openlayer/resources/inference_pipelines/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
DataResourceWithStreamingResponse,
99
AsyncDataResourceWithStreamingResponse,
1010
)
11+
from .rows import (
12+
RowsResource,
13+
AsyncRowsResource,
14+
RowsResourceWithRawResponse,
15+
AsyncRowsResourceWithRawResponse,
16+
RowsResourceWithStreamingResponse,
17+
AsyncRowsResourceWithStreamingResponse,
18+
)
1119
from .test_results import (
1220
TestResultsResource,
1321
AsyncTestResultsResource,
@@ -32,6 +40,12 @@
3240
"AsyncDataResourceWithRawResponse",
3341
"DataResourceWithStreamingResponse",
3442
"AsyncDataResourceWithStreamingResponse",
43+
"RowsResource",
44+
"AsyncRowsResource",
45+
"RowsResourceWithRawResponse",
46+
"AsyncRowsResourceWithRawResponse",
47+
"RowsResourceWithStreamingResponse",
48+
"AsyncRowsResourceWithStreamingResponse",
3549
"TestResultsResource",
3650
"AsyncTestResultsResource",
3751
"TestResultsResourceWithRawResponse",

src/openlayer/resources/inference_pipelines/inference_pipelines.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
DataResourceWithStreamingResponse,
1111
AsyncDataResourceWithStreamingResponse,
1212
)
13+
from .rows import (
14+
RowsResource,
15+
AsyncRowsResource,
16+
RowsResourceWithRawResponse,
17+
AsyncRowsResourceWithRawResponse,
18+
RowsResourceWithStreamingResponse,
19+
AsyncRowsResourceWithStreamingResponse,
20+
)
1321
from ..._compat import cached_property
1422
from ..._resource import SyncAPIResource, AsyncAPIResource
1523
from .test_results import (
@@ -29,6 +37,10 @@ class InferencePipelinesResource(SyncAPIResource):
2937
def data(self) -> DataResource:
3038
return DataResource(self._client)
3139

40+
@cached_property
41+
def rows(self) -> RowsResource:
42+
return RowsResource(self._client)
43+
3244
@cached_property
3345
def test_results(self) -> TestResultsResource:
3446
return TestResultsResource(self._client)
@@ -47,6 +59,10 @@ class AsyncInferencePipelinesResource(AsyncAPIResource):
4759
def data(self) -> AsyncDataResource:
4860
return AsyncDataResource(self._client)
4961

62+
@cached_property
63+
def rows(self) -> AsyncRowsResource:
64+
return AsyncRowsResource(self._client)
65+
5066
@cached_property
5167
def test_results(self) -> AsyncTestResultsResource:
5268
return AsyncTestResultsResource(self._client)
@@ -68,6 +84,10 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
6884
def data(self) -> DataResourceWithRawResponse:
6985
return DataResourceWithRawResponse(self._inference_pipelines.data)
7086

87+
@cached_property
88+
def rows(self) -> RowsResourceWithRawResponse:
89+
return RowsResourceWithRawResponse(self._inference_pipelines.rows)
90+
7191
@cached_property
7292
def test_results(self) -> TestResultsResourceWithRawResponse:
7393
return TestResultsResourceWithRawResponse(self._inference_pipelines.test_results)
@@ -81,6 +101,10 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
81101
def data(self) -> AsyncDataResourceWithRawResponse:
82102
return AsyncDataResourceWithRawResponse(self._inference_pipelines.data)
83103

104+
@cached_property
105+
def rows(self) -> AsyncRowsResourceWithRawResponse:
106+
return AsyncRowsResourceWithRawResponse(self._inference_pipelines.rows)
107+
84108
@cached_property
85109
def test_results(self) -> AsyncTestResultsResourceWithRawResponse:
86110
return AsyncTestResultsResourceWithRawResponse(self._inference_pipelines.test_results)
@@ -94,6 +118,10 @@ def __init__(self, inference_pipelines: InferencePipelinesResource) -> None:
94118
def data(self) -> DataResourceWithStreamingResponse:
95119
return DataResourceWithStreamingResponse(self._inference_pipelines.data)
96120

121+
@cached_property
122+
def rows(self) -> RowsResourceWithStreamingResponse:
123+
return RowsResourceWithStreamingResponse(self._inference_pipelines.rows)
124+
97125
@cached_property
98126
def test_results(self) -> TestResultsResourceWithStreamingResponse:
99127
return TestResultsResourceWithStreamingResponse(self._inference_pipelines.test_results)
@@ -107,6 +135,10 @@ def __init__(self, inference_pipelines: AsyncInferencePipelinesResource) -> None
107135
def data(self) -> AsyncDataResourceWithStreamingResponse:
108136
return AsyncDataResourceWithStreamingResponse(self._inference_pipelines.data)
109137

138+
@cached_property
139+
def rows(self) -> AsyncRowsResourceWithStreamingResponse:
140+
return AsyncRowsResourceWithStreamingResponse(self._inference_pipelines.rows)
141+
110142
@cached_property
111143
def test_results(self) -> AsyncTestResultsResourceWithStreamingResponse:
112144
return AsyncTestResultsResourceWithStreamingResponse(self._inference_pipelines.test_results)
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
7+
import httpx
8+
9+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10+
from ..._utils import (
11+
maybe_transform,
12+
async_maybe_transform,
13+
)
14+
from ..._compat import cached_property
15+
from ..._resource import SyncAPIResource, AsyncAPIResource
16+
from ..._response import (
17+
to_raw_response_wrapper,
18+
to_streamed_response_wrapper,
19+
async_to_raw_response_wrapper,
20+
async_to_streamed_response_wrapper,
21+
)
22+
from ..._base_client import make_request_options
23+
from ...types.inference_pipelines import row_stream_params
24+
from ...types.inference_pipelines.row_stream_response import RowStreamResponse
25+
26+
__all__ = ["RowsResource", "AsyncRowsResource"]
27+
28+
29+
class RowsResource(SyncAPIResource):
30+
@cached_property
31+
def with_raw_response(self) -> RowsResourceWithRawResponse:
32+
return RowsResourceWithRawResponse(self)
33+
34+
@cached_property
35+
def with_streaming_response(self) -> RowsResourceWithStreamingResponse:
36+
return RowsResourceWithStreamingResponse(self)
37+
38+
def stream(
39+
self,
40+
inference_pipeline_id: str,
41+
*,
42+
inference_id: str,
43+
row: object,
44+
config: Optional[row_stream_params.Config] | NotGiven = NOT_GIVEN,
45+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
46+
# The extra values given here take precedence over values defined on the client or passed to this method.
47+
extra_headers: Headers | None = None,
48+
extra_query: Query | None = None,
49+
extra_body: Body | None = None,
50+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
51+
) -> RowStreamResponse:
52+
"""
53+
Update an inference data point in an inference pipeline.
54+
55+
Args:
56+
inference_id: Specify the inference id as a query param.
57+
58+
extra_headers: Send extra headers
59+
60+
extra_query: Add additional query parameters to the request
61+
62+
extra_body: Add additional JSON properties to the request
63+
64+
timeout: Override the client-level default timeout for this request, in seconds
65+
"""
66+
if not inference_pipeline_id:
67+
raise ValueError(
68+
f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}"
69+
)
70+
return self._put(
71+
f"/inference-pipelines/{inference_pipeline_id}/rows",
72+
body=maybe_transform(
73+
{
74+
"row": row,
75+
"config": config,
76+
},
77+
row_stream_params.RowStreamParams,
78+
),
79+
options=make_request_options(
80+
extra_headers=extra_headers,
81+
extra_query=extra_query,
82+
extra_body=extra_body,
83+
timeout=timeout,
84+
query=maybe_transform({"inference_id": inference_id}, row_stream_params.RowStreamParams),
85+
),
86+
cast_to=RowStreamResponse,
87+
)
88+
89+
90+
class AsyncRowsResource(AsyncAPIResource):
91+
@cached_property
92+
def with_raw_response(self) -> AsyncRowsResourceWithRawResponse:
93+
return AsyncRowsResourceWithRawResponse(self)
94+
95+
@cached_property
96+
def with_streaming_response(self) -> AsyncRowsResourceWithStreamingResponse:
97+
return AsyncRowsResourceWithStreamingResponse(self)
98+
99+
async def stream(
100+
self,
101+
inference_pipeline_id: str,
102+
*,
103+
inference_id: str,
104+
row: object,
105+
config: Optional[row_stream_params.Config] | NotGiven = NOT_GIVEN,
106+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
107+
# The extra values given here take precedence over values defined on the client or passed to this method.
108+
extra_headers: Headers | None = None,
109+
extra_query: Query | None = None,
110+
extra_body: Body | None = None,
111+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
112+
) -> RowStreamResponse:
113+
"""
114+
Update an inference data point in an inference pipeline.
115+
116+
Args:
117+
inference_id: Specify the inference id as a query param.
118+
119+
extra_headers: Send extra headers
120+
121+
extra_query: Add additional query parameters to the request
122+
123+
extra_body: Add additional JSON properties to the request
124+
125+
timeout: Override the client-level default timeout for this request, in seconds
126+
"""
127+
if not inference_pipeline_id:
128+
raise ValueError(
129+
f"Expected a non-empty value for `inference_pipeline_id` but received {inference_pipeline_id!r}"
130+
)
131+
return await self._put(
132+
f"/inference-pipelines/{inference_pipeline_id}/rows",
133+
body=await async_maybe_transform(
134+
{
135+
"row": row,
136+
"config": config,
137+
},
138+
row_stream_params.RowStreamParams,
139+
),
140+
options=make_request_options(
141+
extra_headers=extra_headers,
142+
extra_query=extra_query,
143+
extra_body=extra_body,
144+
timeout=timeout,
145+
query=await async_maybe_transform({"inference_id": inference_id}, row_stream_params.RowStreamParams),
146+
),
147+
cast_to=RowStreamResponse,
148+
)
149+
150+
151+
class RowsResourceWithRawResponse:
152+
def __init__(self, rows: RowsResource) -> None:
153+
self._rows = rows
154+
155+
self.stream = to_raw_response_wrapper(
156+
rows.stream,
157+
)
158+
159+
160+
class AsyncRowsResourceWithRawResponse:
161+
def __init__(self, rows: AsyncRowsResource) -> None:
162+
self._rows = rows
163+
164+
self.stream = async_to_raw_response_wrapper(
165+
rows.stream,
166+
)
167+
168+
169+
class RowsResourceWithStreamingResponse:
170+
def __init__(self, rows: RowsResource) -> None:
171+
self._rows = rows
172+
173+
self.stream = to_streamed_response_wrapper(
174+
rows.stream,
175+
)
176+
177+
178+
class AsyncRowsResourceWithStreamingResponse:
179+
def __init__(self, rows: AsyncRowsResource) -> None:
180+
self._rows = rows
181+
182+
self.stream = async_to_streamed_response_wrapper(
183+
rows.stream,
184+
)

src/openlayer/types/inference_pipelines/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from __future__ import annotations
44

5+
from .row_stream_params import RowStreamParams as RowStreamParams
56
from .data_stream_params import DataStreamParams as DataStreamParams
7+
from .row_stream_response import RowStreamResponse as RowStreamResponse
68
from .data_stream_response import DataStreamResponse as DataStreamResponse
79
from .test_result_list_params import TestResultListParams as TestResultListParams
810
from .test_result_list_response import TestResultListResponse as TestResultListResponse
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Optional
6+
from typing_extensions import Required, Annotated, TypedDict
7+
8+
from ..._utils import PropertyInfo
9+
10+
__all__ = ["RowStreamParams", "Config"]
11+
12+
13+
class RowStreamParams(TypedDict, total=False):
14+
inference_id: Required[Annotated[str, PropertyInfo(alias="inferenceId")]]
15+
"""Specify the inference id as a query param."""
16+
17+
row: Required[object]
18+
19+
config: Optional[Config]
20+
21+
22+
class Config(TypedDict, total=False):
23+
ground_truth_column_name: Annotated[Optional[str], PropertyInfo(alias="groundTruthColumnName")]
24+
"""Name of the column with the ground truths."""
25+
26+
human_feedback_column_name: Annotated[Optional[str], PropertyInfo(alias="humanFeedbackColumnName")]
27+
"""Name of the column with human feedback."""
28+
29+
inference_id_column_name: Annotated[Optional[str], PropertyInfo(alias="inferenceIdColumnName")]
30+
"""Name of the column with the inference ids.
31+
32+
This is useful if you want to update rows at a later point in time. If not
33+
provided, a unique id is generated by Openlayer.
34+
"""
35+
36+
latency_column_name: Annotated[Optional[str], PropertyInfo(alias="latencyColumnName")]
37+
"""Name of the column with the latencies."""
38+
39+
timestamp_column_name: Annotated[Optional[str], PropertyInfo(alias="timestampColumnName")]
40+
"""Name of the column with the timestamps.
41+
42+
Timestamps must be in UNIX sec format. If not provided, the upload timestamp is
43+
used.
44+
"""
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing_extensions import Literal
4+
5+
from ..._models import BaseModel
6+
7+
__all__ = ["RowStreamResponse"]
8+
9+
10+
class RowStreamResponse(BaseModel):
11+
success: Literal[True]

0 commit comments

Comments
 (0)