Skip to content

Commit 3fa1bbc

Browse files
feat(api): api update (#412)
1 parent aaa6724 commit 3fa1bbc

12 files changed

+713
-27
lines changed

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ from openlayer.types import InferencePipelineRetrieveResponse, InferencePipeline
6161

6262
Methods:
6363

64-
- <code title="get /inference-pipelines/{inferencePipelineId}">client.inference_pipelines.<a href="./src/openlayer/resources/inference_pipelines/inference_pipelines.py">retrieve</a>(inference_pipeline_id) -> <a href="./src/openlayer/types/inference_pipeline_retrieve_response.py">InferencePipelineRetrieveResponse</a></code>
64+
- <code title="get /inference-pipelines/{inferencePipelineId}">client.inference_pipelines.<a href="./src/openlayer/resources/inference_pipelines/inference_pipelines.py">retrieve</a>(inference_pipeline_id, \*\*<a href="src/openlayer/types/inference_pipeline_retrieve_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipeline_retrieve_response.py">InferencePipelineRetrieveResponse</a></code>
6565
- <code title="put /inference-pipelines/{inferencePipelineId}">client.inference_pipelines.<a href="./src/openlayer/resources/inference_pipelines/inference_pipelines.py">update</a>(inference_pipeline_id, \*\*<a href="src/openlayer/types/inference_pipeline_update_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipeline_update_response.py">InferencePipelineUpdateResponse</a></code>
6666
- <code title="delete /inference-pipelines/{inferencePipelineId}">client.inference_pipelines.<a href="./src/openlayer/resources/inference_pipelines/inference_pipelines.py">delete</a>(inference_pipeline_id) -> None</code>
6767

src/openlayer/resources/inference_pipelines/inference_pipelines.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import List, Optional
6+
from typing_extensions import Literal
67

78
import httpx
89

@@ -22,7 +23,7 @@
2223
RowsResourceWithStreamingResponse,
2324
AsyncRowsResourceWithStreamingResponse,
2425
)
25-
from ...types import inference_pipeline_update_params
26+
from ...types import inference_pipeline_update_params, inference_pipeline_retrieve_params
2627
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
2728
from ..._utils import (
2829
maybe_transform,
@@ -87,6 +88,7 @@ def retrieve(
8788
self,
8889
inference_pipeline_id: str,
8990
*,
91+
expand: List[Literal["project", "workspace"]] | NotGiven = NOT_GIVEN,
9092
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9193
# The extra values given here take precedence over values defined on the client or passed to this method.
9294
extra_headers: Headers | None = None,
@@ -98,6 +100,8 @@ def retrieve(
98100
Retrieve inference pipeline.
99101
100102
Args:
103+
expand: Expand specific nested objects.
104+
101105
extra_headers: Send extra headers
102106
103107
extra_query: Add additional query parameters to the request
@@ -113,7 +117,13 @@ def retrieve(
113117
return self._get(
114118
f"/inference-pipelines/{inference_pipeline_id}",
115119
options=make_request_options(
116-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
120+
extra_headers=extra_headers,
121+
extra_query=extra_query,
122+
extra_body=extra_body,
123+
timeout=timeout,
124+
query=maybe_transform(
125+
{"expand": expand}, inference_pipeline_retrieve_params.InferencePipelineRetrieveParams
126+
),
117127
),
118128
cast_to=InferencePipelineRetrieveResponse,
119129
)
@@ -244,6 +254,7 @@ async def retrieve(
244254
self,
245255
inference_pipeline_id: str,
246256
*,
257+
expand: List[Literal["project", "workspace"]] | NotGiven = NOT_GIVEN,
247258
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
248259
# The extra values given here take precedence over values defined on the client or passed to this method.
249260
extra_headers: Headers | None = None,
@@ -255,6 +266,8 @@ async def retrieve(
255266
Retrieve inference pipeline.
256267
257268
Args:
269+
expand: Expand specific nested objects.
270+
258271
extra_headers: Send extra headers
259272
260273
extra_query: Add additional query parameters to the request
@@ -270,7 +283,13 @@ async def retrieve(
270283
return await self._get(
271284
f"/inference-pipelines/{inference_pipeline_id}",
272285
options=make_request_options(
273-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
286+
extra_headers=extra_headers,
287+
extra_query=extra_query,
288+
extra_body=extra_body,
289+
timeout=timeout,
290+
query=await async_maybe_transform(
291+
{"expand": expand}, inference_pipeline_retrieve_params.InferencePipelineRetrieveParams
292+
),
274293
),
275294
cast_to=InferencePipelineRetrieveResponse,
276295
)

src/openlayer/resources/projects/inference_pipelines.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def create(
5353
*,
5454
description: Optional[str],
5555
name: str,
56+
project: Optional[inference_pipeline_create_params.Project] | NotGiven = NOT_GIVEN,
57+
workspace: Optional[inference_pipeline_create_params.Workspace] | NotGiven = NOT_GIVEN,
5658
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5759
# The extra values given here take precedence over values defined on the client or passed to this method.
5860
extra_headers: Headers | None = None,
@@ -84,6 +86,8 @@ def create(
8486
{
8587
"description": description,
8688
"name": name,
89+
"project": project,
90+
"workspace": workspace,
8791
},
8892
inference_pipeline_create_params.InferencePipelineCreateParams,
8993
),
@@ -173,6 +177,8 @@ async def create(
173177
*,
174178
description: Optional[str],
175179
name: str,
180+
project: Optional[inference_pipeline_create_params.Project] | NotGiven = NOT_GIVEN,
181+
workspace: Optional[inference_pipeline_create_params.Workspace] | NotGiven = NOT_GIVEN,
176182
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
177183
# The extra values given here take precedence over values defined on the client or passed to this method.
178184
extra_headers: Headers | None = None,
@@ -204,6 +210,8 @@ async def create(
204210
{
205211
"description": description,
206212
"name": name,
213+
"project": project,
214+
"workspace": workspace,
207215
},
208216
inference_pipeline_create_params.InferencePipelineCreateParams,
209217
),

src/openlayer/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
from .project_list_response import ProjectListResponse as ProjectListResponse
88
from .project_create_response import ProjectCreateResponse as ProjectCreateResponse
99
from .inference_pipeline_update_params import InferencePipelineUpdateParams as InferencePipelineUpdateParams
10+
from .inference_pipeline_retrieve_params import InferencePipelineRetrieveParams as InferencePipelineRetrieveParams
1011
from .inference_pipeline_update_response import InferencePipelineUpdateResponse as InferencePipelineUpdateResponse
1112
from .inference_pipeline_retrieve_response import InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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 List
6+
from typing_extensions import Literal, TypedDict
7+
8+
__all__ = ["InferencePipelineRetrieveParams"]
9+
10+
11+
class InferencePipelineRetrieveParams(TypedDict, total=False):
12+
expand: List[Literal["project", "workspace"]]
13+
"""Expand specific nested objects."""

src/openlayer/types/inference_pipeline_retrieve_response.py

Lines changed: 141 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,151 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import Optional
4-
from datetime import datetime
3+
from typing import List, Optional
4+
from datetime import date, datetime
55
from typing_extensions import Literal
66

77
from pydantic import Field as FieldInfo
88

99
from .._models import BaseModel
1010

11-
__all__ = ["InferencePipelineRetrieveResponse", "Links"]
11+
__all__ = [
12+
"InferencePipelineRetrieveResponse",
13+
"Links",
14+
"Project",
15+
"ProjectLinks",
16+
"ProjectGitRepo",
17+
"Workspace",
18+
"WorkspaceMonthlyUsage",
19+
]
1220

1321

1422
class Links(BaseModel):
1523
app: str
1624

1725

26+
class ProjectLinks(BaseModel):
27+
app: str
28+
29+
30+
class ProjectGitRepo(BaseModel):
31+
id: str
32+
33+
date_connected: datetime = FieldInfo(alias="dateConnected")
34+
35+
date_updated: datetime = FieldInfo(alias="dateUpdated")
36+
37+
git_account_id: str = FieldInfo(alias="gitAccountId")
38+
39+
git_id: int = FieldInfo(alias="gitId")
40+
41+
name: str
42+
43+
private: bool
44+
45+
project_id: str = FieldInfo(alias="projectId")
46+
47+
slug: str
48+
49+
url: str
50+
51+
branch: Optional[str] = None
52+
53+
root_dir: Optional[str] = FieldInfo(alias="rootDir", default=None)
54+
55+
56+
class Project(BaseModel):
57+
id: str
58+
"""The project id."""
59+
60+
creator_id: Optional[str] = FieldInfo(alias="creatorId", default=None)
61+
"""The project creator id."""
62+
63+
date_created: datetime = FieldInfo(alias="dateCreated")
64+
"""The project creation date."""
65+
66+
date_updated: datetime = FieldInfo(alias="dateUpdated")
67+
"""The project last updated date."""
68+
69+
development_goal_count: int = FieldInfo(alias="developmentGoalCount")
70+
"""The number of tests in the development mode of the project."""
71+
72+
goal_count: int = FieldInfo(alias="goalCount")
73+
"""The total number of tests in the project."""
74+
75+
inference_pipeline_count: int = FieldInfo(alias="inferencePipelineCount")
76+
"""The number of inference pipelines in the project."""
77+
78+
links: ProjectLinks
79+
"""Links to the project."""
80+
81+
monitoring_goal_count: int = FieldInfo(alias="monitoringGoalCount")
82+
"""The number of tests in the monitoring mode of the project."""
83+
84+
name: str
85+
"""The project name."""
86+
87+
source: Optional[Literal["web", "api", "null"]] = None
88+
"""The source of the project."""
89+
90+
task_type: Literal["llm-base", "tabular-classification", "tabular-regression", "text-classification"] = FieldInfo(
91+
alias="taskType"
92+
)
93+
"""The task type of the project."""
94+
95+
version_count: int = FieldInfo(alias="versionCount")
96+
"""The number of versions (commits) in the project."""
97+
98+
workspace_id: Optional[str] = FieldInfo(alias="workspaceId", default=None)
99+
"""The workspace id."""
100+
101+
description: Optional[str] = None
102+
"""The project description."""
103+
104+
git_repo: Optional[ProjectGitRepo] = FieldInfo(alias="gitRepo", default=None)
105+
106+
107+
class WorkspaceMonthlyUsage(BaseModel):
108+
execution_time_ms: Optional[int] = FieldInfo(alias="executionTimeMs", default=None)
109+
110+
month_year: Optional[date] = FieldInfo(alias="monthYear", default=None)
111+
112+
prediction_count: Optional[int] = FieldInfo(alias="predictionCount", default=None)
113+
114+
115+
class Workspace(BaseModel):
116+
id: str
117+
118+
creator_id: Optional[str] = FieldInfo(alias="creatorId", default=None)
119+
120+
date_created: datetime = FieldInfo(alias="dateCreated")
121+
122+
date_updated: datetime = FieldInfo(alias="dateUpdated")
123+
124+
invite_count: int = FieldInfo(alias="inviteCount")
125+
126+
member_count: int = FieldInfo(alias="memberCount")
127+
128+
name: str
129+
130+
period_end_date: Optional[datetime] = FieldInfo(alias="periodEndDate", default=None)
131+
132+
period_start_date: Optional[datetime] = FieldInfo(alias="periodStartDate", default=None)
133+
134+
project_count: int = FieldInfo(alias="projectCount")
135+
136+
slug: str
137+
138+
status: Literal[
139+
"active", "past_due", "unpaid", "canceled", "incomplete", "incomplete_expired", "trialing", "paused"
140+
]
141+
142+
monthly_usage: Optional[List[WorkspaceMonthlyUsage]] = FieldInfo(alias="monthlyUsage", default=None)
143+
144+
saml_only_access: Optional[bool] = FieldInfo(alias="samlOnlyAccess", default=None)
145+
146+
wildcard_domains: Optional[List[str]] = FieldInfo(alias="wildcardDomains", default=None)
147+
148+
18149
class InferencePipelineRetrieveResponse(BaseModel):
19150
id: str
20151
"""The inference pipeline id."""
@@ -59,3 +190,10 @@ class InferencePipelineRetrieveResponse(BaseModel):
59190

60191
total_goal_count: int = FieldInfo(alias="totalGoalCount")
61192
"""The total number of tests."""
193+
194+
project: Optional[Project] = None
195+
196+
workspace: Optional[Workspace] = None
197+
198+
workspace_id: Optional[str] = FieldInfo(alias="workspaceId", default=None)
199+
"""The workspace id."""

0 commit comments

Comments
 (0)