Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.0.0-beta.5"
".": "3.0.0-beta.6"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 170
configured_endpoints: 173
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-621c3ebf5011c5ca508f78fccbea17de4ca6b35bfe99578c1ae2265021578d6f.yml
openapi_spec_hash: e29d14e3e4679fcf22b3e760e49931b1
config_hash: 6c8d569b60ae6536708a165b72ff838f
config_hash: 3d425c415b7f7ab581418b43eb521cb3
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 3.0.0-beta.6 (2025-09-17)

Full Changelog: [v3.0.0-beta.5...v3.0.0-beta.6](https://github.com/digitalocean/gradient-python/compare/v3.0.0-beta.5...v3.0.0-beta.6)

### Features

* **api:** enable typescript ([c17086a](https://github.com/digitalocean/gradient-python/commit/c17086aaed18fbb8ba85f050556a193cdc4a233f))
* improve future compat with pydantic v3 ([300eac0](https://github.com/digitalocean/gradient-python/commit/300eac0417f8f17a65bb871b15de1254f4677558))
* normalize user agent with other do clients ([85bc8eb](https://github.com/digitalocean/gradient-python/commit/85bc8eb26afdfd7deb28ce2198eb3ef02181b95f))
* **types:** replace List[str] with SequenceNotStr in params ([5a6aa92](https://github.com/digitalocean/gradient-python/commit/5a6aa9241b5e7c2f4319caa14d62f41c0c824f9e))


### Chores

* clean up LICENSING after legal review ([#49](https://github.com/digitalocean/gradient-python/issues/49)) ([7212f62](https://github.com/digitalocean/gradient-python/commit/7212f62b6d3a5bbc7c8422a7fd8f336d22792049))
* **internal:** move mypy configurations to `pyproject.toml` file ([25c0448](https://github.com/digitalocean/gradient-python/commit/25c044818b636e3307af2fefd2add15a6e650e8d))
* **internal:** update pydantic dependency ([55255fb](https://github.com/digitalocean/gradient-python/commit/55255fb5d51bca4204f5e741024f4184da465d78))
* **tests:** simplify `get_platform` test ([b839e4b](https://github.com/digitalocean/gradient-python/commit/b839e4b31c1262157544bd69536051a10d6b098d))

## 3.0.0-beta.5 (2025-09-08)

Full Changelog: [v3.0.0-beta.4...v3.0.0-beta.5](https://github.com/digitalocean/gradient-python/compare/v3.0.0-beta.4...v3.0.0-beta.5)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2025 Gradient
Copyright 2025 DigitalOcean, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,8 @@ Python 3.8 or higher.
## Contributing

See [the contributing documentation](./CONTRIBUTING.md).


## License

Licensed under the Apache License 2.0. See [LICENSE](./LICENSE)
26 changes: 26 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ from gradient.types import (
AgentUpdateResponse,
AgentListResponse,
AgentDeleteResponse,
AgentRetrieveUsageResponse,
AgentUpdateStatusResponse,
)
```
Expand All @@ -62,6 +63,7 @@ Methods:
- <code title="put /v2/gen-ai/agents/{uuid}">client.agents.<a href="./src/gradient/resources/agents/agents.py">update</a>(path_uuid, \*\*<a href="src/gradient/types/agent_update_params.py">params</a>) -> <a href="./src/gradient/types/agent_update_response.py">AgentUpdateResponse</a></code>
- <code title="get /v2/gen-ai/agents">client.agents.<a href="./src/gradient/resources/agents/agents.py">list</a>(\*\*<a href="src/gradient/types/agent_list_params.py">params</a>) -> <a href="./src/gradient/types/agent_list_response.py">AgentListResponse</a></code>
- <code title="delete /v2/gen-ai/agents/{uuid}">client.agents.<a href="./src/gradient/resources/agents/agents.py">delete</a>(uuid) -> <a href="./src/gradient/types/agent_delete_response.py">AgentDeleteResponse</a></code>
- <code title="get /v2/gen-ai/agents/{uuid}/usage">client.agents.<a href="./src/gradient/resources/agents/agents.py">retrieve_usage</a>(uuid, \*\*<a href="src/gradient/types/agent_retrieve_usage_params.py">params</a>) -> <a href="./src/gradient/types/agent_retrieve_usage_response.py">AgentRetrieveUsageResponse</a></code>
- <code title="put /v2/gen-ai/agents/{uuid}/deployment_visibility">client.agents.<a href="./src/gradient/resources/agents/agents.py">update_status</a>(path_uuid, \*\*<a href="src/gradient/types/agent_update_status_params.py">params</a>) -> <a href="./src/gradient/types/agent_update_status_response.py">AgentUpdateStatusResponse</a></code>

## APIKeys
Expand Down Expand Up @@ -214,6 +216,30 @@ Methods:
- <code title="delete /v2/gen-ai/openai/keys/{api_key_uuid}">client.agents.evaluation_metrics.openai.keys.<a href="./src/gradient/resources/agents/evaluation_metrics/openai/keys.py">delete</a>(api_key_uuid) -> <a href="./src/gradient/types/agents/evaluation_metrics/openai/key_delete_response.py">KeyDeleteResponse</a></code>
- <code title="get /v2/gen-ai/openai/keys/{uuid}/agents">client.agents.evaluation_metrics.openai.keys.<a href="./src/gradient/resources/agents/evaluation_metrics/openai/keys.py">list_agents</a>(uuid, \*\*<a href="src/gradient/types/agents/evaluation_metrics/openai/key_list_agents_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/openai/key_list_agents_response.py">KeyListAgentsResponse</a></code>

### Oauth2

Types:

```python
from gradient.types.agents.evaluation_metrics import Oauth2GenerateURLResponse
```

Methods:

- <code title="get /v2/gen-ai/oauth2/url">client.agents.evaluation_metrics.oauth2.<a href="./src/gradient/resources/agents/evaluation_metrics/oauth2/oauth2.py">generate_url</a>(\*\*<a href="src/gradient/types/agents/evaluation_metrics/oauth2_generate_url_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/oauth2_generate_url_response.py">Oauth2GenerateURLResponse</a></code>

#### Dropbox

Types:

```python
from gradient.types.agents.evaluation_metrics.oauth2 import DropboxCreateTokensResponse
```

Methods:

- <code title="post /v2/gen-ai/oauth2/dropbox/tokens">client.agents.evaluation_metrics.oauth2.dropbox.<a href="./src/gradient/resources/agents/evaluation_metrics/oauth2/dropbox.py">create_tokens</a>(\*\*<a href="src/gradient/types/agents/evaluation_metrics/oauth2/dropbox_create_tokens_params.py">params</a>) -> <a href="./src/gradient/types/agents/evaluation_metrics/oauth2/dropbox_create_tokens_response.py">DropboxCreateTokensResponse</a></code>

## EvaluationRuns

Types:
Expand Down
50 changes: 0 additions & 50 deletions mypy.ini

This file was deleted.

55 changes: 53 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "gradient"
version = "3.0.0-beta.5"
version = "3.0.0-beta.6"
description = "The official Python library for the Gradient API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -54,7 +54,6 @@ dev-dependencies = [
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
]

Expand Down Expand Up @@ -144,6 +143,58 @@ reportOverlappingOverload = false
reportImportCycles = false
reportPrivateUsage = false

[tool.mypy]
pretty = true
show_error_codes = true

# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ['src/gradient/_files.py', '_dev/.*.py', 'tests/.*']

strict_equality = true
implicit_reexport = true
check_untyped_defs = true
no_implicit_optional = true

warn_return_any = true
warn_unreachable = true
warn_unused_configs = true

# Turn these options off as it could cause conflicts
# with the Pyright options.
warn_unused_ignores = false
warn_redundant_casts = false

disallow_any_generics = true
disallow_untyped_defs = true
disallow_untyped_calls = true
disallow_subclassing_any = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
cache_fine_grained = true

# By default, mypy reports an error if you assign a value to the result
# of a function call that doesn't return anything. We do this in our test
# cases:
# ```
# result = ...
# assert result is None
# ```
# Changing this codegen to make mypy happy would increase complexity
# and would not be worth it.
disable_error_code = "func-returns-value,overload-cannot-match"

# https://github.com/python/mypy/issues/12162
[[tool.mypy.overrides]]
module = "black.files.*"
ignore_errors = true
ignore_missing_imports = true


[tool.ruff]
line-length = 120
output-format = "grouped"
Expand Down
8 changes: 5 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ multidict==6.4.4
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
nest-asyncio==1.6.0
nodeenv==1.8.0
# via pyright
nox==2023.4.22
Expand All @@ -89,9 +88,9 @@ pluggy==1.5.0
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
pydantic==2.11.9
# via gradient
pydantic-core==2.27.1
pydantic-core==2.33.2
# via pydantic
pygments==2.18.0
# via rich
Expand Down Expand Up @@ -127,6 +126,9 @@ typing-extensions==4.12.2
# via pydantic
# via pydantic-core
# via pyright
# via typing-inspection
typing-inspection==0.4.1
# via pydantic
virtualenv==20.24.5
# via nox
yarl==1.20.0
Expand Down
7 changes: 5 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ multidict==6.4.4
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.10.3
pydantic==2.11.9
# via gradient
pydantic-core==2.27.1
pydantic-core==2.33.2
# via pydantic
sniffio==1.3.0
# via anyio
Expand All @@ -68,5 +68,8 @@ typing-extensions==4.12.2
# via multidict
# via pydantic
# via pydantic-core
# via typing-inspection
typing-inspection==0.4.1
# via pydantic
yarl==1.20.0
# via aiohttp
8 changes: 4 additions & 4 deletions src/gradient/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
ModelBuilderProtocol,
)
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
from ._compat import PYDANTIC_V2, model_copy, model_dump
from ._compat import PYDANTIC_V1, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
Expand Down Expand Up @@ -232,7 +232,7 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
Expand Down Expand Up @@ -320,7 +320,7 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}

self._model = model
Expand Down Expand Up @@ -671,7 +671,7 @@ def _validate_headers(

@property
def user_agent(self) -> str:
return f"{self.__class__.__name__}/Python {self._version}"
return f"{self.__class__.__name__}/Python/{self._version}"

@property
def base_url(self) -> URL:
Expand Down
Loading