diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e613b816..aff3ead3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-beta.1" + ".": "0.1.0-beta.2" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e578b9b..d4262368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 0.1.0-beta.2 (2025-07-22) + +Full Changelog: [v0.1.0-beta.1...v0.1.0-beta.2](https://github.com/digitalocean/gradientai-python/compare/v0.1.0-beta.1...v0.1.0-beta.2) + +### Bug Fixes + +* **parsing:** ignore empty metadata ([cee9728](https://github.com/digitalocean/gradientai-python/commit/cee9728fd727cd600d2ac47ead9206ca937f7757)) + + +### Chores + +* **internal:** version bump ([e13ccb0](https://github.com/digitalocean/gradientai-python/commit/e13ccb069743fc6ebc56e0bb0463ff11864ad944)) +* **internal:** version bump ([00ee94d](https://github.com/digitalocean/gradientai-python/commit/00ee94d848ae5c5fc4604160c822e4757c4e6de8)) +* **types:** rebuild Pydantic models after all types are defined ([db7d61c](https://github.com/digitalocean/gradientai-python/commit/db7d61c02df9f86af9170d38539257e9cbf3eff9)) + ## 0.1.0-beta.1 (2025-07-21) Full Changelog: [v0.1.0-alpha.19...v0.1.0-beta.1](https://github.com/digitalocean/gradientai-python/compare/v0.1.0-alpha.19...v0.1.0-beta.1) diff --git a/README.md b/README.md index cef52756..310601a8 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [![PyPI version](https://img.shields.io/pypi/v/do_gradientai.svg?label=pypi%20(stable))](https://pypi.org/project/do_gradientai/) +[![Docs](https://img.shields.io/badge/Docs-8A2BE2)](https://gradientai-sdk.digitalocean.com/getting-started/overview/) The GradientAI Python library provides convenient access to the GradientAI REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, @@ -16,7 +17,9 @@ It is generated with [Stainless](https://www.stainless.com/). ## Documentation -The REST API documentation can be found on [developers.digitalocean.com](https://developers.digitalocean.com/documentation/v2/). The full API of this library can be found in [api.md](api.md). +The getting started guide can be found on [gradientai-sdk.digitalocean.com](https://gradientai-sdk.digitalocean.com/getting-started/overview). +The REST API documentation can be found on [developers.digitalocean.com](https://developers.digitalocean.com/documentation/v2/). +The full API of this library can be found in [api.md](api.md). ## Installation diff --git a/pyproject.toml b/pyproject.toml index 622ea115..c9469187 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "do_gradientai" -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" description = "The official Python library for GradientAI" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/do_gradientai/_models.py b/src/do_gradientai/_models.py index 528d5680..ffcbf67b 100644 --- a/src/do_gradientai/_models.py +++ b/src/do_gradientai/_models.py @@ -439,7 +439,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if metadata is not None: + if metadata is not None and len(metadata) > 0: meta: tuple[Any, ...] = tuple(metadata) elif is_annotated_type(type_): meta = get_args(type_)[1:] diff --git a/src/do_gradientai/_version.py b/src/do_gradientai/_version.py index 9ce69989..a31f70ad 100644 --- a/src/do_gradientai/_version.py +++ b/src/do_gradientai/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "do_gradientai" -__version__ = "0.1.0-beta.1" # x-release-please-version +__version__ = "0.1.0-beta.2" # x-release-please-version diff --git a/src/do_gradientai/types/__init__.py b/src/do_gradientai/types/__init__.py index 20747fb3..9170b699 100644 --- a/src/do_gradientai/types/__init__.py +++ b/src/do_gradientai/types/__init__.py @@ -2,6 +2,20 @@ from __future__ import annotations +from . import ( + agents, + models, + api_agent, + api_workspace, + agent_create_response, + agent_delete_response, + agent_update_response, + agent_retrieve_response, + agent_update_status_response, +) +from .. import _compat +from .agents import evaluation_metrics # type: ignore # noqa: F401 +from .models import providers # type: ignore # noqa: F401 from .shared import ( Size as Size, Image as Image, @@ -55,28 +69,158 @@ from .api_openai_api_key_info import APIOpenAIAPIKeyInfo as APIOpenAIAPIKeyInfo from .gpu_droplet_list_params import GPUDropletListParams as GPUDropletListParams from .model_retrieve_response import ModelRetrieveResponse as ModelRetrieveResponse -from .api_deployment_visibility import APIDeploymentVisibility as APIDeploymentVisibility +from .agents.evaluation_metrics import workspaces # type: ignore # noqa: F401 +from .api_deployment_visibility import ( + APIDeploymentVisibility as APIDeploymentVisibility, +) from .gpu_droplet_create_params import GPUDropletCreateParams as GPUDropletCreateParams from .gpu_droplet_list_response import GPUDropletListResponse as GPUDropletListResponse -from .agent_update_status_params import AgentUpdateStatusParams as AgentUpdateStatusParams +from .agent_update_status_params import ( + AgentUpdateStatusParams as AgentUpdateStatusParams, +) from .api_anthropic_api_key_info import APIAnthropicAPIKeyInfo as APIAnthropicAPIKeyInfo -from .knowledge_base_list_params import KnowledgeBaseListParams as KnowledgeBaseListParams -from .droplet_backup_policy_param import DropletBackupPolicyParam as DropletBackupPolicyParam -from .gpu_droplet_create_response import GPUDropletCreateResponse as GPUDropletCreateResponse -from .agent_update_status_response import AgentUpdateStatusResponse as AgentUpdateStatusResponse -from .knowledge_base_create_params import KnowledgeBaseCreateParams as KnowledgeBaseCreateParams -from .knowledge_base_list_response import KnowledgeBaseListResponse as KnowledgeBaseListResponse -from .knowledge_base_update_params import KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams -from .gpu_droplet_retrieve_response import GPUDropletRetrieveResponse as GPUDropletRetrieveResponse -from .knowledge_base_create_response import KnowledgeBaseCreateResponse as KnowledgeBaseCreateResponse -from .knowledge_base_delete_response import KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse -from .knowledge_base_update_response import KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse -from .gpu_droplet_list_kernels_params import GPUDropletListKernelsParams as GPUDropletListKernelsParams -from .gpu_droplet_delete_by_tag_params import GPUDropletDeleteByTagParams as GPUDropletDeleteByTagParams -from .knowledge_base_retrieve_response import KnowledgeBaseRetrieveResponse as KnowledgeBaseRetrieveResponse -from .gpu_droplet_list_firewalls_params import GPUDropletListFirewallsParams as GPUDropletListFirewallsParams -from .gpu_droplet_list_kernels_response import GPUDropletListKernelsResponse as GPUDropletListKernelsResponse -from .gpu_droplet_list_snapshots_params import GPUDropletListSnapshotsParams as GPUDropletListSnapshotsParams -from .gpu_droplet_list_firewalls_response import GPUDropletListFirewallsResponse as GPUDropletListFirewallsResponse -from .gpu_droplet_list_neighbors_response import GPUDropletListNeighborsResponse as GPUDropletListNeighborsResponse -from .gpu_droplet_list_snapshots_response import GPUDropletListSnapshotsResponse as GPUDropletListSnapshotsResponse +from .knowledge_base_list_params import ( + KnowledgeBaseListParams as KnowledgeBaseListParams, +) +from .droplet_backup_policy_param import ( + DropletBackupPolicyParam as DropletBackupPolicyParam, +) +from .gpu_droplet_create_response import ( + GPUDropletCreateResponse as GPUDropletCreateResponse, +) +from .agent_update_status_response import ( + AgentUpdateStatusResponse as AgentUpdateStatusResponse, +) +from .knowledge_base_create_params import ( + KnowledgeBaseCreateParams as KnowledgeBaseCreateParams, +) +from .knowledge_base_list_response import ( + KnowledgeBaseListResponse as KnowledgeBaseListResponse, +) +from .knowledge_base_update_params import ( + KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams, +) +from .gpu_droplet_retrieve_response import ( + GPUDropletRetrieveResponse as GPUDropletRetrieveResponse, +) +from .knowledge_base_create_response import ( + KnowledgeBaseCreateResponse as KnowledgeBaseCreateResponse, +) +from .knowledge_base_delete_response import ( + KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse, +) +from .knowledge_base_update_response import ( + KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse, +) +from .gpu_droplet_list_kernels_params import ( + GPUDropletListKernelsParams as GPUDropletListKernelsParams, +) +from .gpu_droplet_delete_by_tag_params import ( + GPUDropletDeleteByTagParams as GPUDropletDeleteByTagParams, +) +from .knowledge_base_retrieve_response import ( + KnowledgeBaseRetrieveResponse as KnowledgeBaseRetrieveResponse, +) +from .gpu_droplet_list_firewalls_params import ( + GPUDropletListFirewallsParams as GPUDropletListFirewallsParams, +) +from .gpu_droplet_list_kernels_response import ( + GPUDropletListKernelsResponse as GPUDropletListKernelsResponse, +) +from .gpu_droplet_list_snapshots_params import ( + GPUDropletListSnapshotsParams as GPUDropletListSnapshotsParams, +) +from .gpu_droplet_list_firewalls_response import ( + GPUDropletListFirewallsResponse as GPUDropletListFirewallsResponse, +) +from .gpu_droplet_list_neighbors_response import ( + GPUDropletListNeighborsResponse as GPUDropletListNeighborsResponse, +) +from .gpu_droplet_list_snapshots_response import ( + GPUDropletListSnapshotsResponse as GPUDropletListSnapshotsResponse, +) +from .agents.evaluation_metrics.workspaces import ( + agent_list_response, # type: ignore # noqa: F401 + agent_move_response, # type: ignore # noqa: F401 +) + +# Rebuild cyclical models only after all modules are imported. +# This ensures that, when building the deferred (due to cyclical references) model schema, +# Pydantic can resolve the necessary references. +# See: https://github.com/pydantic/pydantic/issues/11250 for more context. +if _compat.PYDANTIC_V2: + api_agent.APIAgent.model_rebuild(_parent_namespace_depth=0) + api_workspace.APIWorkspace.model_rebuild(_parent_namespace_depth=0) + agent_create_response.AgentCreateResponse.model_rebuild(_parent_namespace_depth=0) + agent_retrieve_response.AgentRetrieveResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agent_update_response.AgentUpdateResponse.model_rebuild(_parent_namespace_depth=0) + agent_delete_response.AgentDeleteResponse.model_rebuild(_parent_namespace_depth=0) + agent_update_status_response.AgentUpdateStatusResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspace_create_response.WorkspaceCreateResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspace_retrieve_response.WorkspaceRetrieveResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspace_update_response.WorkspaceUpdateResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspace_list_response.WorkspaceListResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspaces.agent_list_response.AgentListResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.evaluation_metrics.workspaces.agent_move_response.AgentMoveResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.function_create_response.FunctionCreateResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.function_update_response.FunctionUpdateResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.function_delete_response.FunctionDeleteResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.api_link_knowledge_base_output.APILinkKnowledgeBaseOutput.model_rebuild( + _parent_namespace_depth=0 + ) + agents.knowledge_base_detach_response.KnowledgeBaseDetachResponse.model_rebuild( + _parent_namespace_depth=0 + ) + agents.route_view_response.RouteViewResponse.model_rebuild( + _parent_namespace_depth=0 + ) + models.providers.anthropic_list_agents_response.AnthropicListAgentsResponse.model_rebuild( + _parent_namespace_depth=0 + ) + models.providers.openai_retrieve_agents_response.OpenAIRetrieveAgentsResponse.model_rebuild( + _parent_namespace_depth=0 + ) +else: + api_agent.APIAgent.update_forward_refs() # type: ignore + api_workspace.APIWorkspace.update_forward_refs() # type: ignore + agent_create_response.AgentCreateResponse.update_forward_refs() # type: ignore + agent_retrieve_response.AgentRetrieveResponse.update_forward_refs() # type: ignore + agent_update_response.AgentUpdateResponse.update_forward_refs() # type: ignore + agent_delete_response.AgentDeleteResponse.update_forward_refs() # type: ignore + agent_update_status_response.AgentUpdateStatusResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspace_create_response.WorkspaceCreateResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspace_retrieve_response.WorkspaceRetrieveResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspace_update_response.WorkspaceUpdateResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspace_list_response.WorkspaceListResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspaces.agent_list_response.AgentListResponse.update_forward_refs() # type: ignore + agents.evaluation_metrics.workspaces.agent_move_response.AgentMoveResponse.update_forward_refs() # type: ignore + agents.function_create_response.FunctionCreateResponse.update_forward_refs() # type: ignore + agents.function_update_response.FunctionUpdateResponse.update_forward_refs() # type: ignore + agents.function_delete_response.FunctionDeleteResponse.update_forward_refs() # type: ignore + agents.api_link_knowledge_base_output.APILinkKnowledgeBaseOutput.update_forward_refs() # type: ignore + agents.knowledge_base_detach_response.KnowledgeBaseDetachResponse.update_forward_refs() # type: ignore + agents.route_view_response.RouteViewResponse.update_forward_refs() # type: ignore + models.providers.anthropic_list_agents_response.AnthropicListAgentsResponse.update_forward_refs() # type: ignore + models.providers.openai_retrieve_agents_response.OpenAIRetrieveAgentsResponse.update_forward_refs() # type: ignore diff --git a/src/do_gradientai/types/agents/evaluation_metrics/__init__.py b/src/do_gradientai/types/agents/evaluation_metrics/__init__.py index c349624b..94afaed5 100644 --- a/src/do_gradientai/types/agents/evaluation_metrics/__init__.py +++ b/src/do_gradientai/types/agents/evaluation_metrics/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from . import workspaces # type: ignore # noqa: F401 from .model_list_params import ModelListParams as ModelListParams from .model_list_response import ModelListResponse as ModelListResponse from .workspace_create_params import WorkspaceCreateParams as WorkspaceCreateParams