diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 993d15ed..82526c1a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.2.0-alpha.41" + ".": "0.2.0-alpha.42" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 25695858..567ff5f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,29 @@ 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.2.0-alpha.42 (2024-12-18) + +Full Changelog: [v0.2.0-alpha.41...v0.2.0-alpha.42](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.41...v0.2.0-alpha.42) + +### Features + +* **api:** api update ([#412](https://github.com/openlayer-ai/openlayer-python/issues/412)) ([f6ca1fc](https://github.com/openlayer-ai/openlayer-python/commit/f6ca1fcbc7ed85d6e3bdc635b8f7a4796c943e2a)) + + +### Chores + +* **internal:** codegen related update ([#406](https://github.com/openlayer-ai/openlayer-python/issues/406)) ([3360b9e](https://github.com/openlayer-ai/openlayer-python/commit/3360b9e6f6037c7bc9ce877f7ae430ca249e9b95)) +* **internal:** codegen related update ([#408](https://github.com/openlayer-ai/openlayer-python/issues/408)) ([9bab516](https://github.com/openlayer-ai/openlayer-python/commit/9bab5168085e325ac7b8b4f07643f39ef564d78d)) +* **internal:** codegen related update ([#409](https://github.com/openlayer-ai/openlayer-python/issues/409)) ([f59c50e](https://github.com/openlayer-ai/openlayer-python/commit/f59c50ebd7b298536f0a6a92437630551074e172)) +* **internal:** codegen related update ([#410](https://github.com/openlayer-ai/openlayer-python/issues/410)) ([7e4304a](https://github.com/openlayer-ai/openlayer-python/commit/7e4304a87d8330fc15b099a078412f0dbab78842)) +* **internal:** fix some typos ([#414](https://github.com/openlayer-ai/openlayer-python/issues/414)) ([1009b11](https://github.com/openlayer-ai/openlayer-python/commit/1009b11b627a4236137c76543e2a09cc4fc78557)) +* **internal:** updated imports ([#411](https://github.com/openlayer-ai/openlayer-python/issues/411)) ([90c6218](https://github.com/openlayer-ai/openlayer-python/commit/90c6218e0a9929f8672da20f1871f20aab9bb500)) + + +### Documentation + +* **readme:** example snippet for client context manager ([#413](https://github.com/openlayer-ai/openlayer-python/issues/413)) ([4ef9f75](https://github.com/openlayer-ai/openlayer-python/commit/4ef9f75dfea53f198af9768414b51027ec9bd553)) + ## 0.2.0-alpha.41 (2024-12-13) Full Changelog: [v0.2.0-alpha.40...v0.2.0-alpha.41](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.40...v0.2.0-alpha.41) diff --git a/README.md b/README.md index 26f36d99..395ddd89 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,16 @@ client.with_options(http_client=DefaultHttpxClient(...)) By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting. +```py +from openlayer import Openlayer + +with Openlayer() as client: + # make requests here + ... + +# HTTP client is now closed +``` + ## Versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: diff --git a/api.md b/api.md index 4276bab7..3c4a9a44 100644 --- a/api.md +++ b/api.md @@ -61,7 +61,7 @@ from openlayer.types import InferencePipelineRetrieveResponse, InferencePipeline Methods: -- client.inference_pipelines.retrieve(inference_pipeline_id) -> InferencePipelineRetrieveResponse +- client.inference_pipelines.retrieve(inference_pipeline_id, \*\*params) -> InferencePipelineRetrieveResponse - client.inference_pipelines.update(inference_pipeline_id, \*\*params) -> InferencePipelineUpdateResponse - client.inference_pipelines.delete(inference_pipeline_id) -> None diff --git a/pyproject.toml b/pyproject.toml index 6dfe0494..8d573168 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openlayer" -version = "0.2.0-alpha.41" +version = "0.2.0-alpha.42" description = "The official Python library for the openlayer API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/openlayer/_client.py b/src/openlayer/_client.py index 008dee8a..d5e7a8ea 100644 --- a/src/openlayer/_client.py +++ b/src/openlayer/_client.py @@ -8,7 +8,7 @@ import httpx -from . import resources, _exceptions +from . import _exceptions from ._qs import Querystring from ._types import ( NOT_GIVEN, @@ -32,13 +32,16 @@ SyncAPIClient, AsyncAPIClient, ) +from .resources.commits import commits +from .resources.storage import storage +from .resources.projects import projects +from .resources.inference_pipelines import inference_pipelines __all__ = [ "Timeout", "Transport", "ProxiesTypes", "RequestOptions", - "resources", "Openlayer", "AsyncOpenlayer", "Client", @@ -47,10 +50,10 @@ class Openlayer(SyncAPIClient): - projects: resources.ProjectsResource - commits: resources.CommitsResource - inference_pipelines: resources.InferencePipelinesResource - storage: resources.StorageResource + projects: projects.ProjectsResource + commits: commits.CommitsResource + inference_pipelines: inference_pipelines.InferencePipelinesResource + storage: storage.StorageResource with_raw_response: OpenlayerWithRawResponse with_streaming_response: OpenlayerWithStreamedResponse @@ -104,10 +107,10 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.projects = resources.ProjectsResource(self) - self.commits = resources.CommitsResource(self) - self.inference_pipelines = resources.InferencePipelinesResource(self) - self.storage = resources.StorageResource(self) + self.projects = projects.ProjectsResource(self) + self.commits = commits.CommitsResource(self) + self.inference_pipelines = inference_pipelines.InferencePipelinesResource(self) + self.storage = storage.StorageResource(self) self.with_raw_response = OpenlayerWithRawResponse(self) self.with_streaming_response = OpenlayerWithStreamedResponse(self) @@ -230,10 +233,10 @@ def _make_status_error( class AsyncOpenlayer(AsyncAPIClient): - projects: resources.AsyncProjectsResource - commits: resources.AsyncCommitsResource - inference_pipelines: resources.AsyncInferencePipelinesResource - storage: resources.AsyncStorageResource + projects: projects.AsyncProjectsResource + commits: commits.AsyncCommitsResource + inference_pipelines: inference_pipelines.AsyncInferencePipelinesResource + storage: storage.AsyncStorageResource with_raw_response: AsyncOpenlayerWithRawResponse with_streaming_response: AsyncOpenlayerWithStreamedResponse @@ -287,10 +290,10 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.projects = resources.AsyncProjectsResource(self) - self.commits = resources.AsyncCommitsResource(self) - self.inference_pipelines = resources.AsyncInferencePipelinesResource(self) - self.storage = resources.AsyncStorageResource(self) + self.projects = projects.AsyncProjectsResource(self) + self.commits = commits.AsyncCommitsResource(self) + self.inference_pipelines = inference_pipelines.AsyncInferencePipelinesResource(self) + self.storage = storage.AsyncStorageResource(self) self.with_raw_response = AsyncOpenlayerWithRawResponse(self) self.with_streaming_response = AsyncOpenlayerWithStreamedResponse(self) @@ -414,36 +417,42 @@ def _make_status_error( class OpenlayerWithRawResponse: def __init__(self, client: Openlayer) -> None: - self.projects = resources.ProjectsResourceWithRawResponse(client.projects) - self.commits = resources.CommitsResourceWithRawResponse(client.commits) - self.inference_pipelines = resources.InferencePipelinesResourceWithRawResponse(client.inference_pipelines) - self.storage = resources.StorageResourceWithRawResponse(client.storage) + self.projects = projects.ProjectsResourceWithRawResponse(client.projects) + self.commits = commits.CommitsResourceWithRawResponse(client.commits) + self.inference_pipelines = inference_pipelines.InferencePipelinesResourceWithRawResponse( + client.inference_pipelines + ) + self.storage = storage.StorageResourceWithRawResponse(client.storage) class AsyncOpenlayerWithRawResponse: def __init__(self, client: AsyncOpenlayer) -> None: - self.projects = resources.AsyncProjectsResourceWithRawResponse(client.projects) - self.commits = resources.AsyncCommitsResourceWithRawResponse(client.commits) - self.inference_pipelines = resources.AsyncInferencePipelinesResourceWithRawResponse(client.inference_pipelines) - self.storage = resources.AsyncStorageResourceWithRawResponse(client.storage) + self.projects = projects.AsyncProjectsResourceWithRawResponse(client.projects) + self.commits = commits.AsyncCommitsResourceWithRawResponse(client.commits) + self.inference_pipelines = inference_pipelines.AsyncInferencePipelinesResourceWithRawResponse( + client.inference_pipelines + ) + self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage) class OpenlayerWithStreamedResponse: def __init__(self, client: Openlayer) -> None: - self.projects = resources.ProjectsResourceWithStreamingResponse(client.projects) - self.commits = resources.CommitsResourceWithStreamingResponse(client.commits) - self.inference_pipelines = resources.InferencePipelinesResourceWithStreamingResponse(client.inference_pipelines) - self.storage = resources.StorageResourceWithStreamingResponse(client.storage) + self.projects = projects.ProjectsResourceWithStreamingResponse(client.projects) + self.commits = commits.CommitsResourceWithStreamingResponse(client.commits) + self.inference_pipelines = inference_pipelines.InferencePipelinesResourceWithStreamingResponse( + client.inference_pipelines + ) + self.storage = storage.StorageResourceWithStreamingResponse(client.storage) class AsyncOpenlayerWithStreamedResponse: def __init__(self, client: AsyncOpenlayer) -> None: - self.projects = resources.AsyncProjectsResourceWithStreamingResponse(client.projects) - self.commits = resources.AsyncCommitsResourceWithStreamingResponse(client.commits) - self.inference_pipelines = resources.AsyncInferencePipelinesResourceWithStreamingResponse( + self.projects = projects.AsyncProjectsResourceWithStreamingResponse(client.projects) + self.commits = commits.AsyncCommitsResourceWithStreamingResponse(client.commits) + self.inference_pipelines = inference_pipelines.AsyncInferencePipelinesResourceWithStreamingResponse( client.inference_pipelines ) - self.storage = resources.AsyncStorageResourceWithStreamingResponse(client.storage) + self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage) Client = Openlayer diff --git a/src/openlayer/_version.py b/src/openlayer/_version.py index c950ced4..c64eb857 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.2.0-alpha.41" # x-release-please-version +__version__ = "0.2.0-alpha.42" # x-release-please-version diff --git a/src/openlayer/resources/inference_pipelines/inference_pipelines.py b/src/openlayer/resources/inference_pipelines/inference_pipelines.py index bc0f2fe5..60ce3fcc 100644 --- a/src/openlayer/resources/inference_pipelines/inference_pipelines.py +++ b/src/openlayer/resources/inference_pipelines/inference_pipelines.py @@ -2,7 +2,8 @@ from __future__ import annotations -from typing import Optional +from typing import List, Optional +from typing_extensions import Literal import httpx @@ -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, @@ -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, @@ -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 @@ -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, ) @@ -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, @@ -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 @@ -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, ) diff --git a/src/openlayer/resources/projects/inference_pipelines.py b/src/openlayer/resources/projects/inference_pipelines.py index e8999bdf..0ae5de1a 100644 --- a/src/openlayer/resources/projects/inference_pipelines.py +++ b/src/openlayer/resources/projects/inference_pipelines.py @@ -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, @@ -84,6 +86,8 @@ def create( { "description": description, "name": name, + "project": project, + "workspace": workspace, }, inference_pipeline_create_params.InferencePipelineCreateParams, ), @@ -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, @@ -204,6 +210,8 @@ async def create( { "description": description, "name": name, + "project": project, + "workspace": workspace, }, inference_pipeline_create_params.InferencePipelineCreateParams, ), diff --git a/src/openlayer/types/__init__.py b/src/openlayer/types/__init__.py index 58883aff..f607e733 100644 --- a/src/openlayer/types/__init__.py +++ b/src/openlayer/types/__init__.py @@ -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 diff --git a/src/openlayer/types/inference_pipeline_retrieve_params.py b/src/openlayer/types/inference_pipeline_retrieve_params.py new file mode 100644 index 00000000..8bdd012c --- /dev/null +++ b/src/openlayer/types/inference_pipeline_retrieve_params.py @@ -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.""" diff --git a/src/openlayer/types/inference_pipeline_retrieve_response.py b/src/openlayer/types/inference_pipeline_retrieve_response.py index 6141771d..dc157aa7 100644 --- a/src/openlayer/types/inference_pipeline_retrieve_response.py +++ b/src/openlayer/types/inference_pipeline_retrieve_response.py @@ -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.""" @@ -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.""" diff --git a/src/openlayer/types/inference_pipeline_update_response.py b/src/openlayer/types/inference_pipeline_update_response.py index ca0e5ec2..1652213f 100644 --- a/src/openlayer/types/inference_pipeline_update_response.py +++ b/src/openlayer/types/inference_pipeline_update_response.py @@ -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__ = ["InferencePipelineUpdateResponse", "Links"] +__all__ = [ + "InferencePipelineUpdateResponse", + "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 InferencePipelineUpdateResponse(BaseModel): id: str """The inference pipeline id.""" @@ -59,3 +190,10 @@ class InferencePipelineUpdateResponse(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.""" diff --git a/src/openlayer/types/projects/inference_pipeline_create_params.py b/src/openlayer/types/projects/inference_pipeline_create_params.py index cc29df43..eb5c467e 100644 --- a/src/openlayer/types/projects/inference_pipeline_create_params.py +++ b/src/openlayer/types/projects/inference_pipeline_create_params.py @@ -2,10 +2,12 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Required, TypedDict +from typing import List, Optional +from typing_extensions import Literal, Required, Annotated, TypedDict -__all__ = ["InferencePipelineCreateParams"] +from ..._utils import PropertyInfo + +__all__ = ["InferencePipelineCreateParams", "Project", "Workspace"] class InferencePipelineCreateParams(TypedDict, total=False): @@ -14,3 +16,35 @@ class InferencePipelineCreateParams(TypedDict, total=False): name: Required[str] """The inference pipeline name.""" + + project: Optional[Project] + + workspace: Optional[Workspace] + + +class Project(TypedDict, total=False): + name: Required[str] + """The project name.""" + + task_type: Required[ + Annotated[ + Literal["llm-base", "tabular-classification", "tabular-regression", "text-classification"], + PropertyInfo(alias="taskType"), + ] + ] + """The task type of the project.""" + + description: Optional[str] + """The project description.""" + + +class Workspace(TypedDict, total=False): + name: Required[str] + + slug: Required[str] + + invite_code: Annotated[str, PropertyInfo(alias="inviteCode")] + + saml_only_access: Annotated[bool, PropertyInfo(alias="samlOnlyAccess")] + + wildcard_domains: Annotated[List[str], PropertyInfo(alias="wildcardDomains")] diff --git a/src/openlayer/types/projects/inference_pipeline_create_response.py b/src/openlayer/types/projects/inference_pipeline_create_response.py index 4716fad0..26ee50db 100644 --- a/src/openlayer/types/projects/inference_pipeline_create_response.py +++ b/src/openlayer/types/projects/inference_pipeline_create_response.py @@ -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__ = ["InferencePipelineCreateResponse", "Links"] +__all__ = [ + "InferencePipelineCreateResponse", + "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 InferencePipelineCreateResponse(BaseModel): id: str """The inference pipeline id.""" @@ -59,3 +190,10 @@ class InferencePipelineCreateResponse(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.""" diff --git a/src/openlayer/types/projects/inference_pipeline_list_response.py b/src/openlayer/types/projects/inference_pipeline_list_response.py index 09b0c37f..45bd105d 100644 --- a/src/openlayer/types/projects/inference_pipeline_list_response.py +++ b/src/openlayer/types/projects/inference_pipeline_list_response.py @@ -1,20 +1,152 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Optional -from datetime import datetime +from datetime import date, datetime from typing_extensions import Literal from pydantic import Field as FieldInfo from ..._models import BaseModel -__all__ = ["InferencePipelineListResponse", "Item", "ItemLinks"] +__all__ = [ + "InferencePipelineListResponse", + "Item", + "ItemLinks", + "ItemProject", + "ItemProjectLinks", + "ItemProjectGitRepo", + "ItemWorkspace", + "ItemWorkspaceMonthlyUsage", +] class ItemLinks(BaseModel): app: str +class ItemProjectLinks(BaseModel): + app: str + + +class ItemProjectGitRepo(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 ItemProject(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: ItemProjectLinks + """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[ItemProjectGitRepo] = FieldInfo(alias="gitRepo", default=None) + + +class ItemWorkspaceMonthlyUsage(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 ItemWorkspace(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[ItemWorkspaceMonthlyUsage]] = 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 Item(BaseModel): id: str """The inference pipeline id.""" @@ -60,6 +192,13 @@ class Item(BaseModel): total_goal_count: int = FieldInfo(alias="totalGoalCount") """The total number of tests.""" + project: Optional[ItemProject] = None + + workspace: Optional[ItemWorkspace] = None + + workspace_id: Optional[str] = FieldInfo(alias="workspaceId", default=None) + """The workspace id.""" + class InferencePipelineListResponse(BaseModel): items: List[Item] diff --git a/tests/api_resources/projects/test_inference_pipelines.py b/tests/api_resources/projects/test_inference_pipelines.py index 6353090b..ea0bb5b6 100644 --- a/tests/api_resources/projects/test_inference_pipelines.py +++ b/tests/api_resources/projects/test_inference_pipelines.py @@ -29,6 +29,27 @@ def test_method_create(self, client: Openlayer) -> None: ) assert_matches_type(InferencePipelineCreateResponse, inference_pipeline, path=["response"]) + @parametrize + def test_method_create_with_all_params(self, client: Openlayer) -> None: + inference_pipeline = client.projects.inference_pipelines.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="This pipeline is used for production.", + name="production", + project={ + "name": "My Project", + "task_type": "llm-base", + "description": "My project description.", + }, + workspace={ + "name": "Openlayer", + "slug": "openlayer", + "invite_code": "inviteCode", + "saml_only_access": True, + "wildcard_domains": ["string"], + }, + ) + assert_matches_type(InferencePipelineCreateResponse, inference_pipeline, path=["response"]) + @parametrize def test_raw_response_create(self, client: Openlayer) -> None: response = client.projects.inference_pipelines.with_raw_response.create( @@ -127,6 +148,27 @@ async def test_method_create(self, async_client: AsyncOpenlayer) -> None: ) assert_matches_type(InferencePipelineCreateResponse, inference_pipeline, path=["response"]) + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncOpenlayer) -> None: + inference_pipeline = await async_client.projects.inference_pipelines.create( + project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + description="This pipeline is used for production.", + name="production", + project={ + "name": "My Project", + "task_type": "llm-base", + "description": "My project description.", + }, + workspace={ + "name": "Openlayer", + "slug": "openlayer", + "invite_code": "inviteCode", + "saml_only_access": True, + "wildcard_domains": ["string"], + }, + ) + assert_matches_type(InferencePipelineCreateResponse, inference_pipeline, path=["response"]) + @parametrize async def test_raw_response_create(self, async_client: AsyncOpenlayer) -> None: response = await async_client.projects.inference_pipelines.with_raw_response.create( diff --git a/tests/api_resources/test_inference_pipelines.py b/tests/api_resources/test_inference_pipelines.py index 35de2478..9d9dba04 100644 --- a/tests/api_resources/test_inference_pipelines.py +++ b/tests/api_resources/test_inference_pipelines.py @@ -23,14 +23,22 @@ class TestInferencePipelines: @parametrize def test_method_retrieve(self, client: Openlayer) -> None: inference_pipeline = client.inference_pipelines.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(InferencePipelineRetrieveResponse, inference_pipeline, path=["response"]) + + @parametrize + def test_method_retrieve_with_all_params(self, client: Openlayer) -> None: + inference_pipeline = client.inference_pipelines.retrieve( + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + expand=["project"], ) assert_matches_type(InferencePipelineRetrieveResponse, inference_pipeline, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Openlayer) -> None: response = client.inference_pipelines.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert response.is_closed is True @@ -41,7 +49,7 @@ def test_raw_response_retrieve(self, client: Openlayer) -> None: @parametrize def test_streaming_response_retrieve(self, client: Openlayer) -> None: with client.inference_pipelines.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + 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" @@ -55,7 +63,7 @@ def test_streaming_response_retrieve(self, client: Openlayer) -> None: 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.with_raw_response.retrieve( - "", + inference_pipeline_id="", ) @parametrize @@ -151,14 +159,22 @@ class TestAsyncInferencePipelines: @parametrize async def test_method_retrieve(self, async_client: AsyncOpenlayer) -> None: inference_pipeline = await async_client.inference_pipelines.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + ) + assert_matches_type(InferencePipelineRetrieveResponse, inference_pipeline, path=["response"]) + + @parametrize + async def test_method_retrieve_with_all_params(self, async_client: AsyncOpenlayer) -> None: + inference_pipeline = await async_client.inference_pipelines.retrieve( + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + expand=["project"], ) assert_matches_type(InferencePipelineRetrieveResponse, inference_pipeline, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncOpenlayer) -> None: response = await async_client.inference_pipelines.with_raw_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) assert response.is_closed is True @@ -169,7 +185,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncOpenlayer) -> None @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncOpenlayer) -> None: async with async_client.inference_pipelines.with_streaming_response.retrieve( - "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + 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" @@ -183,7 +199,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOpenlayer) - 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.with_raw_response.retrieve( - "", + inference_pipeline_id="", ) @parametrize diff --git a/tests/test_client.py b/tests/test_client.py index 0100d480..64a81986 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -364,11 +364,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1223,11 +1223,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request(