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 @@
{
".": "0.1.0-alpha.6"
".": "0.1.0-alpha.7"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 77
configured_endpoints: 76
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradientai-e8b3cbc80e18e4f7f277010349f25e1319156704f359911dc464cc21a0d077a6.yml
openapi_spec_hash: c773d792724f5647ae25a5ae4ccec208
config_hash: 9c2519464cf5de240e34bd89b9f65706
config_hash: f0976fbc552ea878bb527447b5e663c9
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.1.0-alpha.7 (2025-06-27)

Full Changelog: [v0.1.0-alpha.6...v0.1.0-alpha.7](https://github.com/digitalocean/gradientai-python/compare/v0.1.0-alpha.6...v0.1.0-alpha.7)

### Features

* **api:** manual updates ([63b9ec0](https://github.com/digitalocean/gradientai-python/commit/63b9ec02a646dad258afbd048db8db1af8d4401b))
* **api:** manual updates ([5247aee](https://github.com/digitalocean/gradientai-python/commit/5247aee6d6052f6380fbe892d7c2bd9a8d0a32c0))
* **api:** manual updates ([aa9e2c7](https://github.com/digitalocean/gradientai-python/commit/aa9e2c78956162f6195fdbaa1c95754ee4af207e))
* **client:** add agent_domain option ([b4b6260](https://github.com/digitalocean/gradientai-python/commit/b4b62609a12a1dfa0b505e9ec54334b776fb0515))

## 0.1.0-alpha.6 (2025-06-27)

Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/digitalocean/gradientai-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ client = GradientAI(
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
)

completion = client.chat.completions.create(
completion = client.agents.chat.completions.create(
messages=[
{
"content": "string",
Expand Down Expand Up @@ -63,7 +63,7 @@ client = AsyncGradientAI(


async def main() -> None:
completion = await client.chat.completions.create(
completion = await client.agents.chat.completions.create(
messages=[
{
"content": "string",
Expand Down Expand Up @@ -105,7 +105,7 @@ async def main() -> None:
api_key=os.environ.get("GRADIENTAI_API_KEY"), # This is the default and can be omitted
http_client=DefaultAioHttpClient(),
) as client:
completion = await client.chat.completions.create(
completion = await client.agents.chat.completions.create(
messages=[
{
"content": "string",
Expand Down Expand Up @@ -138,7 +138,7 @@ from gradientai import GradientAI

client = GradientAI()

completion = client.chat.completions.create(
completion = client.agents.chat.completions.create(
messages=[
{
"content": "string",
Expand Down
23 changes: 18 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Shared Types

```python
from gradientai.types import APILinks, APIMeta
from gradientai.types import APILinks, APIMeta, ChatCompletionTokenLogprob
```

# Agents
Expand Down Expand Up @@ -58,6 +58,20 @@ Methods:
- <code title="delete /v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}">client.agents.api_keys.<a href="./src/gradientai/resources/agents/api_keys.py">delete</a>(api_key_uuid, \*, agent_uuid) -> <a href="./src/gradientai/types/agents/api_key_delete_response.py">APIKeyDeleteResponse</a></code>
- <code title="put /v2/gen-ai/agents/{agent_uuid}/api_keys/{api_key_uuid}/regenerate">client.agents.api_keys.<a href="./src/gradientai/resources/agents/api_keys.py">regenerate</a>(api_key_uuid, \*, agent_uuid) -> <a href="./src/gradientai/types/agents/api_key_regenerate_response.py">APIKeyRegenerateResponse</a></code>

## Chat

### Completions

Types:

```python
from gradientai.types.agents.chat import CompletionCreateResponse
```

Methods:

- <code title="post /chat/completions">client.agents.chat.completions.<a href="./src/gradientai/resources/agents/chat/completions.py">create</a>(\*\*<a href="src/gradientai/types/agents/chat/completion_create_params.py">params</a>) -> <a href="./src/gradientai/types/agents/chat/completion_create_response.py">CompletionCreateResponse</a></code>

## EvaluationMetrics

Types:
Expand Down Expand Up @@ -382,7 +396,7 @@ Methods:
Types:

```python
from gradientai.types.chat import ChatCompletionTokenLogprob, CompletionCreateResponse
from gradientai.types.chat import CompletionCreateResponse
```

Methods:
Expand Down Expand Up @@ -419,10 +433,9 @@ Methods:
Types:

```python
from gradientai.types import APIAgreement, APIModel, APIModelVersion, Model, ModelListResponse
from gradientai.types import APIAgreement, APIModel, APIModelVersion, ModelListResponse
```

Methods:

- <code title="get /models/{model}">client.models.<a href="./src/gradientai/resources/models.py">retrieve</a>(model) -> <a href="./src/gradientai/types/model.py">Model</a></code>
- <code title="get /models">client.models.<a href="./src/gradientai/resources/models.py">list</a>() -> <a href="./src/gradientai/types/model_list_response.py">ModelListResponse</a></code>
- <code title="get /v2/gen-ai/models">client.models.<a href="./src/gradientai/resources/models.py">list</a>(\*\*<a href="src/gradientai/types/model_list_params.py">params</a>) -> <a href="./src/gradientai/types/model_list_response.py">ModelListResponse</a></code>
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python"
version = "0.1.0-alpha.6"
version = "0.1.0-alpha.7"
description = "The official Python library for GradientAI"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
12 changes: 12 additions & 0 deletions src/gradientai/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class GradientAI(SyncAPIClient):
# client options
api_key: str | None
inference_key: str | None
agent_domain: str | None

def __init__(
self,
*,
api_key: str | None = None,
inference_key: str | None = None,
agent_domain: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -96,6 +98,8 @@ def __init__(
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
self.inference_key = inference_key

self.agent_domain = agent_domain

if base_url is None:
base_url = os.environ.get("GRADIENT_AI_BASE_URL")
self._base_url_overridden = base_url is not None
Expand Down Expand Up @@ -201,6 +205,7 @@ def copy(
*,
api_key: str | None = None,
inference_key: str | None = None,
agent_domain: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
http_client: httpx.Client | None = None,
Expand Down Expand Up @@ -236,6 +241,7 @@ def copy(
client = self.__class__(
api_key=api_key or self.api_key,
inference_key=inference_key or self.inference_key,
agent_domain=agent_domain or self.agent_domain,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
Expand Down Expand Up @@ -289,12 +295,14 @@ class AsyncGradientAI(AsyncAPIClient):
# client options
api_key: str | None
inference_key: str | None
agent_domain: str | None

def __init__(
self,
*,
api_key: str | None = None,
inference_key: str | None = None,
agent_domain: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
max_retries: int = DEFAULT_MAX_RETRIES,
Expand Down Expand Up @@ -328,6 +336,8 @@ def __init__(
inference_key = os.environ.get("GRADIENTAI_INFERENCE_KEY")
self.inference_key = inference_key

self.agent_domain = agent_domain

if base_url is None:
base_url = os.environ.get("GRADIENT_AI_BASE_URL")
self._base_url_overridden = base_url is not None
Expand Down Expand Up @@ -433,6 +443,7 @@ def copy(
*,
api_key: str | None = None,
inference_key: str | None = None,
agent_domain: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
http_client: httpx.AsyncClient | None = None,
Expand Down Expand Up @@ -468,6 +479,7 @@ def copy(
client = self.__class__(
api_key=api_key or self.api_key,
inference_key=inference_key or self.inference_key,
agent_domain=agent_domain or self.agent_domain,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
http_client=http_client,
Expand Down
2 changes: 1 addition & 1 deletion src/gradientai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "gradientai"
__version__ = "0.1.0-alpha.6" # x-release-please-version
__version__ = "0.1.0-alpha.7" # x-release-please-version
14 changes: 14 additions & 0 deletions src/gradientai/resources/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .chat import (
ChatResource,
AsyncChatResource,
ChatResourceWithRawResponse,
AsyncChatResourceWithRawResponse,
ChatResourceWithStreamingResponse,
AsyncChatResourceWithStreamingResponse,
)
from .agents import (
AgentsResource,
AsyncAgentsResource,
Expand Down Expand Up @@ -88,6 +96,12 @@
"AsyncAPIKeysResourceWithRawResponse",
"APIKeysResourceWithStreamingResponse",
"AsyncAPIKeysResourceWithStreamingResponse",
"ChatResource",
"AsyncChatResource",
"ChatResourceWithRawResponse",
"AsyncChatResourceWithRawResponse",
"ChatResourceWithStreamingResponse",
"AsyncChatResourceWithStreamingResponse",
"EvaluationMetricsResource",
"AsyncEvaluationMetricsResource",
"EvaluationMetricsResourceWithRawResponse",
Expand Down
32 changes: 32 additions & 0 deletions src/gradientai/resources/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
AsyncVersionsResourceWithStreamingResponse,
)
from ..._compat import cached_property
from .chat.chat import (
ChatResource,
AsyncChatResource,
ChatResourceWithRawResponse,
AsyncChatResourceWithRawResponse,
ChatResourceWithStreamingResponse,
AsyncChatResourceWithStreamingResponse,
)
from .functions import (
FunctionsResource,
AsyncFunctionsResource,
Expand Down Expand Up @@ -114,6 +122,10 @@ class AgentsResource(SyncAPIResource):
def api_keys(self) -> APIKeysResource:
return APIKeysResource(self._client)

@cached_property
def chat(self) -> ChatResource:
return ChatResource(self._client)

@cached_property
def evaluation_metrics(self) -> EvaluationMetricsResource:
return EvaluationMetricsResource(self._client)
Expand Down Expand Up @@ -498,6 +510,10 @@ class AsyncAgentsResource(AsyncAPIResource):
def api_keys(self) -> AsyncAPIKeysResource:
return AsyncAPIKeysResource(self._client)

@cached_property
def chat(self) -> AsyncChatResource:
return AsyncChatResource(self._client)

@cached_property
def evaluation_metrics(self) -> AsyncEvaluationMetricsResource:
return AsyncEvaluationMetricsResource(self._client)
Expand Down Expand Up @@ -904,6 +920,10 @@ def __init__(self, agents: AgentsResource) -> None:
def api_keys(self) -> APIKeysResourceWithRawResponse:
return APIKeysResourceWithRawResponse(self._agents.api_keys)

@cached_property
def chat(self) -> ChatResourceWithRawResponse:
return ChatResourceWithRawResponse(self._agents.chat)

@cached_property
def evaluation_metrics(self) -> EvaluationMetricsResourceWithRawResponse:
return EvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
Expand Down Expand Up @@ -964,6 +984,10 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse:
return AsyncAPIKeysResourceWithRawResponse(self._agents.api_keys)

@cached_property
def chat(self) -> AsyncChatResourceWithRawResponse:
return AsyncChatResourceWithRawResponse(self._agents.chat)

@cached_property
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithRawResponse:
return AsyncEvaluationMetricsResourceWithRawResponse(self._agents.evaluation_metrics)
Expand Down Expand Up @@ -1024,6 +1048,10 @@ def __init__(self, agents: AgentsResource) -> None:
def api_keys(self) -> APIKeysResourceWithStreamingResponse:
return APIKeysResourceWithStreamingResponse(self._agents.api_keys)

@cached_property
def chat(self) -> ChatResourceWithStreamingResponse:
return ChatResourceWithStreamingResponse(self._agents.chat)

@cached_property
def evaluation_metrics(self) -> EvaluationMetricsResourceWithStreamingResponse:
return EvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
Expand Down Expand Up @@ -1084,6 +1112,10 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse:
return AsyncAPIKeysResourceWithStreamingResponse(self._agents.api_keys)

@cached_property
def chat(self) -> AsyncChatResourceWithStreamingResponse:
return AsyncChatResourceWithStreamingResponse(self._agents.chat)

@cached_property
def evaluation_metrics(self) -> AsyncEvaluationMetricsResourceWithStreamingResponse:
return AsyncEvaluationMetricsResourceWithStreamingResponse(self._agents.evaluation_metrics)
Expand Down
33 changes: 33 additions & 0 deletions src/gradientai/resources/agents/chat/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .chat import (
ChatResource,
AsyncChatResource,
ChatResourceWithRawResponse,
AsyncChatResourceWithRawResponse,
ChatResourceWithStreamingResponse,
AsyncChatResourceWithStreamingResponse,
)
from .completions import (
CompletionsResource,
AsyncCompletionsResource,
CompletionsResourceWithRawResponse,
AsyncCompletionsResourceWithRawResponse,
CompletionsResourceWithStreamingResponse,
AsyncCompletionsResourceWithStreamingResponse,
)

__all__ = [
"CompletionsResource",
"AsyncCompletionsResource",
"CompletionsResourceWithRawResponse",
"AsyncCompletionsResourceWithRawResponse",
"CompletionsResourceWithStreamingResponse",
"AsyncCompletionsResourceWithStreamingResponse",
"ChatResource",
"AsyncChatResource",
"ChatResourceWithRawResponse",
"AsyncChatResourceWithRawResponse",
"ChatResourceWithStreamingResponse",
"AsyncChatResourceWithStreamingResponse",
]
Loading