Skip to content

Commit

Permalink
feat(api): api update (#412)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Dec 16, 2024
1 parent 90c6218 commit f6ca1fc
Show file tree
Hide file tree
Showing 12 changed files with 713 additions and 27 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ from openlayer.types import InferencePipelineRetrieveResponse, InferencePipeline

Methods:

- <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>
- <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>
- <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>
- <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>

Expand Down
27 changes: 23 additions & 4 deletions src/openlayer/resources/inference_pipelines/inference_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import Optional
from typing import List, Optional
from typing_extensions import Literal

import httpx

Expand All @@ -22,7 +23,7 @@
RowsResourceWithStreamingResponse,
AsyncRowsResourceWithStreamingResponse,
)
from ...types import inference_pipeline_update_params
from ...types import inference_pipeline_update_params, inference_pipeline_retrieve_params
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
Expand Down Expand Up @@ -87,6 +88,7 @@ def retrieve(
self,
inference_pipeline_id: str,
*,
expand: List[Literal["project", "workspace"]] | 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,
Expand All @@ -98,6 +100,8 @@ def retrieve(
Retrieve inference pipeline.
Args:
expand: Expand specific nested objects.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -113,7 +117,13 @@ def retrieve(
return self._get(
f"/inference-pipelines/{inference_pipeline_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{"expand": expand}, inference_pipeline_retrieve_params.InferencePipelineRetrieveParams
),
),
cast_to=InferencePipelineRetrieveResponse,
)
Expand Down Expand Up @@ -244,6 +254,7 @@ async def retrieve(
self,
inference_pipeline_id: str,
*,
expand: List[Literal["project", "workspace"]] | 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,
Expand All @@ -255,6 +266,8 @@ async def retrieve(
Retrieve inference pipeline.
Args:
expand: Expand specific nested objects.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -270,7 +283,13 @@ async def retrieve(
return await self._get(
f"/inference-pipelines/{inference_pipeline_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"expand": expand}, inference_pipeline_retrieve_params.InferencePipelineRetrieveParams
),
),
cast_to=InferencePipelineRetrieveResponse,
)
Expand Down
8 changes: 8 additions & 0 deletions src/openlayer/resources/projects/inference_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def create(
*,
description: Optional[str],
name: str,
project: Optional[inference_pipeline_create_params.Project] | NotGiven = NOT_GIVEN,
workspace: Optional[inference_pipeline_create_params.Workspace] | 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,
Expand Down Expand Up @@ -84,6 +86,8 @@ def create(
{
"description": description,
"name": name,
"project": project,
"workspace": workspace,
},
inference_pipeline_create_params.InferencePipelineCreateParams,
),
Expand Down Expand Up @@ -173,6 +177,8 @@ async def create(
*,
description: Optional[str],
name: str,
project: Optional[inference_pipeline_create_params.Project] | NotGiven = NOT_GIVEN,
workspace: Optional[inference_pipeline_create_params.Workspace] | 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,
Expand Down Expand Up @@ -204,6 +210,8 @@ async def create(
{
"description": description,
"name": name,
"project": project,
"workspace": workspace,
},
inference_pipeline_create_params.InferencePipelineCreateParams,
),
Expand Down
1 change: 1 addition & 0 deletions src/openlayer/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
from .project_list_response import ProjectListResponse as ProjectListResponse
from .project_create_response import ProjectCreateResponse as ProjectCreateResponse
from .inference_pipeline_update_params import InferencePipelineUpdateParams as InferencePipelineUpdateParams
from .inference_pipeline_retrieve_params import InferencePipelineRetrieveParams as InferencePipelineRetrieveParams
from .inference_pipeline_update_response import InferencePipelineUpdateResponse as InferencePipelineUpdateResponse
from .inference_pipeline_retrieve_response import InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse
13 changes: 13 additions & 0 deletions src/openlayer/types/inference_pipeline_retrieve_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import List
from typing_extensions import Literal, TypedDict

__all__ = ["InferencePipelineRetrieveParams"]


class InferencePipelineRetrieveParams(TypedDict, total=False):
expand: List[Literal["project", "workspace"]]
"""Expand specific nested objects."""
144 changes: 141 additions & 3 deletions src/openlayer/types/inference_pipeline_retrieve_response.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,151 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from datetime import datetime
from typing import List, Optional
from datetime import date, datetime
from typing_extensions import Literal

from pydantic import Field as FieldInfo

from .._models import BaseModel

__all__ = ["InferencePipelineRetrieveResponse", "Links"]
__all__ = [
"InferencePipelineRetrieveResponse",
"Links",
"Project",
"ProjectLinks",
"ProjectGitRepo",
"Workspace",
"WorkspaceMonthlyUsage",
]


class Links(BaseModel):
app: str


class ProjectLinks(BaseModel):
app: str


class ProjectGitRepo(BaseModel):
id: str

date_connected: datetime = FieldInfo(alias="dateConnected")

date_updated: datetime = FieldInfo(alias="dateUpdated")

git_account_id: str = FieldInfo(alias="gitAccountId")

git_id: int = FieldInfo(alias="gitId")

name: str

private: bool

project_id: str = FieldInfo(alias="projectId")

slug: str

url: str

branch: Optional[str] = None

root_dir: Optional[str] = FieldInfo(alias="rootDir", default=None)


class Project(BaseModel):
id: str
"""The project id."""

creator_id: Optional[str] = FieldInfo(alias="creatorId", default=None)
"""The project creator id."""

date_created: datetime = FieldInfo(alias="dateCreated")
"""The project creation date."""

date_updated: datetime = FieldInfo(alias="dateUpdated")
"""The project last updated date."""

development_goal_count: int = FieldInfo(alias="developmentGoalCount")
"""The number of tests in the development mode of the project."""

goal_count: int = FieldInfo(alias="goalCount")
"""The total number of tests in the project."""

inference_pipeline_count: int = FieldInfo(alias="inferencePipelineCount")
"""The number of inference pipelines in the project."""

links: ProjectLinks
"""Links to the project."""

monitoring_goal_count: int = FieldInfo(alias="monitoringGoalCount")
"""The number of tests in the monitoring mode of the project."""

name: str
"""The project name."""

source: Optional[Literal["web", "api", "null"]] = None
"""The source of the project."""

task_type: Literal["llm-base", "tabular-classification", "tabular-regression", "text-classification"] = FieldInfo(
alias="taskType"
)
"""The task type of the project."""

version_count: int = FieldInfo(alias="versionCount")
"""The number of versions (commits) in the project."""

workspace_id: Optional[str] = FieldInfo(alias="workspaceId", default=None)
"""The workspace id."""

description: Optional[str] = None
"""The project description."""

git_repo: Optional[ProjectGitRepo] = FieldInfo(alias="gitRepo", default=None)


class WorkspaceMonthlyUsage(BaseModel):
execution_time_ms: Optional[int] = FieldInfo(alias="executionTimeMs", default=None)

month_year: Optional[date] = FieldInfo(alias="monthYear", default=None)

prediction_count: Optional[int] = FieldInfo(alias="predictionCount", default=None)


class Workspace(BaseModel):
id: str

creator_id: Optional[str] = FieldInfo(alias="creatorId", default=None)

date_created: datetime = FieldInfo(alias="dateCreated")

date_updated: datetime = FieldInfo(alias="dateUpdated")

invite_count: int = FieldInfo(alias="inviteCount")

member_count: int = FieldInfo(alias="memberCount")

name: str

period_end_date: Optional[datetime] = FieldInfo(alias="periodEndDate", default=None)

period_start_date: Optional[datetime] = FieldInfo(alias="periodStartDate", default=None)

project_count: int = FieldInfo(alias="projectCount")

slug: str

status: Literal[
"active", "past_due", "unpaid", "canceled", "incomplete", "incomplete_expired", "trialing", "paused"
]

monthly_usage: Optional[List[WorkspaceMonthlyUsage]] = FieldInfo(alias="monthlyUsage", default=None)

saml_only_access: Optional[bool] = FieldInfo(alias="samlOnlyAccess", default=None)

wildcard_domains: Optional[List[str]] = FieldInfo(alias="wildcardDomains", default=None)


class InferencePipelineRetrieveResponse(BaseModel):
id: str
"""The inference pipeline id."""
Expand Down Expand Up @@ -59,3 +190,10 @@ class InferencePipelineRetrieveResponse(BaseModel):

total_goal_count: int = FieldInfo(alias="totalGoalCount")
"""The total number of tests."""

project: Optional[Project] = None

workspace: Optional[Workspace] = None

workspace_id: Optional[str] = FieldInfo(alias="workspaceId", default=None)
"""The workspace id."""
Loading

0 comments on commit f6ca1fc

Please sign in to comment.