diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b1f175a9..91198208 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,12 +1,14 @@
name: CI
on:
push:
- branches-ignore:
- - 'generated'
- - 'codegen/**'
- - 'integrated/**'
- - 'stl-preview-head/**'
- - 'stl-preview-base/**'
+ branches:
+ - '**'
+ - '!integrated/**'
+ - '!stl-preview-head/**'
+ - '!stl-preview-base/**'
+ - '!generated'
+ - '!codegen/**'
+ - 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
@@ -17,9 +19,9 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/gradient-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v5
@@ -36,12 +38,12 @@ jobs:
timeout-minutes: 5
name: build
runs-on: ${{ github.repository == 'stainless-sdks/gradient-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
permissions:
contents: read
id-token: write
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v5
@@ -55,14 +57,18 @@ jobs:
run: ./scripts/build
- name: Get GitHub OIDC Token
- if: github.repository == 'stainless-sdks/gradient-typescript'
+ if: |-
+ github.repository == 'stainless-sdks/gradient-typescript' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());
- name: Upload tarball
- if: github.repository == 'stainless-sdks/gradient-typescript'
+ if: |-
+ github.repository == 'stainless-sdks/gradient-typescript' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
@@ -74,7 +80,7 @@ jobs:
runs-on: ${{ github.repository == 'stainless-sdks/gradient-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v5
diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml
index 7c858cfe..6e32ea39 100644
--- a/.github/workflows/publish-npm.yml
+++ b/.github/workflows/publish-npm.yml
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Set up Node
uses: actions/setup-node@v3
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 9f2310f7..2937e584 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -12,7 +12,7 @@ jobs:
if: github.repository == 'digitalocean/gradient-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Check release environment
run: |
diff --git a/.gitignore b/.gitignore
index b6c67468..55936924 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.prism.log
+.stdy.log
node_modules
yarn-error.log
codegen.log
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c5e8a3ed..17473a20 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.2"
+ ".": "0.1.0-alpha.3"
}
diff --git a/.stats.yml b/.stats.yml
index af483f0a..58ad35ae 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 175
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-cb3bf9b21459cad24410206c27a32fd31ef6cf86711700597549dbbd0d634002.yml
-openapi_spec_hash: 6a9149a81ba15e7c5c5c1f4d77daad92
-config_hash: bad49c3bf949d5168ec3896bedff253a
+configured_endpoints: 193
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-8e914ac57f864a395f0c0c4635603cfbbe8fc5daa8bf6b8427f1ed95fd9d4277.yml
+openapi_spec_hash: f1faf4e4e0fc37e518fe55ff7c01086d
+config_hash: 244791562e694cfcd3514c0bb917057a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2178147d..7a6b87cc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,74 @@
# Changelog
+## 0.1.0-alpha.3 (2026-07-29)
+
+Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/digitalocean/gradient-typescript/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
+
+### Features
+
+* add waitForAgentReady helper for agent deployment polling ([#9](https://github.com/digitalocean/gradient-typescript/issues/9)) ([48a9366](https://github.com/digitalocean/gradient-typescript/commit/48a9366dbb8879bb6a4be7b59a6bba26840d50d9))
+* **api:** include indexing jobs ([9b9f776](https://github.com/digitalocean/gradient-typescript/commit/9b9f776c88182c0c26fbc92dc3085f96250675c7))
+* **api:** manual updates ([5618f39](https://github.com/digitalocean/gradient-typescript/commit/5618f394ab5a374946cb1dd9349693863209a12b))
+* **api:** manual updates ([06dce24](https://github.com/digitalocean/gradient-typescript/commit/06dce245c0aebeea23e8a36e1cec7fc8810bcc89))
+* **api:** manual updates ([f1902bc](https://github.com/digitalocean/gradient-typescript/commit/f1902bc99ef0f8cb35914720c54e0ccee1ead5c1))
+* **api:** remove inf endpoint env ([6c3a74a](https://github.com/digitalocean/gradient-typescript/commit/6c3a74ac681c92b30b4c07bfc4a43f730a6a6373))
+* **api:** responses ([b07a208](https://github.com/digitalocean/gradient-typescript/commit/b07a208fc60c300d84e52b8e25b1613a50a9688a))
+* **api:** update urls for endpoints ([5160e2a](https://github.com/digitalocean/gradient-typescript/commit/5160e2ab9e4fefb2fa871843b38ac5247638e2c8))
+* knowledge base indexing poller ([#14](https://github.com/digitalocean/gradient-typescript/issues/14)) ([04e35f0](https://github.com/digitalocean/gradient-typescript/commit/04e35f0553c622fe33b422f611bb7f1592346510))
+* **knowledge-bases:** add waitForDatabase polling helper ([#8](https://github.com/digitalocean/gradient-typescript/issues/8)) ([12d1af3](https://github.com/digitalocean/gradient-typescript/commit/12d1af3c82962f420eef7160b8ac043aa96087f7))
+
+
+### Bug Fixes
+
+* **client:** avoid memory leak with abort signals ([ca552af](https://github.com/digitalocean/gradient-typescript/commit/ca552afb6f448731169e822608f8fb6a29325340))
+* **client:** avoid removing abort listener too early ([82b3689](https://github.com/digitalocean/gradient-typescript/commit/82b3689c13fc60009c9ff3c40b5cc3c4c800c5db))
+* **client:** improve parameter names ([d7270e4](https://github.com/digitalocean/gradient-typescript/commit/d7270e4e4a29b458daa5d7eceb5b640aff9a5ffe))
+* **docs/contributing:** correct pnpm link command ([a17c344](https://github.com/digitalocean/gradient-typescript/commit/a17c344075b2a92c102990fb4137e591239256bf))
+* **docs:** remove extraneous example object fields ([1eaa98c](https://github.com/digitalocean/gradient-typescript/commit/1eaa98c75d63934e5c3f16c4b021d7ff9958f399))
+* **internal:** set inference endpoint URL ([2611294](https://github.com/digitalocean/gradient-typescript/commit/2611294c68d30b23488b1d2290dc64515c05a48f))
+* **internal:** update default chat completions endpoint ([49a0a0c](https://github.com/digitalocean/gradient-typescript/commit/49a0a0c0f8895b3235da1378d01476e63b74812e))
+* **mcp:** correct code tool API endpoint ([630724d](https://github.com/digitalocean/gradient-typescript/commit/630724ddaea98da99a14cb42b0475378057a35a0))
+* **mcp:** return correct lines on typescript errors ([c35d0f7](https://github.com/digitalocean/gradient-typescript/commit/c35d0f71ac4bf58c702ea6a31a2cfe5a0d5126c3))
+
+
+### Chores
+
+* break long lines in snippets into multiline ([7d854f0](https://github.com/digitalocean/gradient-typescript/commit/7d854f0a63467bd8701d4e8ff8991ecfd0c330fd))
+* **ci:** skip lint on metadata-only changes ([1450f0a](https://github.com/digitalocean/gradient-typescript/commit/1450f0a819e7050550559ecf8ccd3e1d86876990))
+* **client:** do not parse responses with empty content-length ([b769165](https://github.com/digitalocean/gradient-typescript/commit/b769165fd73b45a53893c390a159018ddaa6bd1f))
+* **client:** fix logger property type ([ba0b91b](https://github.com/digitalocean/gradient-typescript/commit/ba0b91b64e8b5e86014ef7d9a21e7c55c0459eaa))
+* **client:** restructure abort controller binding ([ab12908](https://github.com/digitalocean/gradient-typescript/commit/ab12908cb196ae8d67415c506f2d222ac42fb42a))
+* fix typo in descriptions ([3013c92](https://github.com/digitalocean/gradient-typescript/commit/3013c9222ef4602cfe55ee7b7a677059375cb89c))
+* **formatter:** run prettier and eslint separately ([ecf993c](https://github.com/digitalocean/gradient-typescript/commit/ecf993cea0b0f17d269a9bb6c89b68b4764d8031))
+* formatting fixes ([b2388ec](https://github.com/digitalocean/gradient-typescript/commit/b2388ec757d21bdb00365969af5b083ae1e574b0))
+* **internal/client:** fix form-urlencoded requests ([ff211a6](https://github.com/digitalocean/gradient-typescript/commit/ff211a6b9444f7cb9c50ca3438ed1d201e3dcd14))
+* **internal:** avoid type checking errors with ts-reset ([e8fe038](https://github.com/digitalocean/gradient-typescript/commit/e8fe038c8b5fe1df4d8dbd480266eb43ae50cd1e))
+* **internal:** codegen related update ([29f7706](https://github.com/digitalocean/gradient-typescript/commit/29f7706a099d2158e096d7f89516fe0622dd8b5a))
+* **internal:** codegen related update ([200759f](https://github.com/digitalocean/gradient-typescript/commit/200759f7bb6b792f6ce1f669f2c9ea87f5558a80))
+* **internal:** codegen related update ([faaff42](https://github.com/digitalocean/gradient-typescript/commit/faaff427fd6d74899742c237b40b2a29f3c5c55a))
+* **internal:** codegen related update ([34d9a70](https://github.com/digitalocean/gradient-typescript/commit/34d9a7043b1aa3b37b388ba9d19f8eac514e7704))
+* **internal:** codegen related update ([600003a](https://github.com/digitalocean/gradient-typescript/commit/600003a3eb5f04dc56ec1b3248a6b9474b9abfae))
+* **internal:** codegen related update ([1ca1124](https://github.com/digitalocean/gradient-typescript/commit/1ca11248647b73d08bb9ddea00ff441a078d6342))
+* **internal:** codegen related update ([dbb66cf](https://github.com/digitalocean/gradient-typescript/commit/dbb66cf1059261dab15c7b296bee93876ea7cf36))
+* **internal:** codegen related update ([0d19438](https://github.com/digitalocean/gradient-typescript/commit/0d194383fd46a6bdb17fc56bd9458e2fe4164ac2))
+* **internal:** improve import alias names ([b385dcf](https://github.com/digitalocean/gradient-typescript/commit/b385dcf68e3b5c7ffc3103abd8d8e9d5dda71100))
+* **internal:** more robust bootstrap script ([ef7a88b](https://github.com/digitalocean/gradient-typescript/commit/ef7a88bd36f4b3abafd9f93e6ca7ffea96ae7bb9))
+* **internal:** move stringifyQuery implementation to internal function ([5042cb3](https://github.com/digitalocean/gradient-typescript/commit/5042cb353be22f28f0f41c4e5bafc946f0c27efb))
+* **internal:** remove mock server code ([caa3b9a](https://github.com/digitalocean/gradient-typescript/commit/caa3b9a9fc7cde0ef52d91aba6cbf4d255bb5a6d))
+* **internal:** tweak CI branches ([e1e13d1](https://github.com/digitalocean/gradient-typescript/commit/e1e13d11bb8087d98c0a0e6426313af3f2cab103))
+* **internal:** update `actions/checkout` version ([4443a16](https://github.com/digitalocean/gradient-typescript/commit/4443a167ef1f8fdaf6996583373387e5a9bae6d0))
+* **internal:** update dependencies to address dependabot vulnerabilities ([6728544](https://github.com/digitalocean/gradient-typescript/commit/6728544dea74c0968bbb365370a4740dbb603732))
+* **internal:** update gitignore ([f13993e](https://github.com/digitalocean/gradient-typescript/commit/f13993eb0c665e03a04898978ef33cc11802e6f3))
+* **internal:** upgrade babel, qs, js-yaml ([44e9f8e](https://github.com/digitalocean/gradient-typescript/commit/44e9f8e1d12b9281aa972b9f9c5fefe3c6b20eb7))
+* **internal:** upgrade eslint ([dda1ff1](https://github.com/digitalocean/gradient-typescript/commit/dda1ff112b3dd01e58718a8c52e5e30a6cc7aa97))
+* **mcp-server:** improve instructions ([05f9c0b](https://github.com/digitalocean/gradient-typescript/commit/05f9c0bf787dd80801e43622b9a02376d7cbcf4f))
+* update mock server docs ([026c664](https://github.com/digitalocean/gradient-typescript/commit/026c664dcedc9fc52ab8d49f469b52d88f54622a))
+
+
+### Refactors
+
+* normalize wait-for implementations ([#20](https://github.com/digitalocean/gradient-typescript/issues/20)) ([30419d1](https://github.com/digitalocean/gradient-typescript/commit/30419d1f1b238a5d2fcb4720c9599c66daa78ce9))
+
## 0.1.0-alpha.2 (2025-10-16)
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/digitalocean/gradient-typescript/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e7739f99..95c3e3e1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -60,17 +60,11 @@ $ yarn link @digitalocean/gradient
# With pnpm
$ pnpm link --global
$ cd ../my-package
-$ pnpm link -—global @digitalocean/gradient
+$ pnpm link --global @digitalocean/gradient
```
## Running tests
-Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
-
-```sh
-$ npx prism mock path/to/your/openapi.yml
-```
-
```sh
$ yarn run test
```
diff --git a/LICENSE b/LICENSE
index 5ab1db50..01d7d929 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2025 DigitalOcean, LLC
+ Copyright 2026 DigitalOcean, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 1855fc05..23050a47 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,9 @@ const params: Gradient.Chat.CompletionCreateParams = {
messages: [{ role: 'user', content: 'What is the capital of France?' }],
model: 'llama3.3-70b-instruct',
};
-const completion: Gradient.Chat.CompletionCreateResponse = await client.chat.completions.create(params);
+const completion: Gradient.Chat.CompletionCreateResponse = await client.chat.completions.create(
+ params,
+);
```
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
diff --git a/api.md b/api.md
index 2b128885..ba5588f5 100644
--- a/api.md
+++ b/api.md
@@ -10,6 +10,8 @@ Types:
- ChatCompletionChunk
- ChatCompletionTokenLogprob
- CompletionUsage
+- CreateResponseResponse
+- CreateResponseStreamResponse
- DiskInfo
- Droplet
- DropletNextBackupWindow
@@ -57,11 +59,11 @@ Methods:
- client.agents.create({ ...params }) -> AgentCreateResponse
- client.agents.retrieve(uuid) -> AgentRetrieveResponse
-- client.agents.update(pathUuid, { ...params }) -> AgentUpdateResponse
+- client.agents.update(uuid, { ...params }) -> AgentUpdateResponse
- client.agents.list({ ...params }) -> AgentListResponse
- client.agents.delete(uuid) -> AgentDeleteResponse
- client.agents.retrieveUsage(uuid, { ...params }) -> AgentRetrieveUsageResponse
-- client.agents.updateStatus(pathUuid, { ...params }) -> AgentUpdateStatusResponse
+- client.agents.updateStatus(uuid, { ...params }) -> AgentUpdateStatusResponse
## APIKeys
@@ -137,16 +139,6 @@ Methods:
- client.agents.evaluationMetrics.workspaces.agents.list(workspaceUuid, { ...params }) -> AgentListResponse
- client.agents.evaluationMetrics.workspaces.agents.move(workspaceUuid, { ...params }) -> AgentMoveResponse
-### Models
-
-Types:
-
-- ModelListResponse
-
-Methods:
-
-- client.agents.evaluationMetrics.models.list({ ...params }) -> ModelListResponse
-
### Anthropic
#### Keys
@@ -211,6 +203,20 @@ Methods:
- client.agents.evaluationMetrics.oauth2.dropbox.createTokens({ ...params }) -> DropboxCreateTokensResponse
+### ScheduledIndexing
+
+Types:
+
+- ScheduledIndexingCreateResponse
+- ScheduledIndexingRetrieveResponse
+- ScheduledIndexingDeleteResponse
+
+Methods:
+
+- client.agents.evaluationMetrics.scheduledIndexing.create({ ...params }) -> ScheduledIndexingCreateResponse
+- client.agents.evaluationMetrics.scheduledIndexing.retrieve(knowledgeBaseUuid) -> ScheduledIndexingRetrieveResponse
+- client.agents.evaluationMetrics.scheduledIndexing.delete(uuid) -> ScheduledIndexingDeleteResponse
+
## EvaluationRuns
Types:
@@ -286,7 +292,7 @@ Types:
Methods:
-- client.agents.versions.update(pathUuid, { ...params }) -> VersionUpdateResponse
+- client.agents.versions.update(uuid, { ...params }) -> VersionUpdateResponse
- client.agents.versions.list(uuid, { ...params }) -> VersionListResponse
## KnowledgeBases
@@ -340,6 +346,12 @@ Methods:
- client.images.generate({ ...params }) -> ImageGenerateResponse
+# Responses
+
+Methods:
+
+- client.responses.create({ ...params }) -> CreateResponseResponse
+
# GPUDroplets
Types:
@@ -700,14 +712,16 @@ Types:
- KnowledgeBaseUpdateResponse
- KnowledgeBaseListResponse
- KnowledgeBaseDeleteResponse
+- KnowledgeBaseListIndexingJobsResponse
Methods:
- client.knowledgeBases.create({ ...params }) -> KnowledgeBaseCreateResponse
- client.knowledgeBases.retrieve(uuid) -> KnowledgeBaseRetrieveResponse
-- client.knowledgeBases.update(pathUuid, { ...params }) -> KnowledgeBaseUpdateResponse
+- client.knowledgeBases.update(uuid, { ...params }) -> KnowledgeBaseUpdateResponse
- client.knowledgeBases.list({ ...params }) -> KnowledgeBaseListResponse
- client.knowledgeBases.delete(uuid) -> KnowledgeBaseDeleteResponse
+- client.knowledgeBases.listIndexingJobs(knowledgeBaseUuid) -> KnowledgeBaseListIndexingJobsResponse
## DataSources
@@ -719,6 +733,7 @@ Types:
- APIWebCrawlerDataSource
- AwsDataSource
- DataSourceCreateResponse
+- DataSourceUpdateResponse
- DataSourceListResponse
- DataSourceDeleteResponse
- DataSourceCreatePresignedURLsResponse
@@ -726,6 +741,7 @@ Types:
Methods:
- client.knowledgeBases.dataSources.create(knowledgeBaseUuid, { ...params }) -> DataSourceCreateResponse
+- client.knowledgeBases.dataSources.update(dataSourceUuid, { ...params }) -> DataSourceUpdateResponse
- client.knowledgeBases.dataSources.list(knowledgeBaseUuid, { ...params }) -> DataSourceListResponse
- client.knowledgeBases.dataSources.delete(dataSourceUuid, { ...params }) -> DataSourceDeleteResponse
- client.knowledgeBases.dataSources.createPresignedURLs({ ...params }) -> DataSourceCreatePresignedURLsResponse
@@ -740,6 +756,7 @@ Types:
- IndexingJobRetrieveResponse
- IndexingJobListResponse
- IndexingJobRetrieveDataSourcesResponse
+- IndexingJobRetrieveSignedURLResponse
- IndexingJobUpdateCancelResponse
Methods:
@@ -748,6 +765,8 @@ Methods:
- client.knowledgeBases.indexingJobs.retrieve(uuid) -> IndexingJobRetrieveResponse
- client.knowledgeBases.indexingJobs.list({ ...params }) -> IndexingJobListResponse
- client.knowledgeBases.indexingJobs.retrieveDataSources(indexingJobUuid) -> IndexingJobRetrieveDataSourcesResponse
+- client.knowledgeBases.indexingJobs.retrieveSignedURL(indexingJobUuid) -> IndexingJobRetrieveSignedURLResponse
+- client.knowledgeBases.indexingJobs.updateCancel(uuid, { ...params }) -> IndexingJobUpdateCancelResponse
- client.knowledgeBases.indexingJobs.updateCancel(pathUuid, { ...params }) -> IndexingJobUpdateCancelResponse
- client.knowledgeBases.indexingJobs.waitForCompletion(uuid, { ...options }) -> IndexingJobRetrieveResponse
@@ -835,3 +854,65 @@ Methods:
- client.databases.schemaRegistry.config.update(databaseClusterUuid, { ...params }) -> ConfigUpdateResponse
- client.databases.schemaRegistry.config.retrieveSubject(subjectName, { ...params }) -> ConfigRetrieveSubjectResponse
- client.databases.schemaRegistry.config.updateSubject(subjectName, { ...params }) -> ConfigUpdateSubjectResponse
+
+# Nfs
+
+Types:
+
+- NfCreateResponse
+- NfRetrieveResponse
+- NfListResponse
+- NfInitiateActionResponse
+
+Methods:
+
+- client.nfs.create({ ...params }) -> NfCreateResponse
+- client.nfs.retrieve(nfsID, { ...params }) -> NfRetrieveResponse
+- client.nfs.list({ ...params }) -> NfListResponse
+- client.nfs.delete(nfsID, { ...params }) -> void
+- client.nfs.initiateAction(nfsID, { ...params }) -> NfInitiateActionResponse
+
+## Snapshots
+
+Types:
+
+- SnapshotRetrieveResponse
+- SnapshotListResponse
+
+Methods:
+
+- client.nfs.snapshots.retrieve(nfsSnapshotID, { ...params }) -> SnapshotRetrieveResponse
+- client.nfs.snapshots.list({ ...params }) -> SnapshotListResponse
+- client.nfs.snapshots.delete(nfsSnapshotID, { ...params }) -> void
+
+# Retrieve
+
+Types:
+
+- RetrieveDocumentsResponse
+
+Methods:
+
+- client.retrieve.documents(knowledgeBaseID, { ...params }) -> RetrieveDocumentsResponse
+
+# Apps
+
+## JobInvocations
+
+Types:
+
+- JobInvocationCancelResponse
+
+Methods:
+
+- client.apps.jobInvocations.cancel(jobInvocationID, { ...params }) -> JobInvocationCancelResponse
+
+# Billing
+
+Types:
+
+- BillingListInsightsResponse
+
+Methods:
+
+- client.billing.listInsights(endDate, { ...params }) -> BillingListInsightsResponse
diff --git a/eslint.config.mjs b/eslint.config.mjs
index f409f9cc..2ef554c5 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -1,7 +1,6 @@
// @ts-check
import tseslint from 'typescript-eslint';
import unusedImports from 'eslint-plugin-unused-imports';
-import prettier from 'eslint-plugin-prettier';
export default tseslint.config(
{
@@ -14,11 +13,9 @@ export default tseslint.config(
plugins: {
'@typescript-eslint': tseslint.plugin,
'unused-imports': unusedImports,
- prettier,
},
rules: {
'no-unused-vars': 'off',
- 'prettier/prettier': 'error',
'unused-imports/no-unused-imports': 'error',
'no-restricted-imports': [
'error',
diff --git a/package.json b/package.json
index 14c6dd7f..f209e348 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@digitalocean/gradient",
- "version": "0.1.0-alpha.2",
+ "version": "0.1.0-alpha.3",
"description": "The official TypeScript library for the Gradient API",
"author": "DigitalOcean, LLC ",
"types": "dist/index.d.ts",
@@ -35,8 +35,7 @@
"@types/node": "^20.17.6",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
- "eslint": "^9.20.1",
- "eslint-plugin-prettier": "^5.4.1",
+ "eslint": "^9.39.1",
"eslint-plugin-unused-imports": "^4.1.4",
"iconv-lite": "^0.6.3",
"jest": "^29.4.0",
@@ -50,6 +49,17 @@
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
+ "overrides": {
+ "minimatch": "^9.0.5"
+ },
+ "pnpm": {
+ "overrides": {
+ "minimatch": "^9.0.5"
+ }
+ },
+ "resolutions": {
+ "minimatch": "^9.0.5"
+ },
"exports": {
".": {
"import": "./dist/index.mjs",
diff --git a/scripts/bootstrap b/scripts/bootstrap
index a8b69ff3..2e315f53 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
echo -n "==> Install Homebrew dependencies? (y/N): "
read -r response
diff --git a/scripts/fast-format b/scripts/fast-format
index 53721ac0..e1723136 100755
--- a/scripts/fast-format
+++ b/scripts/fast-format
@@ -31,10 +31,8 @@ if ! [ -z "$ESLINT_FILES" ]; then
fi
echo "==> Running prettier --write"
-# format things eslint didn't
-PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)"
+PRETTIER_FILES="$(grep '\.\([mc]?tsx?\|[mc]?jsx?\|json\)$' "$FILE_LIST" || true)"
if ! [ -z "$PRETTIER_FILES" ]; then
echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \
- --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \
- '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs'
+ --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern
fi
diff --git a/scripts/format b/scripts/format
index 7a756401..b1b2c17a 100755
--- a/scripts/format
+++ b/scripts/format
@@ -8,5 +8,4 @@ echo "==> Running eslint --fix"
./node_modules/.bin/eslint --fix .
echo "==> Running prettier --write"
-# format things eslint didn't
-./node_modules/.bin/prettier --write --cache --cache-strategy metadata . '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs'
+./node_modules/.bin/prettier --write --cache --cache-strategy metadata .
diff --git a/scripts/lint b/scripts/lint
index 3ffb78a6..1f532548 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -4,6 +4,9 @@ set -e
cd "$(dirname "$0")/.."
+echo "==> Running prettier --check"
+./node_modules/.bin/prettier --check .
+
echo "==> Running eslint"
./node_modules/.bin/eslint .
diff --git a/scripts/mock b/scripts/mock
deleted file mode 100755
index 0b28f6ea..00000000
--- a/scripts/mock
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "$(dirname "$0")/.."
-
-if [[ -n "$1" && "$1" != '--'* ]]; then
- URL="$1"
- shift
-else
- URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)"
-fi
-
-# Check if the URL is empty
-if [ -z "$URL" ]; then
- echo "Error: No OpenAPI spec path/url provided or found in .stats.yml"
- exit 1
-fi
-
-echo "==> Starting mock server with URL ${URL}"
-
-# Run prism mock on the given spec
-if [ "$1" == "--daemon" ]; then
- npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
-
- # Wait for server to come online
- echo -n "Waiting for server"
- while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
- echo -n "."
- sleep 0.1
- done
-
- if grep -q "✖ fatal" ".prism.log"; then
- cat .prism.log
- exit 1
- fi
-
- echo
-else
- npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
-fi
diff --git a/scripts/test b/scripts/test
index 7bce0516..548da9bb 100755
--- a/scripts/test
+++ b/scripts/test
@@ -4,53 +4,7 @@ set -e
cd "$(dirname "$0")/.."
-RED='\033[0;31m'
-GREEN='\033[0;32m'
-YELLOW='\033[0;33m'
-NC='\033[0m' # No Color
-function prism_is_running() {
- curl --silent "http://localhost:4010" >/dev/null 2>&1
-}
-
-kill_server_on_port() {
- pids=$(lsof -t -i tcp:"$1" || echo "")
- if [ "$pids" != "" ]; then
- kill "$pids"
- echo "Stopped $pids."
- fi
-}
-
-function is_overriding_api_base_url() {
- [ -n "$TEST_API_BASE_URL" ]
-}
-
-if ! is_overriding_api_base_url && ! prism_is_running ; then
- # When we exit this script, make sure to kill the background mock server process
- trap 'kill_server_on_port 4010' EXIT
-
- # Start the dev server
- ./scripts/mock --daemon
-fi
-
-if is_overriding_api_base_url ; then
- echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
- echo
-elif ! prism_is_running ; then
- echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
- echo -e "running against your OpenAPI spec."
- echo
- echo -e "To run the server, pass in the path or url of your OpenAPI"
- echo -e "spec to the prism command:"
- echo
- echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
- echo
-
- exit 1
-else
- echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
- echo
-fi
echo "==> Running tests"
./node_modules/.bin/jest "$@"
diff --git a/src/api-promise.ts b/src/api-promise.ts
index 8c775ee6..4e701286 100644
--- a/src/api-promise.ts
+++ b/src/api-promise.ts
@@ -1,2 +1,2 @@
/** @deprecated Import from ./core/api-promise instead */
-export * from './core/api-promise';
+export * from "./core/api-promise"
\ No newline at end of file
diff --git a/src/client.ts b/src/client.ts
index 98aa8dd4..f8c2eeee 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -11,94 +11,31 @@ import type { APIResponseProps } from './internal/parse';
import { getPlatformHeaders } from './internal/detect-platform';
import * as Shims from './internal/shims';
import * as Opts from './internal/request-options';
-import * as qs from './internal/qs';
+import { stringifyQuery } from './internal/utils/query';
import { VERSION } from './version';
import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
import { APIPromise } from './core/api-promise';
-import {
- ImageGenerateParams,
- ImageGenerateParamsNonStreaming,
- ImageGenerateParamsStreaming,
- ImageGenerateResponse,
- Images,
-} from './resources/images';
+import { Billing, BillingListInsightsParams, BillingListInsightsResponse } from './resources/billing';
+import { ImageGenerateParams, ImageGenerateParamsNonStreaming, ImageGenerateParamsStreaming, ImageGenerateResponse, Images } from './resources/images';
import { RegionListParams, RegionListResponse, Regions } from './resources/regions';
-import {
- APIAgent,
- APIAgentAPIKeyInfo,
- APIAgentModel,
- APIAnthropicAPIKeyInfo,
- APIDeploymentVisibility,
- APIOpenAIAPIKeyInfo,
- APIRetrievalMethod,
- APIWorkspace,
- AgentCreateParams,
- AgentCreateResponse,
- AgentDeleteResponse,
- AgentListParams,
- AgentListResponse,
- AgentRetrieveResponse,
- AgentRetrieveUsageParams,
- AgentRetrieveUsageResponse,
- AgentUpdateParams,
- AgentUpdateResponse,
- AgentUpdateStatusParams,
- AgentUpdateStatusResponse,
- Agents,
-} from './resources/agents/agents';
+import { ResponseCreateParams, ResponseCreateParamsNonStreaming, ResponseCreateParamsStreaming, Responses } from './resources/responses';
+import { Retrieve, RetrieveDocumentsParams, RetrieveDocumentsResponse } from './resources/retrieve';
+import { APIAgent, APIAgentAPIKeyInfo, APIAgentModel, APIAnthropicAPIKeyInfo, APIDeploymentVisibility, APIOpenAIAPIKeyInfo, APIRetrievalMethod, APIWorkspace, AgentCreateParams, AgentCreateResponse, AgentDeleteResponse, AgentListParams, AgentListResponse, AgentRetrieveResponse, AgentRetrieveUsageParams, AgentRetrieveUsageResponse, AgentUpdateParams, AgentUpdateResponse, AgentUpdateStatusParams, AgentUpdateStatusResponse, Agents } from './resources/agents/agents';
+import { Apps } from './resources/apps/apps';
import { Chat } from './resources/chat/chat';
import { Databases } from './resources/databases/databases';
-import {
- DropletBackupPolicy,
- GPUDropletCreateParams,
- GPUDropletCreateResponse,
- GPUDropletDeleteByTagParams,
- GPUDropletListFirewallsParams,
- GPUDropletListFirewallsResponse,
- GPUDropletListKernelsParams,
- GPUDropletListKernelsResponse,
- GPUDropletListNeighborsResponse,
- GPUDropletListParams,
- GPUDropletListResponse,
- GPUDropletListSnapshotsParams,
- GPUDropletListSnapshotsResponse,
- GPUDropletRetrieveResponse,
- GPUDroplets,
-} from './resources/gpu-droplets/gpu-droplets';
+import { DropletBackupPolicy, GPUDropletCreateParams, GPUDropletCreateResponse, GPUDropletDeleteByTagParams, GPUDropletListFirewallsParams, GPUDropletListFirewallsResponse, GPUDropletListKernelsParams, GPUDropletListKernelsResponse, GPUDropletListNeighborsResponse, GPUDropletListParams, GPUDropletListResponse, GPUDropletListSnapshotsParams, GPUDropletListSnapshotsResponse, GPUDropletRetrieveResponse, GPUDroplets } from './resources/gpu-droplets/gpu-droplets';
import { Inference } from './resources/inference/inference';
-import {
- APIKnowledgeBase,
- KnowledgeBaseCreateParams,
- KnowledgeBaseCreateResponse,
- KnowledgeBaseDeleteResponse,
- KnowledgeBaseListParams,
- KnowledgeBaseListResponse,
- KnowledgeBaseRetrieveResponse,
- KnowledgeBaseUpdateParams,
- KnowledgeBaseUpdateResponse,
- KnowledgeBases,
-} from './resources/knowledge-bases/knowledge-bases';
-import {
- APIAgreement,
- APIModel,
- APIModelVersion,
- ModelListParams,
- ModelListResponse,
- Models,
-} from './resources/models/models';
+import { APIKnowledgeBase, KnowledgeBaseCreateParams, KnowledgeBaseCreateResponse, KnowledgeBaseDeleteResponse, KnowledgeBaseListIndexingJobsResponse, KnowledgeBaseListParams, KnowledgeBaseListResponse, KnowledgeBaseRetrieveResponse, KnowledgeBaseUpdateParams, KnowledgeBaseUpdateResponse, KnowledgeBases } from './resources/knowledge-bases/knowledge-bases';
+import { APIAgreement, APIModel, APIModelVersion, ModelListParams, ModelListResponse, Models } from './resources/models/models';
+import { NfCreateParams, NfCreateResponse, NfDeleteParams, NfInitiateActionParams, NfInitiateActionResponse, NfListParams, NfListResponse, NfRetrieveParams, NfRetrieveResponse, Nfs } from './resources/nfs/nfs';
import { type Fetch } from './internal/builtin-types';
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
import { readEnv } from './internal/utils/env';
-import {
- type LogLevel,
- type Logger,
- formatRequestDetails,
- loggerFor,
- parseLogLevel,
-} from './internal/utils/log';
+import { type LogLevel, type Logger, formatRequestDetails, loggerFor, parseLogLevel } from './internal/utils/log';
import { isEmptyObj } from './internal/utils/values';
export interface ClientOptions {
@@ -122,10 +59,12 @@ export interface ClientOptions {
*/
agentEndpoint?: string | null | undefined;
+ inferenceEndpoint?: string | null | undefined;
+
/**
- * Defaults to process.env['GRADIENT_INFERENCE_ENDPOINT'].
+ * Defaults to process.env['GRADIENT_KBASS_ENDPOINT'].
*/
- inferenceEndpoint?: string | null | undefined;
+ kbassEndpoint?: string | null | undefined;
/**
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
@@ -197,7 +136,7 @@ export interface ClientOptions {
}
/**
- * API Client for interfacing with the Gradient API.
+ * API Client for interfacing with the Gradient API.
*/
export class Gradient {
accessToken: string | null;
@@ -205,11 +144,12 @@ export class Gradient {
agentAccessKey: string | null;
agentEndpoint: string | null;
inferenceEndpoint: string | null;
+ kbassEndpoint: string | null;
baseURL: string;
maxRetries: number;
timeout: number;
- logger: Logger | undefined;
+ logger: Logger;
logLevel: LogLevel | undefined;
fetchOptions: MergedRequestInit | undefined;
@@ -225,7 +165,8 @@ export class Gradient {
* @param {string | null | undefined} [opts.modelAccessKey=process.env['GRADIENT_MODEL_ACCESS_KEY'] ?? null]
* @param {string | null | undefined} [opts.agentAccessKey=process.env['GRADIENT_AGENT_ACCESS_KEY'] ?? null]
* @param {string | null | undefined} [opts.agentEndpoint=process.env['GRADIENT_AGENT_ENDPOINT'] ?? null]
- * @param {string | null | undefined} [opts.inferenceEndpoint=process.env['GRADIENT_INFERENCE_ENDPOINT'] ?? inference.do-ai.run]
+ * @param {string | null | undefined} [opts.inferenceEndpoint=https://inference.do-ai.run]
+ * @param {string | null | undefined} [opts.kbassEndpoint=process.env['GRADIENT_KBASS_ENDPOINT'] ?? kbaas.do-ai.run]
* @param {string} [opts.baseURL=process.env['GRADIENT_BASE_URL'] ?? https://api.digitalocean.com] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -240,15 +181,18 @@ export class Gradient {
modelAccessKey = readEnv('GRADIENT_MODEL_ACCESS_KEY') ?? null,
agentAccessKey = readEnv('GRADIENT_AGENT_ACCESS_KEY') ?? null,
agentEndpoint = readEnv('GRADIENT_AGENT_ENDPOINT') ?? null,
- inferenceEndpoint = readEnv('GRADIENT_INFERENCE_ENDPOINT') ?? 'inference.do-ai.run',
+ inferenceEndpoint = 'https://inference.do-ai.run',
+ kbassEndpoint = readEnv('GRADIENT_KBASS_ENDPOINT') ?? 'kbaas.do-ai.run',
...opts
}: ClientOptions = {}) {
+
const options: ClientOptions = {
accessToken,
modelAccessKey,
agentAccessKey,
agentEndpoint,
inferenceEndpoint,
+ kbassEndpoint,
...opts,
baseURL: baseURL || `https://api.digitalocean.com`,
};
@@ -259,10 +203,7 @@ export class Gradient {
const defaultLogLevel = 'warn';
// Set default logLevel early so that we can log a warning in parseLogLevel.
this.logLevel = defaultLogLevel;
- this.logLevel =
- parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ??
- parseLogLevel(readEnv('GRADIENT_LOG'), "process.env['GRADIENT_LOG']", this) ??
- defaultLogLevel;
+ this.logLevel = parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? parseLogLevel(readEnv('GRADIENT_LOG'), 'process.env[\'GRADIENT_LOG\']', this) ?? defaultLogLevel;
this.fetchOptions = options.fetchOptions;
this.maxRetries = options.maxRetries ?? 2;
this.fetch = options.fetch ?? Shims.getDefaultFetch();
@@ -275,6 +216,7 @@ export class Gradient {
this.agentAccessKey = agentAccessKey;
this.agentEndpoint = agentEndpoint;
this.inferenceEndpoint = inferenceEndpoint;
+ this.kbassEndpoint = kbassEndpoint;
}
/**
@@ -295,7 +237,8 @@ export class Gradient {
agentAccessKey: this.agentAccessKey,
agentEndpoint: this.agentEndpoint,
inferenceEndpoint: this.inferenceEndpoint,
- ...options,
+ kbassEndpoint: this.kbassEndpoint,
+ ...options
});
return client;
}
@@ -308,7 +251,7 @@ export class Gradient {
}
protected defaultQuery(): Record | undefined {
- return this._options.defaultQuery;
+ return this._options.defaultQuery
}
protected validateHeaders({ values, nulls }: NullableHeaders) {
@@ -333,17 +276,11 @@ export class Gradient {
return;
}
- throw new Error(
- 'Could not resolve authentication method. Expected one of accessToken, modelAccessKey or agentAccessKey to be set. Or for one of the "Authorization", "Authorization" or "Authorization" headers to be explicitly omitted',
- );
+ throw new Error('Could not resolve authentication method. Expected one of accessToken, modelAccessKey or agentAccessKey to be set. Or for one of the "Authorization", "Authorization" or "Authorization" headers to be explicitly omitted')
}
protected async authHeaders(opts: FinalRequestOptions): Promise {
- return buildHeaders([
- await this.bearerAuth(opts),
- await this.modelAccessKeyAuth(opts),
- await this.agentAccessKeyAuth(opts),
- ]);
+ return buildHeaders([await this.bearerAuth(opts), await this.modelAccessKeyAuth(opts), await this.agentAccessKeyAuth(opts)]);
}
protected async bearerAuth(opts: FinalRequestOptions): Promise {
@@ -367,8 +304,8 @@ export class Gradient {
return buildHeaders([{ Authorization: `Bearer ${this.agentAccessKey}` }]);
}
- protected stringifyQuery(query: Record): string {
- return qs.stringify(query, { arrayFormat: 'comma' });
+ protected stringifyQuery(query: object | Record): string {
+ return stringifyQuery(query);
}
private getUserAgent(): string {
@@ -388,11 +325,7 @@ export class Gradient {
return Errors.APIError.generate(status, error, message, headers);
}
- buildURL(
- path: string,
- query: Record | null | undefined,
- defaultBaseURL?: string | undefined,
- ): string {
+ buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string {
const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
const url =
isAbsoluteURL(path) ?
@@ -400,12 +333,13 @@ export class Gradient {
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
const defaultQuery = this.defaultQuery();
- if (!isEmptyObj(defaultQuery)) {
- query = { ...defaultQuery, ...query };
+ const pathQuery = Object.fromEntries(url.searchParams);
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
+ query = { ...pathQuery, ...defaultQuery, ...query };
}
if (typeof query === 'object' && query && !Array.isArray(query)) {
- url.search = this.stringifyQuery(query as Record);
+ url.search = this.stringifyQuery(query);
}
return url.toString();
@@ -479,9 +413,7 @@ export class Gradient {
await this.prepareOptions(options);
- const { req, url, timeout } = await this.buildRequest(options, {
- retryCount: maxRetries - retriesRemaining,
- });
+ const { req, url, timeout } = await this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
await this.prepareRequest(req, { url, options });
@@ -490,16 +422,7 @@ export class Gradient {
const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`;
const startTime = Date.now();
- loggerFor(this).debug(
- `[${requestLogID}] sending request`,
- formatRequestDetails({
- retryOfRequestLogID,
- method: options.method,
- url,
- options,
- headers: req.headers,
- }),
- );
+ loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({ retryOfRequestLogID, method: options.method, url, options, headers: req.headers }));
if (options.signal?.aborted) {
throw new Errors.APIUserAbortError();
@@ -518,45 +441,21 @@ export class Gradient {
// deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)"
// undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)"
// others do not provide enough information to distinguish timeouts from other connection errors
- const isTimeout =
- isAbortError(response) ||
- /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''));
+ const isTimeout = isAbortError(response) || /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''))
if (retriesRemaining) {
- loggerFor(this).info(
- `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`,
- );
- loggerFor(this).debug(
- `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`,
- formatRequestDetails({
- retryOfRequestLogID,
- url,
- durationMs: headersTime - startTime,
- message: response.message,
- }),
- );
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`)
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message }));
return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID);
}
- loggerFor(this).info(
- `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`,
- );
- loggerFor(this).debug(
- `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`,
- formatRequestDetails({
- retryOfRequestLogID,
- url,
- durationMs: headersTime - startTime,
- message: response.message,
- }),
- );
+ loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`)
+ loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message }));
if (isTimeout) {
throw new Errors.APIConnectionTimeoutError();
}
throw new Errors.APIConnectionError({ cause: response });
}
- const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${
- response.ok ? 'succeeded' : 'failed'
- } with status ${response.status} in ${headersTime - startTime}ms`;
+ const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`;
if (!response.ok) {
const shouldRetry = await this.shouldRetry(response);
@@ -565,60 +464,27 @@ export class Gradient {
// We don't need the body of this response.
await Shims.CancelReadableStream(response.body);
- loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
- loggerFor(this).debug(
- `[${requestLogID}] response error (${retryMessage})`,
- formatRequestDetails({
- retryOfRequestLogID,
- url: response.url,
- status: response.status,
- headers: response.headers,
- durationMs: headersTime - startTime,
- }),
- );
- return this.retryRequest(
- options,
- retriesRemaining,
- retryOfRequestLogID ?? requestLogID,
- response.headers,
- );
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`)
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime }));
+ return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers);
}
const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`;
- loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
+ loggerFor(this).info(`${responseInfo} - ${retryMessage}`)
const errText = await response.text().catch((err: any) => castToError(err).message);
- const errJSON = safeJSON(errText);
+ const errJSON = safeJSON(errText) as any;
const errMessage = errJSON ? undefined : errText;
- loggerFor(this).debug(
- `[${requestLogID}] response error (${retryMessage})`,
- formatRequestDetails({
- retryOfRequestLogID,
- url: response.url,
- status: response.status,
- headers: response.headers,
- message: errMessage,
- durationMs: Date.now() - startTime,
- }),
- );
+ loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, message: errMessage, durationMs: Date.now() - startTime }));
const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers);
throw err;
}
- loggerFor(this).info(responseInfo);
- loggerFor(this).debug(
- `[${requestLogID}] response start`,
- formatRequestDetails({
- retryOfRequestLogID,
- url: response.url,
- status: response.status,
- headers: response.headers,
- durationMs: headersTime - startTime,
- }),
- );
+ loggerFor(this).info(responseInfo)
+ loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime }));
return { response, options, controller, requestLogID, retryOfRequestLogID, startTime };
}
@@ -630,13 +496,12 @@ export class Gradient {
controller: AbortController,
): Promise {
const { signal, method, ...options } = init || {};
- if (signal) signal.addEventListener('abort', () => controller.abort());
+ const abort = this._makeAbort(controller);
+ if (signal) signal.addEventListener('abort', abort, { once: true });
- const timeout = setTimeout(() => controller.abort(), ms);
+ const timeout = setTimeout(abort, ms);
- const isReadableBody =
- ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
- (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body);
+ const isReadableBody = ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || (typeof options.body === "object" && options.body !== null && Symbol.asyncIterator in options.body);
const fetchOptions: RequestInit = {
signal: controller.signal as any,
@@ -651,6 +516,7 @@ export class Gradient {
}
try {
+
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
return await this.fetch.call(undefined, url, fetchOptions);
} finally {
@@ -709,9 +575,9 @@ export class Gradient {
}
}
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
- // just do what it says, but otherwise calculate a default
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
+ // If the API asks us to wait a certain amount of time, just do what it
+ // says, but otherwise calculate a default
+ if (timeoutMillis === undefined) {
const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
@@ -751,12 +617,11 @@ export class Gradient {
const req: FinalizedRequestInit = {
method,
headers: reqHeaders,
- ...(options.signal && { signal: options.signal }),
- ...((globalThis as any).ReadableStream &&
- body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }),
+ ...(options.signal && { signal: options.signal}),
+ ...((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream && { duplex: "half" }),
...(body && { body }),
- ...((this.fetchOptions as any) ?? {}),
- ...((options.fetchOptions as any) ?? {}),
+ ...(this.fetchOptions as any ?? {}),
+ ...(options.fetchOptions as any ?? {}),
};
return { req, url, timeout: options.timeout };
@@ -781,17 +646,15 @@ export class Gradient {
const headers = buildHeaders([
idempotencyHeaders,
- {
- Accept: 'application/json',
- 'User-Agent': this.getUserAgent(),
- 'X-Stainless-Retry-Count': String(retryCount),
- ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
- ...getPlatformHeaders(),
- },
+ {Accept: 'application/json',
+ 'User-Agent': this.getUserAgent(),
+ 'X-Stainless-Retry-Count': String(retryCount),
+ ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
+ ...getPlatformHeaders()},
await this.authHeaders(options),
this._options.defaultHeaders,
bodyHeaders,
- options.headers,
+ options.headers
]);
this.validateHeaders(headers);
@@ -799,6 +662,12 @@ export class Gradient {
return headers.values;
}
+ private _makeAbort(controller: AbortController) {
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
+ // would capture all request options, and cause a memory leak.
+ return () => controller.abort();
+ }
+
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
bodyHeaders: HeadersLike;
body: BodyInit | undefined;
@@ -812,9 +681,11 @@ export class Gradient {
ArrayBuffer.isView(body) ||
body instanceof ArrayBuffer ||
body instanceof DataView ||
- (typeof body === 'string' &&
+ (
+ typeof body === 'string' &&
// Preserve legacy string encoding behavior for now
- headers.values.has('content-type')) ||
+ headers.values.has('content-type')
+ ) ||
// `Blob` is superset of `File`
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
// `FormData` -> `multipart/form-data`
@@ -831,13 +702,21 @@ export class Gradient {
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
) {
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) };
+ } else if (
+ typeof body === 'object' &&
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
+ ) {
+ return {
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
+ body: this.stringifyQuery(body),
+ };
} else {
return this.#encoder({ body, headers });
}
}
static Gradient = this;
- static DEFAULT_TIMEOUT = 60000; // 1 minute
+ static DEFAULT_TIMEOUT = 60000 // 1 minute
static GradientError = Errors.GradientError;
static APIError = Errors.APIError;
@@ -862,142 +741,253 @@ export class Gradient {
static toFile = Uploads.toFile;
+ /**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
agents: API.Agents = new API.Agents(this);
chat: API.Chat = new API.Chat(this);
+ /**
+ * Generate images from text prompts using various AI models.
+ */
images: API.Images = new API.Images(this);
+ /**
+ * Generate text-to-text responses from text prompts.
+ */
+ responses: API.Responses = new API.Responses(this);
+ /**
+ * A [Droplet](https://docs.digitalocean.com/products/droplets/) is a DigitalOcean
+ * virtual machine. By sending requests to the Droplet endpoint, you can
+ * list, create, or delete Droplets.
+ *
+ * Some of the attributes will have an object value. The `region` and `image`
+ * objects will all contain the standard attributes of their associated
+ * types. Find more information about each of these objects in their
+ * respective sections.
+ */
gpuDroplets: API.GPUDroplets = new API.GPUDroplets(this);
inference: API.Inference = new API.Inference(this);
+ /**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
knowledgeBases: API.KnowledgeBases = new API.KnowledgeBases(this);
+ /**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
models: API.Models = new API.Models(this);
+ /**
+ * Provides information about DigitalOcean data center regions.
+ */
regions: API.Regions = new API.Regions(this);
databases: API.Databases = new API.Databases(this);
+ nfs: API.Nfs = new API.Nfs(this);
+ retrieve: API.Retrieve = new API.Retrieve(this);
+ apps: API.Apps = new API.Apps(this);
+ /**
+ * The billing endpoints allow you to retrieve your account balance, invoices,
+ * billing history, and insights.
+ *
+ * **Balance:** By sending requests to the `/v2/customers/my/balance` endpoint, you can
+ * retrieve the balance information for the requested customer account.
+ *
+ * **Invoices:** [Invoices](https://docs.digitalocean.com/platform/billing/invoices/)
+ * are generated on the first of each month for every DigitalOcean
+ * customer. An invoice preview is generated daily, which can be accessed
+ * with the `preview` keyword in place of `$INVOICE_UUID`. To interact with
+ * invoices, you will generally send requests to the invoices endpoint at
+ * `/v2/customers/my/invoices`.
+ *
+ * **Billing History:** Billing history is a record of billing events for your account.
+ * For example, entries may include events like payments made, invoices
+ * issued, or credits granted. To interact with invoices, you
+ * will generally send requests to the invoices endpoint at
+ * `/v2/customers/my/billing_history`.
+ *
+ * **Billing Insights:** Day-over-day changes in billing resource usage based on nightly invoice items,
+ * including total amount, region, SKU, and description for a specified date range.
+ * It is important to note that the daily resource usage may not reflect month-end billing totals when totaled for
+ * a given month as nightly invoice items do not necessarily encompass all invoicing factors for the entire month.
+ * `v2/billing/{account_urn}/insights/{start_date}/{end_date}` where account_urn is the URN of the customer
+ * account, can be a team (do:team:uuid) or an organization (do:teamgroup:uuid). The date range specified by
+ * start_date and end_date must be in YYYY-MM-DD format.
+ */
+ billing: API.Billing = new API.Billing(this);
}
Gradient.Agents = Agents;
Gradient.Chat = Chat;
Gradient.Images = Images;
+Gradient.Responses = Responses;
Gradient.GPUDroplets = GPUDroplets;
Gradient.Inference = Inference;
Gradient.KnowledgeBases = KnowledgeBases;
Gradient.Models = Models;
Gradient.Regions = Regions;
Gradient.Databases = Databases;
+Gradient.Nfs = Nfs;
+Gradient.Retrieve = Retrieve;
+Gradient.Apps = Apps;
+Gradient.Billing = Billing;
export declare namespace Gradient {
- export type RequestOptions = Opts.RequestOptions;
-
- export {
- Agents as Agents,
- type APIAgent as APIAgent,
- type APIAgentAPIKeyInfo as APIAgentAPIKeyInfo,
- type APIAgentModel as APIAgentModel,
- type APIAnthropicAPIKeyInfo as APIAnthropicAPIKeyInfo,
- type APIDeploymentVisibility as APIDeploymentVisibility,
- type APIOpenAIAPIKeyInfo as APIOpenAIAPIKeyInfo,
- type APIRetrievalMethod as APIRetrievalMethod,
- type APIWorkspace as APIWorkspace,
- type AgentCreateResponse as AgentCreateResponse,
- type AgentRetrieveResponse as AgentRetrieveResponse,
- type AgentUpdateResponse as AgentUpdateResponse,
- type AgentListResponse as AgentListResponse,
- type AgentDeleteResponse as AgentDeleteResponse,
- type AgentRetrieveUsageResponse as AgentRetrieveUsageResponse,
- type AgentUpdateStatusResponse as AgentUpdateStatusResponse,
- type AgentCreateParams as AgentCreateParams,
- type AgentUpdateParams as AgentUpdateParams,
- type AgentListParams as AgentListParams,
- type AgentRetrieveUsageParams as AgentRetrieveUsageParams,
- type AgentUpdateStatusParams as AgentUpdateStatusParams,
- };
-
- export { Chat as Chat };
-
- export {
- Images as Images,
- type ImageGenerateResponse as ImageGenerateResponse,
- type ImageGenerateParams as ImageGenerateParams,
- type ImageGenerateParamsNonStreaming as ImageGenerateParamsNonStreaming,
- type ImageGenerateParamsStreaming as ImageGenerateParamsStreaming,
- };
-
- export {
- GPUDroplets as GPUDroplets,
- type DropletBackupPolicy as DropletBackupPolicy,
- type GPUDropletCreateResponse as GPUDropletCreateResponse,
- type GPUDropletRetrieveResponse as GPUDropletRetrieveResponse,
- type GPUDropletListResponse as GPUDropletListResponse,
- type GPUDropletListFirewallsResponse as GPUDropletListFirewallsResponse,
- type GPUDropletListKernelsResponse as GPUDropletListKernelsResponse,
- type GPUDropletListNeighborsResponse as GPUDropletListNeighborsResponse,
- type GPUDropletListSnapshotsResponse as GPUDropletListSnapshotsResponse,
- type GPUDropletCreateParams as GPUDropletCreateParams,
- type GPUDropletListParams as GPUDropletListParams,
- type GPUDropletDeleteByTagParams as GPUDropletDeleteByTagParams,
- type GPUDropletListFirewallsParams as GPUDropletListFirewallsParams,
- type GPUDropletListKernelsParams as GPUDropletListKernelsParams,
- type GPUDropletListSnapshotsParams as GPUDropletListSnapshotsParams,
- };
-
- export { Inference as Inference };
-
- export {
- KnowledgeBases as KnowledgeBases,
- type APIKnowledgeBase as APIKnowledgeBase,
- type KnowledgeBaseCreateResponse as KnowledgeBaseCreateResponse,
- type KnowledgeBaseRetrieveResponse as KnowledgeBaseRetrieveResponse,
- type KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse,
- type KnowledgeBaseListResponse as KnowledgeBaseListResponse,
- type KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse,
- type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams,
- type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams,
- type KnowledgeBaseListParams as KnowledgeBaseListParams,
- };
-
- export {
- Models as Models,
- type APIAgreement as APIAgreement,
- type APIModel as APIModel,
- type APIModelVersion as APIModelVersion,
- type ModelListResponse as ModelListResponse,
- type ModelListParams as ModelListParams,
- };
-
- export {
- Regions as Regions,
- type RegionListResponse as RegionListResponse,
- type RegionListParams as RegionListParams,
- };
-
- export { Databases as Databases };
-
- export type Action = API.Action;
- export type ActionLink = API.ActionLink;
- export type APILinks = API.APILinks;
- export type APIMeta = API.APIMeta;
- export type BackwardLinks = API.BackwardLinks;
- export type ChatCompletionChunk = API.ChatCompletionChunk;
- export type ChatCompletionTokenLogprob = API.ChatCompletionTokenLogprob;
- export type CompletionUsage = API.CompletionUsage;
- export type DiskInfo = API.DiskInfo;
- export type Droplet = API.Droplet;
- export type DropletNextBackupWindow = API.DropletNextBackupWindow;
- export type FirewallRuleTarget = API.FirewallRuleTarget;
- export type ForwardLinks = API.ForwardLinks;
- export type GarbageCollection = API.GarbageCollection;
- export type GPUInfo = API.GPUInfo;
- export type Image = API.Image;
- export type ImageGenCompletedEvent = API.ImageGenCompletedEvent;
- export type ImageGenPartialImageEvent = API.ImageGenPartialImageEvent;
- export type ImageGenStreamEvent = API.ImageGenStreamEvent;
- export type Kernel = API.Kernel;
- export type MetaProperties = API.MetaProperties;
- export type NetworkV4 = API.NetworkV4;
- export type NetworkV6 = API.NetworkV6;
- export type PageLinks = API.PageLinks;
- export type Region = API.Region;
- export type Size = API.Size;
- export type Snapshots = API.Snapshots;
- export type Subscription = API.Subscription;
- export type SubscriptionTierBase = API.SubscriptionTierBase;
- export type VpcPeering = API.VpcPeering;
-}
+ export type RequestOptions = Opts.RequestOptions;
+
+ export {
+ Agents as Agents,
+ type APIAgent as APIAgent,
+ type APIAgentAPIKeyInfo as APIAgentAPIKeyInfo,
+ type APIAgentModel as APIAgentModel,
+ type APIAnthropicAPIKeyInfo as APIAnthropicAPIKeyInfo,
+ type APIDeploymentVisibility as APIDeploymentVisibility,
+ type APIOpenAIAPIKeyInfo as APIOpenAIAPIKeyInfo,
+ type APIRetrievalMethod as APIRetrievalMethod,
+ type APIWorkspace as APIWorkspace,
+ type AgentCreateResponse as AgentCreateResponse,
+ type AgentRetrieveResponse as AgentRetrieveResponse,
+ type AgentUpdateResponse as AgentUpdateResponse,
+ type AgentListResponse as AgentListResponse,
+ type AgentDeleteResponse as AgentDeleteResponse,
+ type AgentRetrieveUsageResponse as AgentRetrieveUsageResponse,
+ type AgentUpdateStatusResponse as AgentUpdateStatusResponse,
+ type AgentCreateParams as AgentCreateParams,
+ type AgentUpdateParams as AgentUpdateParams,
+ type AgentListParams as AgentListParams,
+ type AgentRetrieveUsageParams as AgentRetrieveUsageParams,
+ type AgentUpdateStatusParams as AgentUpdateStatusParams
+};
+
+export {
+ Chat as Chat
+};
+
+export {
+ Images as Images,
+ type ImageGenerateResponse as ImageGenerateResponse,
+ type ImageGenerateParams as ImageGenerateParams,
+ type ImageGenerateParamsNonStreaming as ImageGenerateParamsNonStreaming,
+ type ImageGenerateParamsStreaming as ImageGenerateParamsStreaming
+};
+
+export {
+ Responses as Responses,
+ type ResponseCreateParams as ResponseCreateParams,
+ type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming,
+ type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming
+};
+
+export {
+ GPUDroplets as GPUDroplets,
+ type DropletBackupPolicy as DropletBackupPolicy,
+ type GPUDropletCreateResponse as GPUDropletCreateResponse,
+ type GPUDropletRetrieveResponse as GPUDropletRetrieveResponse,
+ type GPUDropletListResponse as GPUDropletListResponse,
+ type GPUDropletListFirewallsResponse as GPUDropletListFirewallsResponse,
+ type GPUDropletListKernelsResponse as GPUDropletListKernelsResponse,
+ type GPUDropletListNeighborsResponse as GPUDropletListNeighborsResponse,
+ type GPUDropletListSnapshotsResponse as GPUDropletListSnapshotsResponse,
+ type GPUDropletCreateParams as GPUDropletCreateParams,
+ type GPUDropletListParams as GPUDropletListParams,
+ type GPUDropletDeleteByTagParams as GPUDropletDeleteByTagParams,
+ type GPUDropletListFirewallsParams as GPUDropletListFirewallsParams,
+ type GPUDropletListKernelsParams as GPUDropletListKernelsParams,
+ type GPUDropletListSnapshotsParams as GPUDropletListSnapshotsParams
+};
+
+export {
+ Inference as Inference
+};
+
+export {
+ KnowledgeBases as KnowledgeBases,
+ type APIKnowledgeBase as APIKnowledgeBase,
+ type KnowledgeBaseCreateResponse as KnowledgeBaseCreateResponse,
+ type KnowledgeBaseRetrieveResponse as KnowledgeBaseRetrieveResponse,
+ type KnowledgeBaseUpdateResponse as KnowledgeBaseUpdateResponse,
+ type KnowledgeBaseListResponse as KnowledgeBaseListResponse,
+ type KnowledgeBaseDeleteResponse as KnowledgeBaseDeleteResponse,
+ type KnowledgeBaseListIndexingJobsResponse as KnowledgeBaseListIndexingJobsResponse,
+ type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams,
+ type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams,
+ type KnowledgeBaseListParams as KnowledgeBaseListParams
+};
+
+export {
+ Models as Models,
+ type APIAgreement as APIAgreement,
+ type APIModel as APIModel,
+ type APIModelVersion as APIModelVersion,
+ type ModelListResponse as ModelListResponse,
+ type ModelListParams as ModelListParams
+};
+
+export {
+ Regions as Regions,
+ type RegionListResponse as RegionListResponse,
+ type RegionListParams as RegionListParams
+};
+
+export {
+ Databases as Databases
+};
+
+export {
+ Nfs as Nfs,
+ type NfCreateResponse as NfCreateResponse,
+ type NfRetrieveResponse as NfRetrieveResponse,
+ type NfListResponse as NfListResponse,
+ type NfInitiateActionResponse as NfInitiateActionResponse,
+ type NfCreateParams as NfCreateParams,
+ type NfRetrieveParams as NfRetrieveParams,
+ type NfListParams as NfListParams,
+ type NfDeleteParams as NfDeleteParams,
+ type NfInitiateActionParams as NfInitiateActionParams
+};
+
+export {
+ Retrieve as Retrieve,
+ type RetrieveDocumentsResponse as RetrieveDocumentsResponse,
+ type RetrieveDocumentsParams as RetrieveDocumentsParams
+};
+
+export {
+ Apps as Apps
+};
+
+export {
+ Billing as Billing,
+ type BillingListInsightsResponse as BillingListInsightsResponse,
+ type BillingListInsightsParams as BillingListInsightsParams
+};
+
+export type Action = API.Action;
+export type ActionLink = API.ActionLink;
+export type APILinks = API.APILinks;
+export type APIMeta = API.APIMeta;
+export type BackwardLinks = API.BackwardLinks;
+export type ChatCompletionChunk = API.ChatCompletionChunk;
+export type ChatCompletionTokenLogprob = API.ChatCompletionTokenLogprob;
+export type CompletionUsage = API.CompletionUsage;
+export type CreateResponseResponse = API.CreateResponseResponse;
+export type CreateResponseStreamResponse = API.CreateResponseStreamResponse;
+export type DiskInfo = API.DiskInfo;
+export type Droplet = API.Droplet;
+export type DropletNextBackupWindow = API.DropletNextBackupWindow;
+export type FirewallRuleTarget = API.FirewallRuleTarget;
+export type ForwardLinks = API.ForwardLinks;
+export type GarbageCollection = API.GarbageCollection;
+export type GPUInfo = API.GPUInfo;
+export type Image = API.Image;
+export type ImageGenCompletedEvent = API.ImageGenCompletedEvent;
+export type ImageGenPartialImageEvent = API.ImageGenPartialImageEvent;
+export type ImageGenStreamEvent = API.ImageGenStreamEvent;
+export type Kernel = API.Kernel;
+export type MetaProperties = API.MetaProperties;
+export type NetworkV4 = API.NetworkV4;
+export type NetworkV6 = API.NetworkV6;
+export type PageLinks = API.PageLinks;
+export type Region = API.Region;
+export type Size = API.Size;
+export type Snapshots = API.Snapshots;
+export type Subscription = API.Subscription;
+export type SubscriptionTierBase = API.SubscriptionTierBase;
+export type VpcPeering = API.VpcPeering;
+ }
diff --git a/src/core/api-promise.ts b/src/core/api-promise.ts
index c56dfce1..1f372cb3 100644
--- a/src/core/api-promise.ts
+++ b/src/core/api-promise.ts
@@ -16,10 +16,7 @@ export class APIPromise extends Promise {
constructor(
client: Gradient,
private responsePromise: Promise,
- private parseResponse: (
- client: Gradient,
- props: APIResponseProps,
- ) => PromiseOrValue = defaultParseResponse,
+ private parseResponse: (client: Gradient, props: APIResponseProps) => PromiseOrValue = defaultParseResponse,
) {
super((resolve) => {
// this is maybe a bit weird but this has to be a no-op to not implicitly
@@ -31,9 +28,7 @@ export class APIPromise extends Promise {
}
_thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise {
- return new APIPromise(this.#client, this.responsePromise, async (client, props) =>
- transform(await this.parseResponse(client, props), props),
- );
+ return new APIPromise(this.#client, this.responsePromise, async (client, props) => transform(await this.parseResponse(client, props), props));
}
/**
diff --git a/src/core/error.ts b/src/core/error.ts
index f550fbce..1ea76dd2 100644
--- a/src/core/error.ts
+++ b/src/core/error.ts
@@ -2,13 +2,10 @@
import { castToError } from '../internal/errors';
-export class GradientError extends Error {}
+export class GradientError extends Error {
+}
-export class APIError<
- TStatus extends number | undefined = number | undefined,
- THeaders extends Headers | undefined = Headers | undefined,
- TError extends Object | undefined = Object | undefined,
-> extends GradientError {
+export class APIError extends GradientError {
/** HTTP status for the response that caused the error */
readonly status: TStatus;
/** HTTP headers for the response that caused the error */
@@ -16,6 +13,9 @@ export class APIError<
/** JSON body of the response that caused the error */
readonly error: TError;
+
+ ;
+
constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) {
super(`${APIError.makeMessage(status, error, message)}`);
this.status = status;
@@ -26,8 +26,7 @@ export class APIError<
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
const msg =
error?.message ?
- typeof error.message === 'string' ?
- error.message
+ typeof error.message === 'string' ? error.message
: JSON.stringify(error.message)
: error ? JSON.stringify(error)
: message;
@@ -44,12 +43,7 @@ export class APIError<
return '(no status code or body)';
}
- static generate(
- status: number | undefined,
- errorResponse: Object | undefined,
- message: string | undefined,
- headers: Headers | undefined,
- ): APIError {
+ static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError {
if (!status || !headers) {
return new APIConnectionError({ message, cause: castToError(errorResponse) });
}
@@ -113,18 +107,26 @@ export class APIConnectionTimeoutError extends APIConnectionError {
}
}
-export class BadRequestError extends APIError<400, Headers> {}
+export class BadRequestError extends APIError<400, Headers> {
+}
-export class AuthenticationError extends APIError<401, Headers> {}
+export class AuthenticationError extends APIError<401, Headers> {
+}
-export class PermissionDeniedError extends APIError<403, Headers> {}
+export class PermissionDeniedError extends APIError<403, Headers> {
+}
-export class NotFoundError extends APIError<404, Headers> {}
+export class NotFoundError extends APIError<404, Headers> {
+}
-export class ConflictError extends APIError<409, Headers> {}
+export class ConflictError extends APIError<409, Headers> {
+}
-export class UnprocessableEntityError extends APIError<422, Headers> {}
+export class UnprocessableEntityError extends APIError<422, Headers> {
+}
-export class RateLimitError extends APIError<429, Headers> {}
+export class RateLimitError extends APIError<429, Headers> {
+}
-export class InternalServerError extends APIError {}
+export class InternalServerError extends APIError {
+}
diff --git a/src/core/streaming.ts b/src/core/streaming.ts
index d909add7..4aec1467 100644
--- a/src/core/streaming.ts
+++ b/src/core/streaming.ts
@@ -8,7 +8,7 @@ import { encodeUTF8 } from '../internal/utils/bytes';
import { loggerFor } from '../internal/utils/log';
import type { Gradient } from '../client';
-import { APIError } from './error';
+import { APIError } from './error';;
type Bytes = string | ArrayBuffer | Uint8Array | null | undefined;
@@ -31,44 +31,46 @@ export class Stream- implements AsyncIterable
- {
this.#client = client;
}
- static fromSSEResponse
- (
- response: Response,
- controller: AbortController,
- client?: Gradient,
- ): Stream
- {
+ static fromSSEResponse
- (response: Response,
+controller: AbortController,
+client?: Gradient,): Stream
- {
let consumed = false;
const logger = client ? loggerFor(client) : console;
async function* iterator(): AsyncIterator
- {
if (consumed) {
- throw new GradientError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
+ throw new GradientError(
+ 'Cannot iterate over a consumed stream, use `.tee()` to split the stream.',
+ );
}
consumed = true;
let done = false;
try {
for await (const sse of _iterSSEMessages(response, controller)) {
if (done) continue;
-
+
if (sse.data.startsWith('[DONE]')) {
done = true;
continue;
- } else {
+ }
+
+ else {
let data;
-
+
try {
- data = JSON.parse(sse.data);
+ data = JSON.parse(sse.data) as any;
} catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
throw e;
}
-
+
if (data && data.error) {
- throw new APIError(undefined, data.error, undefined, response.headers);
+ throw new APIError(undefined, data.error, undefined, response.headers)
}
-
- yield data;
- }
+
+ yield data
+ };
}
done = true;
} catch (e) {
@@ -112,14 +114,16 @@ export class Stream
- implements AsyncIterable
- {
async function* iterator(): AsyncIterator
- {
if (consumed) {
- throw new GradientError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
+ throw new GradientError(
+ 'Cannot iterate over a consumed stream, use `.tee()` to split the stream.',
+ );
}
consumed = true;
let done = false;
try {
for await (const line of iterLines()) {
if (done) continue;
- if (line) yield JSON.parse(line);
+ if (line) yield JSON.parse(line) as Item;
}
done = true;
} catch (e) {
diff --git a/src/error.ts b/src/error.ts
index fc55f46c..d0832d34 100644
--- a/src/error.ts
+++ b/src/error.ts
@@ -1,2 +1,2 @@
/** @deprecated Import from ./core/error instead */
-export * from './core/error';
+export * from "./core/error"
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index bb264809..18781493 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -5,21 +5,7 @@ export { Gradient as default } from './client';
export { type Uploadable, toFile } from './core/uploads';
export { APIPromise } from './core/api-promise';
export { Gradient, type ClientOptions } from './client';
-export {
- GradientError,
- APIError,
- APIConnectionError,
- APIConnectionTimeoutError,
- APIUserAbortError,
- NotFoundError,
- ConflictError,
- RateLimitError,
- BadRequestError,
- AuthenticationError,
- InternalServerError,
- PermissionDeniedError,
- UnprocessableEntityError,
-} from './core/error';
+export { GradientError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError } from './core/error';
// Export knowledge base helpers
export {
diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts
index c23d3bde..6059d5db 100644
--- a/src/internal/builtin-types.ts
+++ b/src/internal/builtin-types.ts
@@ -1,20 +1,23 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise;
+export type Fetch = (
+ input: string | URL | Request,
+ init?: RequestInit,
+) => Promise
/**
* An alias to the builtin `RequestInit` type so we can
* easily alias it in import statements if there are name clashes.
- *
- * https://developer.mozilla.org/docs/Web/API/RequestInit
+ *
+ * https://developer.mozilla.org/docs/Web/API/RequestInit
*/
type _RequestInit = RequestInit;
/**
* An alias to the builtin `Response` type so we can
* easily alias it in import statements if there are name clashes.
- *
- * https://developer.mozilla.org/docs/Web/API/Response
+ *
+ * https://developer.mozilla.org/docs/Web/API/Response
*/
type _Response = Response;
@@ -51,15 +54,7 @@ type _Array = Array;
*/
type _Record = Record;
-export type {
- _Array as Array,
- _BodyInit as BodyInit,
- _HeadersInit as HeadersInit,
- _Record as Record,
- _RequestInfo as RequestInfo,
- _RequestInit as RequestInit,
- _Response as Response,
-};
+export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response };
/**
* A copy of the builtin `EndingType` type as it isn't fully supported in certain
diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts
index 0120a785..184d0c13 100644
--- a/src/internal/detect-platform.ts
+++ b/src/internal/detect-platform.ts
@@ -40,11 +40,7 @@ function getDetectedPlatform(): DetectedPlatform {
return 'edge';
}
// Node.js
- if (
- Object.prototype.toString.call(
- typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0,
- ) === '[object process]'
- ) {
+ if (Object.prototype.toString.call(typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0) === '[object process]') {
return 'node';
}
// Fallback Node.js heuristic for environments where toString check fails (e.g., some test runners)
diff --git a/src/internal/errors.ts b/src/internal/errors.ts
index 82c7b14d..c14a742b 100644
--- a/src/internal/errors.ts
+++ b/src/internal/errors.ts
@@ -2,12 +2,12 @@
export function isAbortError(err: unknown) {
return (
- typeof err === 'object' &&
- err !== null &&
- // Spec-compliant fetch implementations
- (('name' in err && (err as any).name === 'AbortError') ||
+ typeof err === 'object' && err !== null && (
+ // Spec-compliant fetch implementations
+ ('name' in err && (err as any).name === 'AbortError') ||
// Expo fetch
- ('message' in err && String((err as any).message).includes('FetchRequestCanceledException')))
+ ('message' in err && String((err as any).message).includes('FetchRequestCanceledException'))
+ )
);
}
@@ -24,10 +24,10 @@ export const castToError = (err: any): Error => {
if (err.name) error.name = err.name;
return error;
}
- } catch {}
+ } catch { }
try {
return new Error(JSON.stringify(err));
- } catch {}
+ } catch { }
}
return new Error(err);
};
diff --git a/src/internal/headers.ts b/src/internal/headers.ts
index c724a9d2..fa2ea2b9 100644
--- a/src/internal/headers.ts
+++ b/src/internal/headers.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import { isReadonlyArray } from './utils/values';
+import { isReadonlyArray } from "./utils/values";
type HeaderValue = string | undefined | null;
export type HeadersLike =
@@ -51,7 +51,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator(client: Gradient, props: APIRespon
const mediaType = contentType?.split(';')[0]?.trim();
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
if (isJSON) {
+ const contentLength = response.headers.get('content-length');
+ if (contentLength === '0') {
+ // if there is no content we can't do anything
+ return undefined as T;
+ }
+
const json = await response.json();
return json as T;
}
@@ -50,15 +56,6 @@ export async function defaultParseResponse(client: Gradient, props: APIRespon
const text = await response.text();
return text as unknown as T;
})();
- loggerFor(client).debug(
- `[${requestLogID}] response parsed`,
- formatRequestDetails({
- retryOfRequestLogID,
- url: response.url,
- status: response.status,
- body,
- durationMs: Date.now() - startTime,
- }),
- );
+ loggerFor(client).debug(`[${requestLogID}] response parsed`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, body, durationMs: Date.now() - startTime }));
return body;
}
diff --git a/src/internal/qs/utils.ts b/src/internal/qs/utils.ts
index 4cd56579..f21d955b 100644
--- a/src/internal/qs/utils.ts
+++ b/src/internal/qs/utils.ts
@@ -62,7 +62,10 @@ export function merge(
if (isArray(target)) {
target.push(source);
} else if (target && typeof target === 'object') {
- if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
+ if (
+ (options && (options.plainObjects || options.allowPrototypes)) ||
+ !has(Object.prototype, source)
+ ) {
target[source] = true;
}
} else {
diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts
index 56765e5a..0a02e610 100644
--- a/src/internal/request-options.ts
+++ b/src/internal/request-options.ts
@@ -77,11 +77,14 @@ export type RequestOptions = {
defaultBaseURL?: string | undefined;
__binaryResponse?: boolean | undefined;
- __streamClass?: typeof Stream;
+ __streamClass?: typeof Stream
};
export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
-export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent;
+export type RequestEncoder = (request: {
+ headers: NullableHeaders;
+ body: unknown;
+}) => EncodedContent;
export const FallbackEncoder: RequestEncoder = ({ headers, body }) => {
return {
diff --git a/src/internal/shim-types.ts b/src/internal/shim-types.ts
index 8ddf7b0a..accbf576 100644
--- a/src/internal/shim-types.ts
+++ b/src/internal/shim-types.ts
@@ -19,8 +19,8 @@ type _ConditionalNodeReadableStream =
typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream;
type _ReadableStream = NeverToAny<
- | ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream)
- | ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream)
+ ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream) |
+ ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream)
>;
export type { _ReadableStream as ReadableStream };
diff --git a/src/internal/shims.ts b/src/internal/shims.ts
index 988f35aa..603421e2 100644
--- a/src/internal/shims.ts
+++ b/src/internal/shims.ts
@@ -27,9 +27,7 @@ export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream
if (typeof ReadableStream === 'undefined') {
// Note: All of the platforms / runtimes we officially support already define
// `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes.
- throw new Error(
- '`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`',
- );
+ throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`');
}
return new ReadableStream(...args);
diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts
index 30eada32..c72a2b41 100644
--- a/src/internal/to-file.ts
+++ b/src/internal/to-file.ts
@@ -1,4 +1,4 @@
-import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads';
+import { BlobPart, getName, makeFile, isAsyncIterable } from "./uploads";
import type { FilePropertyBag } from './builtin-types';
import { checkFileSupport } from './uploads';
@@ -65,11 +65,8 @@ const isResponseLike = (value: any): value is ResponseLike =>
typeof value.url === 'string' &&
typeof value.blob === 'function';
-export type ToFileInput =
- | FileLike
- | ResponseLike
- | Exclude
- | AsyncIterable;
+export type ToFileInput = FileLike | ResponseLike | Exclude | AsyncIterable;
+
/**
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
@@ -119,7 +116,9 @@ export async function toFile(
return makeFile(parts, name, options);
}
-async function getBytes(value: BlobLikePart | AsyncIterable): Promise> {
+async function getBytes(
+ value: BlobLikePart | AsyncIterable,
+): Promise> {
let parts: Array = [];
if (
typeof value === 'string' ||
@@ -152,3 +151,4 @@ function propsForError(value: unknown): string {
const props = Object.getOwnPropertyNames(value);
return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`;
}
+
diff --git a/src/internal/types.ts b/src/internal/types.ts
index b668dfc0..c45fee32 100644
--- a/src/internal/types.ts
+++ b/src/internal/types.ts
@@ -7,40 +7,34 @@ export type KeysEnum = { [P in keyof Required]: true };
export type FinalizedRequestInit = RequestInit & { headers: Headers };
-type NotAny = [0] extends [1 & T] ? never : T;
+type NotAny = [0] extends [(1 & T)] ? never : T;
/**
* Some environments overload the global fetch function, and Parameters only gets the last signature.
*/
-type OverloadedParameters =
- T extends (
- {
+type OverloadedParameters = T extends {
+ (...args: infer A): unknown;
+ (...args: infer B): unknown;
+ (...args: infer C): unknown;
+ (...args: infer D): unknown;
+}
+ ? A | B | C | D
+ : T extends {
(...args: infer A): unknown;
(...args: infer B): unknown;
(...args: infer C): unknown;
- (...args: infer D): unknown;
}
- ) ?
- A | B | C | D
- : T extends (
- {
- (...args: infer A): unknown;
- (...args: infer B): unknown;
- (...args: infer C): unknown;
- }
- ) ?
- A | B | C
- : T extends (
- {
+ ? A | B | C
+ : T extends {
(...args: infer A): unknown;
(...args: infer B): unknown;
}
- ) ?
- A | B
- : T extends (...args: infer A) => unknown ? A
+ ? A | B
+ : T extends (...args: infer A) => unknown
+ ? A
: never;
-/* eslint-disable */
+
/**
* These imports attempt to get types from a parent package's dependencies.
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
@@ -63,19 +57,19 @@ type OverloadedParameters =
*
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
*/
-/** @ts-ignore For users with \@types/node */
+/** @ts-ignore For users with \@types/node */ /* prettier-ignore */
type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny;
-/** @ts-ignore For users with undici */
+/** @ts-ignore For users with undici */ /* prettier-ignore */
type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny;
-/** @ts-ignore For users with \@types/bun */
+/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
type BunRequestInit = globalThis.FetchRequestInit;
-/** @ts-ignore For users with node-fetch@2 */
+/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny;
-/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
+/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny;
-/** @ts-ignore For users who use Deno */
+/** @ts-ignore For users who use Deno */ /* prettier-ignore */
type FetchRequestInit = NonNullable[1]>;
-/* eslint-enable */
+
type RequestInits =
| NotAny
diff --git a/src/internal/utils.ts b/src/internal/utils.ts
index 3cbfacce..c591353b 100644
--- a/src/internal/utils.ts
+++ b/src/internal/utils.ts
@@ -6,3 +6,4 @@ export * from './utils/env';
export * from './utils/log';
export * from './utils/uuid';
export * from './utils/sleep';
+export * from './utils/query';
diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts
index 2d848007..cc5fa0fa 100644
--- a/src/internal/utils/env.ts
+++ b/src/internal/utils/env.ts
@@ -9,10 +9,10 @@
*/
export const readEnv = (env: string): string | undefined => {
if (typeof (globalThis as any).process !== 'undefined') {
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
}
if (typeof (globalThis as any).Deno !== 'undefined') {
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
}
return undefined;
};
diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts
index e8a930fa..06541df6 100644
--- a/src/internal/utils/log.ts
+++ b/src/internal/utils/log.ts
@@ -4,7 +4,7 @@ import { hasOwn } from './values';
import { type Gradient } from '../../client';
import { RequestOptions } from '../request-options';
-type LogFn = (message: string, ...rest: unknown[]) => void;
+type LogFn = (message: string, ...rest: unknown[]) => void
export type Logger = {
error: LogFn;
warn: LogFn;
@@ -21,22 +21,14 @@ const levelNumbers = {
debug: 500,
};
-export const parseLogLevel = (
- maybeLevel: string | undefined,
- sourceName: string,
- client: Gradient,
-): LogLevel | undefined => {
+export const parseLogLevel = (maybeLevel: string | undefined, sourceName: string, client: Gradient): LogLevel | undefined => {
if (!maybeLevel) {
return undefined;
}
if (hasOwn(levelNumbers, maybeLevel)) {
return maybeLevel;
- }
- loggerFor(client).warn(
- `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(
- Object.keys(levelNumbers),
- )}`,
- );
+ };
+ loggerFor(client).warn(`${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(Object.keys(levelNumbers))}`);
return undefined;
};
@@ -97,24 +89,11 @@ export const formatRequestDetails = (details: {
body?: unknown;
}) => {
if (details.options) {
- details.options = { ...details.options };
+ details.options = {...details.options};
delete details.options['headers']; // redundant + leaks internals
}
if (details.headers) {
- details.headers = Object.fromEntries(
- (details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(
- ([name, value]) => [
- name,
- (
- name.toLowerCase() === 'authorization' ||
- name.toLowerCase() === 'cookie' ||
- name.toLowerCase() === 'set-cookie'
- ) ?
- '***'
- : value,
- ],
- ),
- );
+ details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [name, name.toLowerCase() === 'authorization' || name.toLowerCase() === 'cookie' || name.toLowerCase() === 'set-cookie' ? '***' : value]))
}
if ('retryOfRequestLogID' in details) {
if (details.retryOfRequestLogID) {
@@ -122,5 +101,5 @@ export const formatRequestDetails = (details: {
}
delete details.retryOfRequestLogID;
}
- return details;
-};
+ return details
+}
diff --git a/src/internal/utils/query.ts b/src/internal/utils/query.ts
new file mode 100644
index 00000000..06e72d93
--- /dev/null
+++ b/src/internal/utils/query.ts
@@ -0,0 +1,7 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import * as qs from '../qs/stringify';
+
+export function stringifyQuery(query: object | Record) {
+ return qs.stringify(query, { arrayFormat: 'comma' })
+}
diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts
index b0e53aaf..53708ba6 100644
--- a/src/internal/utils/uuid.ts
+++ b/src/internal/utils/uuid.ts
@@ -10,8 +10,10 @@ export let uuid4 = function () {
return crypto.randomUUID();
}
const u8 = new Uint8Array(1);
- const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff;
- return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) =>
+ const randomByte = crypto
+ ? () => crypto.getRandomValues(u8)[0]!
+ : () => (Math.random() * 0xff) & 0xff;
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) =>
(+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16),
);
-};
+}
diff --git a/src/resource.ts b/src/resource.ts
index 363e3516..57a27a94 100644
--- a/src/resource.ts
+++ b/src/resource.ts
@@ -1,2 +1,2 @@
/** @deprecated Import from ./core/resource instead */
-export * from './core/resource';
+export * from "./core/resource"
\ No newline at end of file
diff --git a/src/resources/agents/agents.ts b/src/resources/agents/agents.ts
index ba6d606b..826ca7ea 100644
--- a/src/resources/agents/agents.ts
+++ b/src/resources/agents/agents.ts
@@ -6,105 +6,27 @@ import * as AgentsAPI from './agents';
import * as Shared from '../shared';
import * as APIKeysAPI from './api-keys';
import { GradientError } from '../../core/error';
-import {
- APIKeyCreateParams,
- APIKeyCreateResponse,
- APIKeyDeleteParams,
- APIKeyDeleteResponse,
- APIKeyListParams,
- APIKeyListResponse,
- APIKeyRegenerateParams,
- APIKeyRegenerateResponse,
- APIKeyUpdateParams,
- APIKeyUpdateResponse,
- APIKeys,
-} from './api-keys';
+import { APIKeyCreateParams, APIKeyCreateResponse, APIKeyDeleteParams, APIKeyDeleteResponse, APIKeyListParams, APIKeyListResponse, APIKeyRegenerateParams, APIKeyRegenerateResponse, APIKeyUpdateParams, APIKeyUpdateResponse, APIKeys } from './api-keys';
import * as EvaluationDatasetsAPI from './evaluation-datasets';
-import {
- EvaluationDatasetCreateFileUploadPresignedURLsParams,
- EvaluationDatasetCreateFileUploadPresignedURLsResponse,
- EvaluationDatasetCreateParams,
- EvaluationDatasetCreateResponse,
- EvaluationDatasets,
-} from './evaluation-datasets';
+import { EvaluationDatasetCreateFileUploadPresignedURLsParams, EvaluationDatasetCreateFileUploadPresignedURLsResponse, EvaluationDatasetCreateParams, EvaluationDatasetCreateResponse, EvaluationDatasets } from './evaluation-datasets';
import * as EvaluationRunsAPI from './evaluation-runs';
-import {
- APIEvaluationMetric,
- APIEvaluationMetricResult,
- APIEvaluationPrompt,
- APIEvaluationRun,
- EvaluationRunCreateParams,
- EvaluationRunCreateResponse,
- EvaluationRunListResultsParams,
- EvaluationRunListResultsResponse,
- EvaluationRunRetrieveResponse,
- EvaluationRunRetrieveResultsParams,
- EvaluationRunRetrieveResultsResponse,
- EvaluationRuns,
-} from './evaluation-runs';
+import { APIEvaluationMetric, APIEvaluationMetricResult, APIEvaluationPrompt, APIEvaluationRun, EvaluationRunCreateParams, EvaluationRunCreateResponse, EvaluationRunListResultsParams, EvaluationRunListResultsResponse, EvaluationRunRetrieveResponse, EvaluationRunRetrieveResultsParams, EvaluationRunRetrieveResultsResponse, EvaluationRuns } from './evaluation-runs';
import * as EvaluationTestCasesAPI from './evaluation-test-cases';
-import {
- APIEvaluationTestCase,
- APIStarMetric,
- EvaluationTestCaseCreateParams,
- EvaluationTestCaseCreateResponse,
- EvaluationTestCaseListEvaluationRunsParams,
- EvaluationTestCaseListEvaluationRunsResponse,
- EvaluationTestCaseListResponse,
- EvaluationTestCaseRetrieveParams,
- EvaluationTestCaseRetrieveResponse,
- EvaluationTestCaseUpdateParams,
- EvaluationTestCaseUpdateResponse,
- EvaluationTestCases,
-} from './evaluation-test-cases';
+import { APIEvaluationTestCase, APIStarMetric, EvaluationTestCaseCreateParams, EvaluationTestCaseCreateResponse, EvaluationTestCaseListEvaluationRunsParams, EvaluationTestCaseListEvaluationRunsResponse, EvaluationTestCaseListResponse, EvaluationTestCaseRetrieveParams, EvaluationTestCaseRetrieveResponse, EvaluationTestCaseUpdateParams, EvaluationTestCaseUpdateResponse, EvaluationTestCases } from './evaluation-test-cases';
import * as FunctionsAPI from './functions';
-import {
- FunctionCreateParams,
- FunctionCreateResponse,
- FunctionDeleteParams,
- FunctionDeleteResponse,
- FunctionUpdateParams,
- FunctionUpdateResponse,
- Functions,
-} from './functions';
+import { FunctionCreateParams, FunctionCreateResponse, FunctionDeleteParams, FunctionDeleteResponse, FunctionUpdateParams, FunctionUpdateResponse, Functions } from './functions';
import * as KnowledgeBasesAPI from './knowledge-bases';
-import {
- APILinkKnowledgeBaseOutput,
- KnowledgeBaseAttachSingleParams,
- KnowledgeBaseDetachParams,
- KnowledgeBaseDetachResponse,
- KnowledgeBases,
-} from './knowledge-bases';
+import { APILinkKnowledgeBaseOutput, KnowledgeBaseAttachSingleParams, KnowledgeBaseDetachParams, KnowledgeBaseDetachResponse, KnowledgeBases } from './knowledge-bases';
import * as RoutesAPI from './routes';
-import {
- RouteAddParams,
- RouteAddResponse,
- RouteDeleteParams,
- RouteDeleteResponse,
- RouteUpdateParams,
- RouteUpdateResponse,
- RouteViewResponse,
- Routes,
-} from './routes';
+import { RouteAddParams, RouteAddResponse, RouteDeleteParams, RouteDeleteResponse, RouteUpdateParams, RouteUpdateResponse, RouteViewResponse, Routes } from './routes';
import * as VersionsAPI from './versions';
-import {
- VersionListParams,
- VersionListResponse,
- VersionUpdateParams,
- VersionUpdateResponse,
- Versions,
-} from './versions';
-import * as KnowledgeBasesKnowledgeBasesAPI from '../knowledge-bases/knowledge-bases';
+import { VersionListParams, VersionListResponse, VersionUpdateParams, VersionUpdateResponse, Versions } from './versions';
+import * as ResourcesKnowledgeBasesAPI from '../knowledge-bases/knowledge-bases';
import * as ModelsAPI from '../models/models';
import * as ChatAPI from './chat/chat';
import { Chat } from './chat/chat';
import * as EvaluationMetricsAPI from './evaluation-metrics/evaluation-metrics';
-import {
- EvaluationMetricListRegionsParams,
- EvaluationMetricListRegionsResponse,
- EvaluationMetricListResponse,
- EvaluationMetrics,
-} from './evaluation-metrics/evaluation-metrics';
+import { EvaluationMetricListRegionsParams, EvaluationMetricListRegionsResponse, EvaluationMetricListResponse, EvaluationMetrics } from './evaluation-metrics/evaluation-metrics';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
@@ -136,18 +58,16 @@ export class AgentDeploymentError extends GradientError {
}
}
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Agents extends APIResource {
apiKeys: APIKeysAPI.APIKeys = new APIKeysAPI.APIKeys(this._client);
chat: ChatAPI.Chat = new ChatAPI.Chat(this._client);
- evaluationMetrics: EvaluationMetricsAPI.EvaluationMetrics = new EvaluationMetricsAPI.EvaluationMetrics(
- this._client,
- );
+ evaluationMetrics: EvaluationMetricsAPI.EvaluationMetrics = new EvaluationMetricsAPI.EvaluationMetrics(this._client);
evaluationRuns: EvaluationRunsAPI.EvaluationRuns = new EvaluationRunsAPI.EvaluationRuns(this._client);
- evaluationTestCases: EvaluationTestCasesAPI.EvaluationTestCases =
- new EvaluationTestCasesAPI.EvaluationTestCases(this._client);
- evaluationDatasets: EvaluationDatasetsAPI.EvaluationDatasets = new EvaluationDatasetsAPI.EvaluationDatasets(
- this._client,
- );
+ evaluationTestCases: EvaluationTestCasesAPI.EvaluationTestCases = new EvaluationTestCasesAPI.EvaluationTestCases(this._client);
+ evaluationDatasets: EvaluationDatasetsAPI.EvaluationDatasets = new EvaluationDatasetsAPI.EvaluationDatasets(this._client);
functions: FunctionsAPI.Functions = new FunctionsAPI.Functions(this._client);
versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client);
knowledgeBases: KnowledgeBasesAPI.KnowledgeBases = new KnowledgeBasesAPI.KnowledgeBases(this._client);
@@ -162,15 +82,8 @@ export class Agents extends APIResource {
* const agent = await client.agents.create();
* ```
*/
- create(
- body: AgentCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/agents', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: AgentCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/agents', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -185,10 +98,7 @@ export class Agents extends APIResource {
* ```
*/
retrieve(uuid: string, options?: RequestOptions): APIPromise {
- return this._client.get(path`/v2/gen-ai/agents/${uuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get(path`/v2/gen-ai/agents/${uuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -202,16 +112,8 @@ export class Agents extends APIResource {
* );
* ```
*/
- update(
- pathUuid: string,
- body: AgentUpdateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/agents/${pathUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(uuid: string, body: AgentUpdateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/agents/${uuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -222,15 +124,8 @@ export class Agents extends APIResource {
* const agents = await client.agents.list();
* ```
*/
- list(
- query: AgentListParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get('/v2/gen-ai/agents', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ list(query: AgentListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get('/v2/gen-ai/agents', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -244,10 +139,7 @@ export class Agents extends APIResource {
* ```
*/
delete(uuid: string, options?: RequestOptions): APIPromise {
- return this._client.delete(path`/v2/gen-ai/agents/${uuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.delete(path`/v2/gen-ai/agents/${uuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -261,16 +153,8 @@ export class Agents extends APIResource {
* );
* ```
*/
- retrieveUsage(
- uuid: string,
- query: AgentRetrieveUsageParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/agents/${uuid}/usage`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ retrieveUsage(uuid: string, query: AgentRetrieveUsageParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/agents/${uuid}/usage`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -284,16 +168,8 @@ export class Agents extends APIResource {
* );
* ```
*/
- updateStatus(
- pathUuid: string,
- body: AgentUpdateStatusParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/agents/${pathUuid}/deployment_visibility`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ updateStatus(uuid: string, body: AgentUpdateStatusParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/agents/${uuid}/deployment_visibility`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -421,7 +297,7 @@ export interface APIAgent {
/**
* Knowledge bases
*/
- knowledge_bases?: Array;
+ knowledge_bases?: Array;
logging_config?: APIAgent.LoggingConfig;
@@ -432,6 +308,8 @@ export interface APIAgent {
*/
model?: APIAgentModel;
+ model_provider_key?: APIAgent.ModelProviderKey;
+
/**
* Agent name
*/
@@ -521,6 +399,13 @@ export interface APIAgent {
*/
version_hash?: string;
+ /**
+ * VPC Egress IPs
+ */
+ vpc_egress_ips?: Array;
+
+ vpc_uuid?: string;
+
workspace?: APIWorkspace;
}
@@ -539,6 +424,8 @@ export namespace APIAgent {
* A Chatbot
*/
export interface Chatbot {
+ allowed_domains?: Array;
+
button_background_color?: string;
logo?: string;
@@ -579,16 +466,7 @@ export namespace APIAgent {
*/
name?: string;
- status?:
- | 'STATUS_UNKNOWN'
- | 'STATUS_WAITING_FOR_DEPLOYMENT'
- | 'STATUS_DEPLOYING'
- | 'STATUS_RUNNING'
- | 'STATUS_FAILED'
- | 'STATUS_WAITING_FOR_UNDEPLOYMENT'
- | 'STATUS_UNDEPLOYING'
- | 'STATUS_UNDEPLOYMENT_FAILED'
- | 'STATUS_DELETED';
+ status?: 'STATUS_UNKNOWN' | 'STATUS_WAITING_FOR_DEPLOYMENT' | 'STATUS_DEPLOYING' | 'STATUS_RUNNING' | 'STATUS_FAILED' | 'STATUS_WAITING_FOR_UNDEPLOYMENT' | 'STATUS_UNDEPLOYING' | 'STATUS_UNDEPLOYMENT_FAILED' | 'STATUS_DELETED' | 'STATUS_BUILDING';
/**
* Last modified
@@ -695,11 +573,7 @@ export namespace APIAgent {
priority?: number;
- type?:
- | 'GUARDRAIL_TYPE_UNKNOWN'
- | 'GUARDRAIL_TYPE_JAILBREAK'
- | 'GUARDRAIL_TYPE_SENSITIVE_DATA'
- | 'GUARDRAIL_TYPE_CONTENT_MODERATION';
+ type?: 'GUARDRAIL_TYPE_UNKNOWN' | 'GUARDRAIL_TYPE_JAILBREAK' | 'GUARDRAIL_TYPE_SENSITIVE_DATA' | 'GUARDRAIL_TYPE_CONTENT_MODERATION';
updated_at?: string;
@@ -738,6 +612,45 @@ export namespace APIAgent {
log_stream_name?: string;
}
+ export interface ModelProviderKey {
+ /**
+ * API key ID
+ */
+ api_key_uuid?: string;
+
+ /**
+ * Key creation date
+ */
+ created_at?: string;
+
+ /**
+ * Created by user id from DO
+ */
+ created_by?: string;
+
+ /**
+ * Key deleted date
+ */
+ deleted_at?: string;
+
+ /**
+ * Models supported by the openAI api key
+ */
+ models?: Array;
+
+ /**
+ * Name of the key
+ */
+ name?: string;
+
+ provider?: 'MODEL_PROVIDER_DIGITALOCEAN' | 'MODEL_PROVIDER_ANTHROPIC' | 'MODEL_PROVIDER_OPENAI';
+
+ /**
+ * Key last updated date
+ */
+ updated_at?: string;
+ }
+
/**
* Represents an AgentTemplate entity
*/
@@ -770,7 +683,7 @@ export namespace APIAgent {
/**
* List of knowledge bases associated with the agent template
*/
- knowledge_bases?: Array;
+ knowledge_bases?: Array;
/**
* The long description of the agent template
@@ -910,6 +823,21 @@ export interface APIAgentModel {
*/
is_foundational?: boolean;
+ /**
+ * Default chunking size limit to show in UI
+ */
+ kb_default_chunk_size?: number;
+
+ /**
+ * Maximum chunk size limit of model
+ */
+ kb_max_chunk_size?: number;
+
+ /**
+ * Minimum chunking size token limits if model supports KNOWLEDGEBASE usecase
+ */
+ kb_min_chunk_size?: number;
+
/**
* Additional meta data
*/
@@ -945,15 +873,7 @@ export interface APIAgentModel {
/**
* Usecases of the model
*/
- usecases?: Array<
- | 'MODEL_USECASE_UNKNOWN'
- | 'MODEL_USECASE_AGENT'
- | 'MODEL_USECASE_FINETUNED'
- | 'MODEL_USECASE_KNOWLEDGEBASE'
- | 'MODEL_USECASE_GUARDRAIL'
- | 'MODEL_USECASE_REASONING'
- | 'MODEL_USECASE_SERVERLESS'
- >;
+ usecases?: Array<'MODEL_USECASE_UNKNOWN' | 'MODEL_USECASE_AGENT' | 'MODEL_USECASE_FINETUNED' | 'MODEL_USECASE_KNOWLEDGEBASE' | 'MODEL_USECASE_GUARDRAIL' | 'MODEL_USECASE_REASONING' | 'MODEL_USECASE_SERVERLESS'>;
/**
* Unique id
@@ -1011,12 +931,7 @@ export interface APIAnthropicAPIKeyInfo {
* - VISIBILITY_PRIVATE: The deployment is private and will only service requests
* from other agents, or through API keys
*/
-export type APIDeploymentVisibility =
- | 'VISIBILITY_UNKNOWN'
- | 'VISIBILITY_DISABLED'
- | 'VISIBILITY_PLAYGROUND'
- | 'VISIBILITY_PUBLIC'
- | 'VISIBILITY_PRIVATE';
+export type APIDeploymentVisibility = 'VISIBILITY_UNKNOWN' | 'VISIBILITY_DISABLED' | 'VISIBILITY_PLAYGROUND' | 'VISIBILITY_PUBLIC' | 'VISIBILITY_PRIVATE'
/**
* OpenAI API Key Info
@@ -1065,12 +980,7 @@ export interface APIOpenAIAPIKeyInfo {
* - RETRIEVAL_METHOD_SUB_QUERIES: The retrieval method is sub queries
* - RETRIEVAL_METHOD_NONE: The retrieval method is none
*/
-export type APIRetrievalMethod =
- | 'RETRIEVAL_METHOD_UNKNOWN'
- | 'RETRIEVAL_METHOD_REWRITE'
- | 'RETRIEVAL_METHOD_STEP_BACK'
- | 'RETRIEVAL_METHOD_SUB_QUERIES'
- | 'RETRIEVAL_METHOD_NONE';
+export type APIRetrievalMethod = 'RETRIEVAL_METHOD_UNKNOWN' | 'RETRIEVAL_METHOD_REWRITE' | 'RETRIEVAL_METHOD_STEP_BACK' | 'RETRIEVAL_METHOD_SUB_QUERIES' | 'RETRIEVAL_METHOD_NONE'
export interface APIWorkspace {
/**
@@ -1348,6 +1258,8 @@ export namespace AgentListResponse {
* A Chatbot
*/
export interface Chatbot {
+ allowed_domains?: Array;
+
button_background_color?: string;
logo?: string;
@@ -1388,16 +1300,7 @@ export namespace AgentListResponse {
*/
name?: string;
- status?:
- | 'STATUS_UNKNOWN'
- | 'STATUS_WAITING_FOR_DEPLOYMENT'
- | 'STATUS_DEPLOYING'
- | 'STATUS_RUNNING'
- | 'STATUS_FAILED'
- | 'STATUS_WAITING_FOR_UNDEPLOYMENT'
- | 'STATUS_UNDEPLOYING'
- | 'STATUS_UNDEPLOYMENT_FAILED'
- | 'STATUS_DELETED';
+ status?: 'STATUS_UNKNOWN' | 'STATUS_WAITING_FOR_DEPLOYMENT' | 'STATUS_DEPLOYING' | 'STATUS_RUNNING' | 'STATUS_FAILED' | 'STATUS_WAITING_FOR_UNDEPLOYMENT' | 'STATUS_UNDEPLOYING' | 'STATUS_UNDEPLOYMENT_FAILED' | 'STATUS_DELETED' | 'STATUS_BUILDING';
/**
* Last modified
@@ -1459,7 +1362,7 @@ export namespace AgentListResponse {
/**
* List of knowledge bases associated with the agent template
*/
- knowledge_bases?: Array;
+ knowledge_bases?: Array;
/**
* The long description of the agent template
@@ -1648,6 +1551,8 @@ export interface AgentCreateParams {
*/
knowledge_base_uuid?: Array;
+ model_provider_key_uuid?: string;
+
/**
* Identifier for the foundation model.
*/
@@ -1677,11 +1582,22 @@ export interface AgentCreateParams {
* Agent tag to organize related resources
*/
tags?: Array;
+
+ /**
+ * Identifier for the workspace
+ */
+ workspace_uuid?: string;
}
export interface AgentUpdateParams {
agent_log_insights_enabled?: boolean;
+ /**
+ * Optional list of allowed domains for the chatbot - Must use fully qualified
+ * domain name (FQDN) such as https://example.com
+ */
+ allowed_domains?: Array;
+
/**
* Optional anthropic key uuid for use with anthropic models
*/
@@ -1717,6 +1633,11 @@ export interface AgentUpdateParams {
*/
max_tokens?: number;
+ /**
+ * Optional Model Provider uuid for use with provider models
+ */
+ model_provider_key_uuid?: string;
+
/**
* Identifier for the foundation model.
*/
@@ -1770,7 +1691,7 @@ export interface AgentUpdateParams {
/**
* Unique agent id
*/
- body_uuid?: string;
+ uuid?: string;
}
export interface AgentListParams {
@@ -1807,7 +1728,7 @@ export interface AgentUpdateStatusParams {
/**
* Unique id
*/
- body_uuid?: string;
+ uuid?: string;
/**
* - VISIBILITY_UNKNOWN: The status of the deployment is unknown
@@ -1855,7 +1776,7 @@ export declare namespace Agents {
type AgentUpdateParams as AgentUpdateParams,
type AgentListParams as AgentListParams,
type AgentRetrieveUsageParams as AgentRetrieveUsageParams,
- type AgentUpdateStatusParams as AgentUpdateStatusParams,
+ type AgentUpdateStatusParams as AgentUpdateStatusParams
};
export {
@@ -1869,16 +1790,18 @@ export declare namespace Agents {
type APIKeyUpdateParams as APIKeyUpdateParams,
type APIKeyListParams as APIKeyListParams,
type APIKeyDeleteParams as APIKeyDeleteParams,
- type APIKeyRegenerateParams as APIKeyRegenerateParams,
+ type APIKeyRegenerateParams as APIKeyRegenerateParams
};
- export { Chat as Chat };
+ export {
+ Chat as Chat
+ };
export {
EvaluationMetrics as EvaluationMetrics,
type EvaluationMetricListResponse as EvaluationMetricListResponse,
type EvaluationMetricListRegionsResponse as EvaluationMetricListRegionsResponse,
- type EvaluationMetricListRegionsParams as EvaluationMetricListRegionsParams,
+ type EvaluationMetricListRegionsParams as EvaluationMetricListRegionsParams
};
export {
@@ -1893,7 +1816,7 @@ export declare namespace Agents {
type EvaluationRunRetrieveResultsResponse as EvaluationRunRetrieveResultsResponse,
type EvaluationRunCreateParams as EvaluationRunCreateParams,
type EvaluationRunListResultsParams as EvaluationRunListResultsParams,
- type EvaluationRunRetrieveResultsParams as EvaluationRunRetrieveResultsParams,
+ type EvaluationRunRetrieveResultsParams as EvaluationRunRetrieveResultsParams
};
export {
@@ -1908,7 +1831,7 @@ export declare namespace Agents {
type EvaluationTestCaseCreateParams as EvaluationTestCaseCreateParams,
type EvaluationTestCaseRetrieveParams as EvaluationTestCaseRetrieveParams,
type EvaluationTestCaseUpdateParams as EvaluationTestCaseUpdateParams,
- type EvaluationTestCaseListEvaluationRunsParams as EvaluationTestCaseListEvaluationRunsParams,
+ type EvaluationTestCaseListEvaluationRunsParams as EvaluationTestCaseListEvaluationRunsParams
};
export {
@@ -1916,7 +1839,7 @@ export declare namespace Agents {
type EvaluationDatasetCreateResponse as EvaluationDatasetCreateResponse,
type EvaluationDatasetCreateFileUploadPresignedURLsResponse as EvaluationDatasetCreateFileUploadPresignedURLsResponse,
type EvaluationDatasetCreateParams as EvaluationDatasetCreateParams,
- type EvaluationDatasetCreateFileUploadPresignedURLsParams as EvaluationDatasetCreateFileUploadPresignedURLsParams,
+ type EvaluationDatasetCreateFileUploadPresignedURLsParams as EvaluationDatasetCreateFileUploadPresignedURLsParams
};
export {
@@ -1926,7 +1849,7 @@ export declare namespace Agents {
type FunctionDeleteResponse as FunctionDeleteResponse,
type FunctionCreateParams as FunctionCreateParams,
type FunctionUpdateParams as FunctionUpdateParams,
- type FunctionDeleteParams as FunctionDeleteParams,
+ type FunctionDeleteParams as FunctionDeleteParams
};
export {
@@ -1934,7 +1857,7 @@ export declare namespace Agents {
type VersionUpdateResponse as VersionUpdateResponse,
type VersionListResponse as VersionListResponse,
type VersionUpdateParams as VersionUpdateParams,
- type VersionListParams as VersionListParams,
+ type VersionListParams as VersionListParams
};
export {
@@ -1942,7 +1865,7 @@ export declare namespace Agents {
type APILinkKnowledgeBaseOutput as APILinkKnowledgeBaseOutput,
type KnowledgeBaseDetachResponse as KnowledgeBaseDetachResponse,
type KnowledgeBaseAttachSingleParams as KnowledgeBaseAttachSingleParams,
- type KnowledgeBaseDetachParams as KnowledgeBaseDetachParams,
+ type KnowledgeBaseDetachParams as KnowledgeBaseDetachParams
};
export {
@@ -1953,6 +1876,6 @@ export declare namespace Agents {
type RouteViewResponse as RouteViewResponse,
type RouteUpdateParams as RouteUpdateParams,
type RouteDeleteParams as RouteDeleteParams,
- type RouteAddParams as RouteAddParams,
+ type RouteAddParams as RouteAddParams
};
}
diff --git a/src/resources/agents/api-keys.ts b/src/resources/agents/api-keys.ts
index cb9994bb..84c2a9de 100644
--- a/src/resources/agents/api-keys.ts
+++ b/src/resources/agents/api-keys.ts
@@ -7,6 +7,9 @@ import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class APIKeys extends APIResource {
/**
* To create an agent API key, send a POST request to
@@ -19,16 +22,8 @@ export class APIKeys extends APIResource {
* );
* ```
*/
- create(
- agentUuid: string,
- body: APIKeyCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/api_keys`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(agentUuid: string, body: APIKeyCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/api_keys`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -46,17 +41,9 @@ export class APIKeys extends APIResource {
* );
* ```
*/
- update(
- apiKeyUuid: string,
- params: APIKeyUpdateParams,
- options?: RequestOptions,
- ): APIPromise {
- const { path_agent_uuid, ...body } = params;
- return this._client.put(path`/v2/gen-ai/agents/${path_agent_uuid}/api_keys/${apiKeyUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(apiKeyUuid: string, params: APIKeyUpdateParams, options?: RequestOptions): APIPromise {
+ const { path_agent_uuid, ...body } = params
+ return this._client.put(path`/v2/gen-ai/agents/${path_agent_uuid}/api_keys/${apiKeyUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -70,16 +57,8 @@ export class APIKeys extends APIResource {
* );
* ```
*/
- list(
- agentUuid: string,
- query: APIKeyListParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/agents/${agentUuid}/api_keys`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ list(agentUuid: string, query: APIKeyListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/agents/${agentUuid}/api_keys`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -94,16 +73,9 @@ export class APIKeys extends APIResource {
* );
* ```
*/
- delete(
- apiKeyUuid: string,
- params: APIKeyDeleteParams,
- options?: RequestOptions,
- ): APIPromise {
- const { agent_uuid } = params;
- return this._client.delete(path`/v2/gen-ai/agents/${agent_uuid}/api_keys/${apiKeyUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ delete(apiKeyUuid: string, params: APIKeyDeleteParams, options?: RequestOptions): APIPromise {
+ const { agent_uuid } = params
+ return this._client.delete(path`/v2/gen-ai/agents/${agent_uuid}/api_keys/${apiKeyUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -118,16 +90,9 @@ export class APIKeys extends APIResource {
* );
* ```
*/
- regenerate(
- apiKeyUuid: string,
- params: APIKeyRegenerateParams,
- options?: RequestOptions,
- ): APIPromise {
- const { agent_uuid } = params;
- return this._client.put(path`/v2/gen-ai/agents/${agent_uuid}/api_keys/${apiKeyUuid}/regenerate`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ regenerate(apiKeyUuid: string, params: APIKeyRegenerateParams, options?: RequestOptions): APIPromise {
+ const { agent_uuid } = params
+ return this._client.put(path`/v2/gen-ai/agents/${agent_uuid}/api_keys/${apiKeyUuid}/regenerate`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -180,7 +145,7 @@ export interface APIKeyCreateParams {
/**
* Agent id
*/
- body_agent_uuid?: string;
+ agent_uuid?: string;
/**
* A human friendly name to identify the key
@@ -202,7 +167,7 @@ export interface APIKeyUpdateParams {
/**
* Body param: API key ID
*/
- body_api_key_uuid?: string;
+ api_key_uuid?: string;
/**
* Body param: Name
@@ -247,6 +212,6 @@ export declare namespace APIKeys {
type APIKeyUpdateParams as APIKeyUpdateParams,
type APIKeyListParams as APIKeyListParams,
type APIKeyDeleteParams as APIKeyDeleteParams,
- type APIKeyRegenerateParams as APIKeyRegenerateParams,
+ type APIKeyRegenerateParams as APIKeyRegenerateParams
};
}
diff --git a/src/resources/agents/chat/chat.ts b/src/resources/agents/chat/chat.ts
index e9e3f118..f15ab26c 100644
--- a/src/resources/agents/chat/chat.ts
+++ b/src/resources/agents/chat/chat.ts
@@ -2,13 +2,7 @@
import { APIResource } from '../../../core/resource';
import * as CompletionsAPI from './completions';
-import {
- CompletionCreateParams,
- CompletionCreateParamsNonStreaming,
- CompletionCreateParamsStreaming,
- CompletionCreateResponse,
- Completions,
-} from './completions';
+import { CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, CompletionCreateResponse, Completions } from './completions';
export class Chat extends APIResource {
completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client);
@@ -22,6 +16,6 @@ export declare namespace Chat {
type CompletionCreateResponse as CompletionCreateResponse,
type CompletionCreateParams as CompletionCreateParams,
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
- type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
+ type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming
};
}
diff --git a/src/resources/agents/chat/completions.ts b/src/resources/agents/chat/completions.ts
index c5591483..000f5c58 100644
--- a/src/resources/agents/chat/completions.ts
+++ b/src/resources/agents/chat/completions.ts
@@ -7,6 +7,9 @@ import { APIPromise } from '../../../core/api-promise';
import { Stream } from '../../../core/streaming';
import { RequestOptions } from '../../../internal/request-options';
+/**
+ * Given a list of messages comprising a conversation, the model will return a response.
+ */
export class Completions extends APIResource {
/**
* Creates a model response for the given chat conversation.
@@ -20,28 +23,11 @@ export class Completions extends APIResource {
* });
* ```
*/
- create(
- body: CompletionCreateParamsNonStreaming,
- options?: RequestOptions,
- ): APIPromise;
- create(
- body: CompletionCreateParamsStreaming,
- options?: RequestOptions,
- ): APIPromise>;
- create(
- body: CompletionCreateParamsBase,
- options?: RequestOptions,
- ): APIPromise | CompletionCreateResponse>;
- create(
- body: CompletionCreateParams,
- options?: RequestOptions,
- ): APIPromise | APIPromise> {
- return this._client.post('/chat/completions?agent=true', {
- body,
- defaultBaseURL: '{agentEndpoint}/api/v1',
- ...options,
- stream: body.stream ?? false,
- }) as APIPromise | APIPromise>;
+ create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise
+ create(body: CompletionCreateParamsStreaming, options?: RequestOptions): APIPromise>
+ create(body: CompletionCreateParamsBase, options?: RequestOptions): APIPromise | CompletionCreateResponse>
+ create(body: CompletionCreateParams, options?: RequestOptions): APIPromise | APIPromise> {
+ return this._client.post('/chat/completions?agent=true', { body, defaultBaseURL: '{agentEndpoint}/api/v1', ...options, stream: body.stream ?? false }) as APIPromise | APIPromise>;
}
}
@@ -195,19 +181,13 @@ export namespace CompletionCreateResponse {
}
}
-export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
+export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming
export interface CompletionCreateParamsBase {
/**
* A list of messages comprising the conversation so far.
*/
- messages: Array<
- | CompletionCreateParams.ChatCompletionRequestSystemMessage
- | CompletionCreateParams.ChatCompletionRequestDeveloperMessage
- | CompletionCreateParams.ChatCompletionRequestUserMessage
- | CompletionCreateParams.ChatCompletionRequestAssistantMessage
- | CompletionCreateParams.ChatCompletionRequestToolMessage
- >;
+ messages: Array;
/**
* Model ID used to generate the response.
@@ -279,6 +259,12 @@ export interface CompletionCreateParamsBase {
*/
presence_penalty?: number | null;
+ /**
+ * Constrains effort on reasoning for reasoning models. Reducing reasoning effort
+ * can result in faster responses and fewer tokens used on reasoning in a response.
+ */
+ reasoning_effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | null;
+
/**
* Up to 4 sequences where the API will stop generating further tokens. The
* returned text will not contain the stop sequence.
@@ -345,7 +331,7 @@ export interface CompletionCreateParamsBase {
*/
user?: string;
- [k: string]: unknown;
+[k: string]: unknown
}
export namespace CompletionCreateParams {
@@ -357,7 +343,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the system message.
*/
- content: string | Array;
+ content: string | ChatCompletionRequestSystemMessage.ChatCompletionRequestContentPartText | Array;
/**
* The role of the messages author, in this case `system`.
@@ -369,7 +355,7 @@ export namespace CompletionCreateParams {
/**
* Content part with type and text
*/
- export interface UnionMember1 {
+ export interface ChatCompletionRequestContentPartText {
/**
* The text content
*/
@@ -379,6 +365,65 @@ export namespace CompletionCreateParams {
* The type of content part
*/
type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
}
}
@@ -390,7 +435,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the developer message.
*/
- content: string | Array;
+ content: string | ChatCompletionRequestDeveloperMessage.ChatCompletionRequestContentPartText | Array;
/**
* The role of the messages author, in this case `developer`.
@@ -402,7 +447,7 @@ export namespace CompletionCreateParams {
/**
* Content part with type and text
*/
- export interface UnionMember1 {
+ export interface ChatCompletionRequestContentPartText {
/**
* The text content
*/
@@ -412,6 +457,65 @@ export namespace CompletionCreateParams {
* The type of content part
*/
type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
}
}
@@ -423,7 +527,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the user message.
*/
- content: string | Array;
+ content: string | ChatCompletionRequestUserMessage.ChatCompletionRequestContentPartText | ChatCompletionRequestUserMessage.ChatCompletionRequestContentPartImageURL | ChatCompletionRequestUserMessage.ChatCompletionRequestContentPartVideoURL | Array;
/**
* The role of the messages author, in this case `user`.
@@ -435,7 +539,103 @@ export namespace CompletionCreateParams {
/**
* Content part with type and text
*/
- export interface UnionMember1 {
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and image URL.
+ */
+ export interface ChatCompletionRequestContentPartImageURL {
+ /**
+ * Image URL settings.
+ */
+ image_url: ChatCompletionRequestContentPartImageURL.ImageURL;
+
+ /**
+ * The type of content part
+ */
+ type: 'image_url';
+ }
+
+ export namespace ChatCompletionRequestContentPartImageURL {
+ /**
+ * Image URL settings.
+ */
+ export interface ImageURL {
+ /**
+ * A URL or data URL containing image content.
+ */
+ url: string;
+
+ /**
+ * Optional detail level for image understanding.
+ */
+ detail?: 'auto' | 'low' | 'high';
+ }
+ }
+
+ /**
+ * Content part with type and video URL.
+ */
+ export interface ChatCompletionRequestContentPartVideoURL {
+ /**
+ * The type of content part
+ */
+ type: 'video_url';
+
+ /**
+ * Video URL settings.
+ */
+ video_url: ChatCompletionRequestContentPartVideoURL.VideoURL;
+ }
+
+ export namespace ChatCompletionRequestContentPartVideoURL {
+ /**
+ * Video URL settings.
+ */
+ export interface VideoURL {
+ /**
+ * A URL or data URL containing video content.
+ */
+ url: string;
+ }
+ }
+
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
/**
* The text content
*/
@@ -445,6 +645,87 @@ export namespace CompletionCreateParams {
* The type of content part
*/
type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and image URL.
+ */
+ export interface ChatCompletionRequestContentPartImageURL {
+ /**
+ * Image URL settings.
+ */
+ image_url: ChatCompletionRequestContentPartImageURL.ImageURL;
+
+ /**
+ * The type of content part
+ */
+ type: 'image_url';
+ }
+
+ export namespace ChatCompletionRequestContentPartImageURL {
+ /**
+ * Image URL settings.
+ */
+ export interface ImageURL {
+ /**
+ * A URL or data URL containing image content.
+ */
+ url: string;
+
+ /**
+ * Optional detail level for image understanding.
+ */
+ detail?: 'auto' | 'low' | 'high';
+ }
+ }
+
+ /**
+ * Content part with type and video URL.
+ */
+ export interface ChatCompletionRequestContentPartVideoURL {
+ /**
+ * The type of content part
+ */
+ type: 'video_url';
+
+ /**
+ * Video URL settings.
+ */
+ video_url: ChatCompletionRequestContentPartVideoURL.VideoURL;
+ }
+
+ export namespace ChatCompletionRequestContentPartVideoURL {
+ /**
+ * Video URL settings.
+ */
+ export interface VideoURL {
+ /**
+ * A URL or data URL containing video content.
+ */
+ url: string;
+ }
}
}
@@ -460,7 +741,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the assistant message.
*/
- content?: string | Array | null;
+ content?: string | ChatCompletionRequestAssistantMessage.ChatCompletionRequestContentPartText | Array | null;
/**
* The tool calls generated by the model, such as function calls.
@@ -472,7 +753,7 @@ export namespace CompletionCreateParams {
/**
* Content part with type and text
*/
- export interface UnionMember1 {
+ export interface ChatCompletionRequestContentPartText {
/**
* The text content
*/
@@ -482,6 +763,65 @@ export namespace CompletionCreateParams {
* The type of content part
*/
type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
}
export interface ToolCall {
@@ -526,7 +866,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the tool message.
*/
- content: string;
+ content: string | ChatCompletionRequestToolMessage.ChatCompletionRequestContentPartText | Array;
/**
* The role of the messages author, in this case `tool`.
@@ -539,6 +879,82 @@ export namespace CompletionCreateParams {
tool_call_id: string;
}
+ export namespace ChatCompletionRequestToolMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+
+ /**
+ * Content part with type and text
+ */
+ export interface ChatCompletionRequestContentPartText {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+
+ /**
+ * Cache control settings for the content part.
+ */
+ cache_control?: ChatCompletionRequestContentPartText.CacheControl;
+ }
+
+ export namespace ChatCompletionRequestContentPartText {
+ /**
+ * Cache control settings for the content part.
+ */
+ export interface CacheControl {
+ /**
+ * The cache control type.
+ */
+ type: 'ephemeral';
+
+ /**
+ * The cache TTL.
+ */
+ ttl?: '5m' | '1h';
+ }
+ }
+ }
+
/**
* Options for streaming response. Only set this when you set `stream: true`.
*/
@@ -612,8 +1028,8 @@ export namespace CompletionCreateParams {
}
}
- export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
- export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
+ export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming
+ export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming
}
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
@@ -623,7 +1039,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
*/
stream?: false | null;
- [k: string]: unknown;
+[k: string]: unknown
}
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
@@ -633,7 +1049,7 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
*/
stream: true;
- [k: string]: unknown;
+[k: string]: unknown
}
export declare namespace Completions {
@@ -641,6 +1057,6 @@ export declare namespace Completions {
type CompletionCreateResponse as CompletionCreateResponse,
type CompletionCreateParams as CompletionCreateParams,
type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming,
- type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming,
+ type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming
};
}
diff --git a/src/resources/agents/chat/index.ts b/src/resources/agents/chat/index.ts
index 5b5443de..7e3f4953 100644
--- a/src/resources/agents/chat/index.ts
+++ b/src/resources/agents/chat/index.ts
@@ -1,10 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export { Chat } from './chat';
-export {
- Completions,
- type CompletionCreateResponse,
- type CompletionCreateParams,
- type CompletionCreateParamsNonStreaming,
- type CompletionCreateParamsStreaming,
-} from './completions';
+export { Chat } from './chat';;
+export { Completions, type CompletionCreateResponse, type CompletionCreateParams, type CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming } from './completions';;
diff --git a/src/resources/agents/evaluation-datasets.ts b/src/resources/agents/evaluation-datasets.ts
index 4ec0791c..2d23fbc3 100644
--- a/src/resources/agents/evaluation-datasets.ts
+++ b/src/resources/agents/evaluation-datasets.ts
@@ -5,6 +5,9 @@ import * as DataSourcesAPI from '../knowledge-bases/data-sources';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class EvaluationDatasets extends APIResource {
/**
* To create an evaluation dataset, send a POST request to
@@ -16,15 +19,8 @@ export class EvaluationDatasets extends APIResource {
* await client.agents.evaluationDatasets.create();
* ```
*/
- create(
- body: EvaluationDatasetCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/evaluation_datasets', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: EvaluationDatasetCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/evaluation_datasets', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -37,15 +33,8 @@ export class EvaluationDatasets extends APIResource {
* await client.agents.evaluationDatasets.createFileUploadPresignedURLs();
* ```
*/
- createFileUploadPresignedURLs(
- body: EvaluationDatasetCreateFileUploadPresignedURLsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/evaluation_datasets/file_upload_presigned_urls', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ createFileUploadPresignedURLs(body: EvaluationDatasetCreateFileUploadPresignedURLsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/evaluation_datasets/file_upload_presigned_urls', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -102,6 +91,8 @@ export namespace EvaluationDatasetCreateFileUploadPresignedURLsResponse {
}
export interface EvaluationDatasetCreateParams {
+ dataset_type?: 'EVALUATION_DATASET_TYPE_UNKNOWN' | 'EVALUATION_DATASET_TYPE_ADK' | 'EVALUATION_DATASET_TYPE_NON_ADK';
+
/**
* File to upload as data source for knowledge base.
*/
@@ -142,6 +133,6 @@ export declare namespace EvaluationDatasets {
type EvaluationDatasetCreateResponse as EvaluationDatasetCreateResponse,
type EvaluationDatasetCreateFileUploadPresignedURLsResponse as EvaluationDatasetCreateFileUploadPresignedURLsResponse,
type EvaluationDatasetCreateParams as EvaluationDatasetCreateParams,
- type EvaluationDatasetCreateFileUploadPresignedURLsParams as EvaluationDatasetCreateFileUploadPresignedURLsParams,
+ type EvaluationDatasetCreateFileUploadPresignedURLsParams as EvaluationDatasetCreateFileUploadPresignedURLsParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/anthropic/anthropic.ts b/src/resources/agents/evaluation-metrics/anthropic/anthropic.ts
index 69cf6025..bd8ddabc 100644
--- a/src/resources/agents/evaluation-metrics/anthropic/anthropic.ts
+++ b/src/resources/agents/evaluation-metrics/anthropic/anthropic.ts
@@ -2,19 +2,7 @@
import { APIResource } from '../../../../core/resource';
import * as KeysAPI from './keys';
-import {
- KeyCreateParams,
- KeyCreateResponse,
- KeyDeleteResponse,
- KeyListAgentsParams,
- KeyListAgentsResponse,
- KeyListParams,
- KeyListResponse,
- KeyRetrieveResponse,
- KeyUpdateParams,
- KeyUpdateResponse,
- Keys,
-} from './keys';
+import { KeyCreateParams, KeyCreateResponse, KeyDeleteResponse, KeyListAgentsParams, KeyListAgentsResponse, KeyListParams, KeyListResponse, KeyRetrieveResponse, KeyUpdateParams, KeyUpdateResponse, Keys } from './keys';
export class Anthropic extends APIResource {
keys: KeysAPI.Keys = new KeysAPI.Keys(this._client);
@@ -34,6 +22,6 @@ export declare namespace Anthropic {
type KeyCreateParams as KeyCreateParams,
type KeyUpdateParams as KeyUpdateParams,
type KeyListParams as KeyListParams,
- type KeyListAgentsParams as KeyListAgentsParams,
+ type KeyListAgentsParams as KeyListAgentsParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/anthropic/index.ts b/src/resources/agents/evaluation-metrics/anthropic/index.ts
index eed17c6c..807ed47f 100644
--- a/src/resources/agents/evaluation-metrics/anthropic/index.ts
+++ b/src/resources/agents/evaluation-metrics/anthropic/index.ts
@@ -1,16 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export { Anthropic } from './anthropic';
-export {
- Keys,
- type KeyCreateResponse,
- type KeyRetrieveResponse,
- type KeyUpdateResponse,
- type KeyListResponse,
- type KeyDeleteResponse,
- type KeyListAgentsResponse,
- type KeyCreateParams,
- type KeyUpdateParams,
- type KeyListParams,
- type KeyListAgentsParams,
-} from './keys';
+export { Anthropic } from './anthropic';;
+export { Keys, type KeyCreateResponse, type KeyRetrieveResponse, type KeyUpdateResponse, type KeyListResponse, type KeyDeleteResponse, type KeyListAgentsResponse, type KeyCreateParams, type KeyUpdateParams, type KeyListParams, type KeyListAgentsParams } from './keys';;
diff --git a/src/resources/agents/evaluation-metrics/anthropic/keys.ts b/src/resources/agents/evaluation-metrics/anthropic/keys.ts
index 5471c980..fa3d8288 100644
--- a/src/resources/agents/evaluation-metrics/anthropic/keys.ts
+++ b/src/resources/agents/evaluation-metrics/anthropic/keys.ts
@@ -7,6 +7,9 @@ import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
import { path } from '../../../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Keys extends APIResource {
/**
* To create an Anthropic API key, send a POST request to
@@ -18,15 +21,8 @@ export class Keys extends APIResource {
* await client.agents.evaluationMetrics.anthropic.keys.create();
* ```
*/
- create(
- body: KeyCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/anthropic/keys', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: KeyCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/anthropic/keys', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -42,10 +38,7 @@ export class Keys extends APIResource {
* ```
*/
retrieve(apiKeyUuid: string, options?: RequestOptions): APIPromise {
- return this._client.get(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -60,16 +53,8 @@ export class Keys extends APIResource {
* );
* ```
*/
- update(
- apiKeyUuid: string,
- body: KeyUpdateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(apiKeyUuid: string, body: KeyUpdateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -83,11 +68,7 @@ export class Keys extends APIResource {
* ```
*/
list(query: KeyListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
- return this._client.get('/v2/gen-ai/anthropic/keys', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get('/v2/gen-ai/anthropic/keys', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -103,10 +84,7 @@ export class Keys extends APIResource {
* ```
*/
delete(apiKeyUuid: string, options?: RequestOptions): APIPromise {
- return this._client.delete(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.delete(path`/v2/gen-ai/anthropic/keys/${apiKeyUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -120,16 +98,8 @@ export class Keys extends APIResource {
* );
* ```
*/
- listAgents(
- uuid: string,
- query: KeyListAgentsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/anthropic/keys/${uuid}/agents`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ listAgents(uuid: string, query: KeyListAgentsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/anthropic/keys/${uuid}/agents`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -230,7 +200,7 @@ export interface KeyUpdateParams {
/**
* API key ID
*/
- body_api_key_uuid?: string;
+ api_key_uuid?: string;
/**
* Name of the key
@@ -273,6 +243,6 @@ export declare namespace Keys {
type KeyCreateParams as KeyCreateParams,
type KeyUpdateParams as KeyUpdateParams,
type KeyListParams as KeyListParams,
- type KeyListAgentsParams as KeyListAgentsParams,
+ type KeyListAgentsParams as KeyListAgentsParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/evaluation-metrics.ts b/src/resources/agents/evaluation-metrics/evaluation-metrics.ts
index 690033ec..9bcf31c5 100644
--- a/src/resources/agents/evaluation-metrics/evaluation-metrics.ts
+++ b/src/resources/agents/evaluation-metrics/evaluation-metrics.ts
@@ -2,8 +2,8 @@
import { APIResource } from '../../../core/resource';
import * as EvaluationRunsAPI from '../evaluation-runs';
-import * as ModelsAPI from './models';
-import { ModelListParams, ModelListResponse, Models } from './models';
+import * as ScheduledIndexingAPI from './scheduled-indexing';
+import { ScheduledIndexing, ScheduledIndexingCreateParams, ScheduledIndexingCreateResponse, ScheduledIndexingDeleteResponse, ScheduledIndexingRetrieveResponse } from './scheduled-indexing';
import * as AnthropicAPI from './anthropic/anthropic';
import { Anthropic } from './anthropic/anthropic';
import * as Oauth2API from './oauth2/oauth2';
@@ -11,26 +11,19 @@ import { Oauth2, Oauth2GenerateURLParams, Oauth2GenerateURLResponse } from './oa
import * as OpenAIAPI from './openai/openai';
import { OpenAI } from './openai/openai';
import * as WorkspacesAPI from './workspaces/workspaces';
-import {
- WorkspaceCreateParams,
- WorkspaceCreateResponse,
- WorkspaceDeleteResponse,
- WorkspaceListEvaluationTestCasesResponse,
- WorkspaceListResponse,
- WorkspaceRetrieveResponse,
- WorkspaceUpdateParams,
- WorkspaceUpdateResponse,
- Workspaces,
-} from './workspaces/workspaces';
+import { WorkspaceCreateParams, WorkspaceCreateResponse, WorkspaceDeleteResponse, WorkspaceListEvaluationTestCasesResponse, WorkspaceListResponse, WorkspaceRetrieveResponse, WorkspaceUpdateParams, WorkspaceUpdateResponse, Workspaces } from './workspaces/workspaces';
import { APIPromise } from '../../../core/api-promise';
import { RequestOptions } from '../../../internal/request-options';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class EvaluationMetrics extends APIResource {
workspaces: WorkspacesAPI.Workspaces = new WorkspacesAPI.Workspaces(this._client);
- models: ModelsAPI.Models = new ModelsAPI.Models(this._client);
anthropic: AnthropicAPI.Anthropic = new AnthropicAPI.Anthropic(this._client);
openai: OpenAIAPI.OpenAI = new OpenAIAPI.OpenAI(this._client);
oauth2: Oauth2API.Oauth2 = new Oauth2API.Oauth2(this._client);
+ scheduledIndexing: ScheduledIndexingAPI.ScheduledIndexing = new ScheduledIndexingAPI.ScheduledIndexing(this._client);
/**
* To list all evaluation metrics, send a GET request to
@@ -43,10 +36,7 @@ export class EvaluationMetrics extends APIResource {
* ```
*/
list(options?: RequestOptions): APIPromise {
- return this._client.get('/v2/gen-ai/evaluation_metrics', {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get('/v2/gen-ai/evaluation_metrics', { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -58,15 +48,8 @@ export class EvaluationMetrics extends APIResource {
* await client.agents.evaluationMetrics.listRegions();
* ```
*/
- listRegions(
- query: EvaluationMetricListRegionsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get('/v2/gen-ai/regions', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ listRegions(query: EvaluationMetricListRegionsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get('/v2/gen-ai/regions', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -129,16 +112,16 @@ export interface EvaluationMetricListRegionsParams {
}
EvaluationMetrics.Workspaces = Workspaces;
-EvaluationMetrics.Models = Models;
EvaluationMetrics.Anthropic = Anthropic;
EvaluationMetrics.OpenAI = OpenAI;
EvaluationMetrics.Oauth2 = Oauth2;
+EvaluationMetrics.ScheduledIndexing = ScheduledIndexing;
export declare namespace EvaluationMetrics {
export {
type EvaluationMetricListResponse as EvaluationMetricListResponse,
type EvaluationMetricListRegionsResponse as EvaluationMetricListRegionsResponse,
- type EvaluationMetricListRegionsParams as EvaluationMetricListRegionsParams,
+ type EvaluationMetricListRegionsParams as EvaluationMetricListRegionsParams
};
export {
@@ -150,22 +133,28 @@ export declare namespace EvaluationMetrics {
type WorkspaceDeleteResponse as WorkspaceDeleteResponse,
type WorkspaceListEvaluationTestCasesResponse as WorkspaceListEvaluationTestCasesResponse,
type WorkspaceCreateParams as WorkspaceCreateParams,
- type WorkspaceUpdateParams as WorkspaceUpdateParams,
+ type WorkspaceUpdateParams as WorkspaceUpdateParams
};
export {
- Models as Models,
- type ModelListResponse as ModelListResponse,
- type ModelListParams as ModelListParams,
+ Anthropic as Anthropic
};
- export { Anthropic as Anthropic };
-
- export { OpenAI as OpenAI };
+ export {
+ OpenAI as OpenAI
+ };
export {
Oauth2 as Oauth2,
type Oauth2GenerateURLResponse as Oauth2GenerateURLResponse,
- type Oauth2GenerateURLParams as Oauth2GenerateURLParams,
+ type Oauth2GenerateURLParams as Oauth2GenerateURLParams
+ };
+
+ export {
+ ScheduledIndexing as ScheduledIndexing,
+ type ScheduledIndexingCreateResponse as ScheduledIndexingCreateResponse,
+ type ScheduledIndexingRetrieveResponse as ScheduledIndexingRetrieveResponse,
+ type ScheduledIndexingDeleteResponse as ScheduledIndexingDeleteResponse,
+ type ScheduledIndexingCreateParams as ScheduledIndexingCreateParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/index.ts b/src/resources/agents/evaluation-metrics/index.ts
index 7941c926..ec5ab1e2 100644
--- a/src/resources/agents/evaluation-metrics/index.ts
+++ b/src/resources/agents/evaluation-metrics/index.ts
@@ -1,23 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export { Anthropic } from './anthropic/index';
-export {
- EvaluationMetrics,
- type EvaluationMetricListResponse,
- type EvaluationMetricListRegionsResponse,
- type EvaluationMetricListRegionsParams,
-} from './evaluation-metrics';
-export { Models, type ModelListResponse, type ModelListParams } from './models';
-export { Oauth2, type Oauth2GenerateURLResponse, type Oauth2GenerateURLParams } from './oauth2/index';
-export { OpenAI } from './openai/index';
-export {
- Workspaces,
- type WorkspaceCreateResponse,
- type WorkspaceRetrieveResponse,
- type WorkspaceUpdateResponse,
- type WorkspaceListResponse,
- type WorkspaceDeleteResponse,
- type WorkspaceListEvaluationTestCasesResponse,
- type WorkspaceCreateParams,
- type WorkspaceUpdateParams,
-} from './workspaces/index';
+export { Anthropic } from './anthropic/index';;
+export { EvaluationMetrics, type EvaluationMetricListResponse, type EvaluationMetricListRegionsResponse, type EvaluationMetricListRegionsParams } from './evaluation-metrics';;
+export { Oauth2, type Oauth2GenerateURLResponse, type Oauth2GenerateURLParams } from './oauth2/index';;
+export { OpenAI } from './openai/index';;
+export { ScheduledIndexing, type ScheduledIndexingCreateResponse, type ScheduledIndexingRetrieveResponse, type ScheduledIndexingDeleteResponse, type ScheduledIndexingCreateParams } from './scheduled-indexing';;
+export { Workspaces, type WorkspaceCreateResponse, type WorkspaceRetrieveResponse, type WorkspaceUpdateResponse, type WorkspaceListResponse, type WorkspaceDeleteResponse, type WorkspaceListEvaluationTestCasesResponse, type WorkspaceCreateParams, type WorkspaceUpdateParams } from './workspaces/index';;
diff --git a/src/resources/agents/evaluation-metrics/models.ts b/src/resources/agents/evaluation-metrics/models.ts
deleted file mode 100644
index 2a8bfef3..00000000
--- a/src/resources/agents/evaluation-metrics/models.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import { APIResource } from '../../../core/resource';
-import * as Shared from '../../shared';
-import * as ModelsAPI from '../../models/models';
-import { APIPromise } from '../../../core/api-promise';
-import { RequestOptions } from '../../../internal/request-options';
-
-export class Models extends APIResource {
- /**
- * To list all models, send a GET request to `/v2/gen-ai/models`.
- *
- * @example
- * ```ts
- * const models =
- * await client.agents.evaluationMetrics.models.list();
- * ```
- */
- list(
- query: ModelListParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get('/v2/gen-ai/models', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
- }
-}
-
-/**
- * A list of models
- */
-export interface ModelListResponse {
- /**
- * Links to other pages
- */
- links?: Shared.APILinks;
-
- /**
- * Meta information about the data set
- */
- meta?: Shared.APIMeta;
-
- /**
- * The models
- */
- models?: Array;
-}
-
-export interface ModelListParams {
- /**
- * Page number.
- */
- page?: number;
-
- /**
- * Items per page.
- */
- per_page?: number;
-
- /**
- * Only include models that are publicly available.
- */
- public_only?: boolean;
-
- /**
- * Include only models defined for the listed usecases.
- *
- * - MODEL_USECASE_UNKNOWN: The use case of the model is unknown
- * - MODEL_USECASE_AGENT: The model maybe used in an agent
- * - MODEL_USECASE_FINETUNED: The model maybe used for fine tuning
- * - MODEL_USECASE_KNOWLEDGEBASE: The model maybe used for knowledge bases
- * (embedding models)
- * - MODEL_USECASE_GUARDRAIL: The model maybe used for guardrails
- * - MODEL_USECASE_REASONING: The model usecase for reasoning
- * - MODEL_USECASE_SERVERLESS: The model usecase for serverless inference
- */
- usecases?: Array<
- | 'MODEL_USECASE_UNKNOWN'
- | 'MODEL_USECASE_AGENT'
- | 'MODEL_USECASE_FINETUNED'
- | 'MODEL_USECASE_KNOWLEDGEBASE'
- | 'MODEL_USECASE_GUARDRAIL'
- | 'MODEL_USECASE_REASONING'
- | 'MODEL_USECASE_SERVERLESS'
- >;
-}
-
-export declare namespace Models {
- export { type ModelListResponse as ModelListResponse, type ModelListParams as ModelListParams };
-}
diff --git a/src/resources/agents/evaluation-metrics/oauth2/dropbox.ts b/src/resources/agents/evaluation-metrics/oauth2/dropbox.ts
index b0cabd8f..3ab5a95c 100644
--- a/src/resources/agents/evaluation-metrics/oauth2/dropbox.ts
+++ b/src/resources/agents/evaluation-metrics/oauth2/dropbox.ts
@@ -4,6 +4,9 @@ import { APIResource } from '../../../../core/resource';
import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Dropbox extends APIResource {
/**
* To obtain the refresh token, needed for creation of data sources, send a GET
@@ -16,15 +19,8 @@ export class Dropbox extends APIResource {
* await client.agents.evaluationMetrics.oauth2.dropbox.createTokens();
* ```
*/
- createTokens(
- body: DropboxCreateTokensParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/oauth2/dropbox/tokens', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ createTokens(body: DropboxCreateTokensParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/oauth2/dropbox/tokens', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -58,6 +54,6 @@ export interface DropboxCreateTokensParams {
export declare namespace Dropbox {
export {
type DropboxCreateTokensResponse as DropboxCreateTokensResponse,
- type DropboxCreateTokensParams as DropboxCreateTokensParams,
+ type DropboxCreateTokensParams as DropboxCreateTokensParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/oauth2/index.ts b/src/resources/agents/evaluation-metrics/oauth2/index.ts
index 01e94cc2..411ee4e8 100644
--- a/src/resources/agents/evaluation-metrics/oauth2/index.ts
+++ b/src/resources/agents/evaluation-metrics/oauth2/index.ts
@@ -1,4 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export { Dropbox, type DropboxCreateTokensResponse, type DropboxCreateTokensParams } from './dropbox';
-export { Oauth2, type Oauth2GenerateURLResponse, type Oauth2GenerateURLParams } from './oauth2';
+export { Dropbox, type DropboxCreateTokensResponse, type DropboxCreateTokensParams } from './dropbox';;
+export { Oauth2, type Oauth2GenerateURLResponse, type Oauth2GenerateURLParams } from './oauth2';;
diff --git a/src/resources/agents/evaluation-metrics/oauth2/oauth2.ts b/src/resources/agents/evaluation-metrics/oauth2/oauth2.ts
index a27cd165..292b9054 100644
--- a/src/resources/agents/evaluation-metrics/oauth2/oauth2.ts
+++ b/src/resources/agents/evaluation-metrics/oauth2/oauth2.ts
@@ -6,6 +6,9 @@ import { Dropbox, DropboxCreateTokensParams, DropboxCreateTokensResponse } from
import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Oauth2 extends APIResource {
dropbox: DropboxAPI.Dropbox = new DropboxAPI.Dropbox(this._client);
@@ -19,15 +22,8 @@ export class Oauth2 extends APIResource {
* await client.agents.evaluationMetrics.oauth2.generateURL();
* ```
*/
- generateURL(
- query: Oauth2GenerateURLParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get('/v2/gen-ai/oauth2/url', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ generateURL(query: Oauth2GenerateURLParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get('/v2/gen-ai/oauth2/url', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -58,12 +54,12 @@ Oauth2.Dropbox = Dropbox;
export declare namespace Oauth2 {
export {
type Oauth2GenerateURLResponse as Oauth2GenerateURLResponse,
- type Oauth2GenerateURLParams as Oauth2GenerateURLParams,
+ type Oauth2GenerateURLParams as Oauth2GenerateURLParams
};
export {
Dropbox as Dropbox,
type DropboxCreateTokensResponse as DropboxCreateTokensResponse,
- type DropboxCreateTokensParams as DropboxCreateTokensParams,
+ type DropboxCreateTokensParams as DropboxCreateTokensParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/openai/index.ts b/src/resources/agents/evaluation-metrics/openai/index.ts
index 86bab9a1..716e6089 100644
--- a/src/resources/agents/evaluation-metrics/openai/index.ts
+++ b/src/resources/agents/evaluation-metrics/openai/index.ts
@@ -1,16 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export {
- Keys,
- type KeyCreateResponse,
- type KeyRetrieveResponse,
- type KeyUpdateResponse,
- type KeyListResponse,
- type KeyDeleteResponse,
- type KeyListAgentsResponse,
- type KeyCreateParams,
- type KeyUpdateParams,
- type KeyListParams,
- type KeyListAgentsParams,
-} from './keys';
-export { OpenAI } from './openai';
+export { Keys, type KeyCreateResponse, type KeyRetrieveResponse, type KeyUpdateResponse, type KeyListResponse, type KeyDeleteResponse, type KeyListAgentsResponse, type KeyCreateParams, type KeyUpdateParams, type KeyListParams, type KeyListAgentsParams } from './keys';;
+export { OpenAI } from './openai';;
diff --git a/src/resources/agents/evaluation-metrics/openai/keys.ts b/src/resources/agents/evaluation-metrics/openai/keys.ts
index fabb9428..0c3c1489 100644
--- a/src/resources/agents/evaluation-metrics/openai/keys.ts
+++ b/src/resources/agents/evaluation-metrics/openai/keys.ts
@@ -7,6 +7,9 @@ import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
import { path } from '../../../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Keys extends APIResource {
/**
* To create an OpenAI API key, send a POST request to `/v2/gen-ai/openai/keys`.
@@ -17,15 +20,8 @@ export class Keys extends APIResource {
* await client.agents.evaluationMetrics.openai.keys.create();
* ```
*/
- create(
- body: KeyCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/openai/keys', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: KeyCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/openai/keys', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -41,10 +37,7 @@ export class Keys extends APIResource {
* ```
*/
retrieve(apiKeyUuid: string, options?: RequestOptions): APIPromise {
- return this._client.get(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -59,16 +52,8 @@ export class Keys extends APIResource {
* );
* ```
*/
- update(
- apiKeyUuid: string,
- body: KeyUpdateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(apiKeyUuid: string, body: KeyUpdateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -81,11 +66,7 @@ export class Keys extends APIResource {
* ```
*/
list(query: KeyListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
- return this._client.get('/v2/gen-ai/openai/keys', {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get('/v2/gen-ai/openai/keys', { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -101,10 +82,7 @@ export class Keys extends APIResource {
* ```
*/
delete(apiKeyUuid: string, options?: RequestOptions): APIPromise {
- return this._client.delete(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.delete(path`/v2/gen-ai/openai/keys/${apiKeyUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -118,16 +96,8 @@ export class Keys extends APIResource {
* );
* ```
*/
- listAgents(
- uuid: string,
- query: KeyListAgentsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/openai/keys/${uuid}/agents`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ listAgents(uuid: string, query: KeyListAgentsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/openai/keys/${uuid}/agents`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -227,7 +197,7 @@ export interface KeyUpdateParams {
/**
* API key ID
*/
- body_api_key_uuid?: string;
+ api_key_uuid?: string;
/**
* Name of the key
@@ -270,6 +240,6 @@ export declare namespace Keys {
type KeyCreateParams as KeyCreateParams,
type KeyUpdateParams as KeyUpdateParams,
type KeyListParams as KeyListParams,
- type KeyListAgentsParams as KeyListAgentsParams,
+ type KeyListAgentsParams as KeyListAgentsParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/openai/openai.ts b/src/resources/agents/evaluation-metrics/openai/openai.ts
index b05622b8..e965012b 100644
--- a/src/resources/agents/evaluation-metrics/openai/openai.ts
+++ b/src/resources/agents/evaluation-metrics/openai/openai.ts
@@ -2,19 +2,7 @@
import { APIResource } from '../../../../core/resource';
import * as KeysAPI from './keys';
-import {
- KeyCreateParams,
- KeyCreateResponse,
- KeyDeleteResponse,
- KeyListAgentsParams,
- KeyListAgentsResponse,
- KeyListParams,
- KeyListResponse,
- KeyRetrieveResponse,
- KeyUpdateParams,
- KeyUpdateResponse,
- Keys,
-} from './keys';
+import { KeyCreateParams, KeyCreateResponse, KeyDeleteResponse, KeyListAgentsParams, KeyListAgentsResponse, KeyListParams, KeyListResponse, KeyRetrieveResponse, KeyUpdateParams, KeyUpdateResponse, Keys } from './keys';
export class OpenAI extends APIResource {
keys: KeysAPI.Keys = new KeysAPI.Keys(this._client);
@@ -34,6 +22,6 @@ export declare namespace OpenAI {
type KeyCreateParams as KeyCreateParams,
type KeyUpdateParams as KeyUpdateParams,
type KeyListParams as KeyListParams,
- type KeyListAgentsParams as KeyListAgentsParams,
+ type KeyListAgentsParams as KeyListAgentsParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/scheduled-indexing.ts b/src/resources/agents/evaluation-metrics/scheduled-indexing.ts
new file mode 100644
index 00000000..7edbbabf
--- /dev/null
+++ b/src/resources/agents/evaluation-metrics/scheduled-indexing.ts
@@ -0,0 +1,279 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../../../core/resource';
+import { APIPromise } from '../../../core/api-promise';
+import { RequestOptions } from '../../../internal/request-options';
+import { path } from '../../../internal/utils/path';
+
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
+export class ScheduledIndexing extends APIResource {
+ /**
+ * To create scheduled indexing for a knowledge base, send a POST request to
+ * `/v2/gen-ai/scheduled-indexing`.
+ *
+ * @example
+ * ```ts
+ * const scheduledIndexing =
+ * await client.agents.evaluationMetrics.scheduledIndexing.create();
+ * ```
+ */
+ create(body: ScheduledIndexingCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/scheduled-indexing', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
+ }
+
+ /**
+ * Get Scheduled Indexing for knowledge base using knoweldge base uuid, send a GET
+ * request to `/v2/gen-ai/scheduled-indexing/knowledge-base/{knowledge_base_uuid}`.
+ *
+ * @example
+ * ```ts
+ * const scheduledIndexing =
+ * await client.agents.evaluationMetrics.scheduledIndexing.retrieve(
+ * '"123e4567-e89b-12d3-a456-426614174000"',
+ * );
+ * ```
+ */
+ retrieve(knowledgeBaseUuid: string, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/scheduled-indexing/knowledge-base/${knowledgeBaseUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
+ }
+
+ /**
+ * Delete Scheduled Indexing for knowledge base, send a DELETE request to
+ * `/v2/gen-ai/scheduled-indexing/{uuid}`.
+ *
+ * @example
+ * ```ts
+ * const scheduledIndexing =
+ * await client.agents.evaluationMetrics.scheduledIndexing.delete(
+ * '"123e4567-e89b-12d3-a456-426614174000"',
+ * );
+ * ```
+ */
+ delete(uuid: string, options?: RequestOptions): APIPromise {
+ return this._client.delete(path`/v2/gen-ai/scheduled-indexing/${uuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
+ }
+}
+
+export interface ScheduledIndexingCreateResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ indexing_info?: ScheduledIndexingCreateResponse.IndexingInfo;
+}
+
+export namespace ScheduledIndexingCreateResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ export interface IndexingInfo {
+ /**
+ * Created at timestamp
+ */
+ created_at?: string;
+
+ /**
+ * Days for execution (day is represented same as in a cron expression, e.g. Monday
+ * begins with 1 )
+ */
+ days?: Array;
+
+ /**
+ * Deleted at timestamp (if soft deleted)
+ */
+ deleted_at?: string;
+
+ /**
+ * Whether the schedule is currently active
+ */
+ is_active?: boolean;
+
+ /**
+ * Knowledge base uuid associated with this schedule
+ */
+ knowledge_base_uuid?: string;
+
+ /**
+ * Last time the schedule was executed
+ */
+ last_ran_at?: string;
+
+ /**
+ * Next scheduled run
+ */
+ next_run_at?: string;
+
+ /**
+ * Scheduled time of execution (HH:MM:SS format)
+ */
+ time?: string;
+
+ /**
+ * Updated at timestamp
+ */
+ updated_at?: string;
+
+ /**
+ * Unique identifier for the scheduled indexing entry
+ */
+ uuid?: string;
+ }
+}
+
+export interface ScheduledIndexingRetrieveResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ indexing_info?: ScheduledIndexingRetrieveResponse.IndexingInfo;
+}
+
+export namespace ScheduledIndexingRetrieveResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ export interface IndexingInfo {
+ /**
+ * Created at timestamp
+ */
+ created_at?: string;
+
+ /**
+ * Days for execution (day is represented same as in a cron expression, e.g. Monday
+ * begins with 1 )
+ */
+ days?: Array;
+
+ /**
+ * Deleted at timestamp (if soft deleted)
+ */
+ deleted_at?: string;
+
+ /**
+ * Whether the schedule is currently active
+ */
+ is_active?: boolean;
+
+ /**
+ * Knowledge base uuid associated with this schedule
+ */
+ knowledge_base_uuid?: string;
+
+ /**
+ * Last time the schedule was executed
+ */
+ last_ran_at?: string;
+
+ /**
+ * Next scheduled run
+ */
+ next_run_at?: string;
+
+ /**
+ * Scheduled time of execution (HH:MM:SS format)
+ */
+ time?: string;
+
+ /**
+ * Updated at timestamp
+ */
+ updated_at?: string;
+
+ /**
+ * Unique identifier for the scheduled indexing entry
+ */
+ uuid?: string;
+ }
+}
+
+export interface ScheduledIndexingDeleteResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ indexing_info?: ScheduledIndexingDeleteResponse.IndexingInfo;
+}
+
+export namespace ScheduledIndexingDeleteResponse {
+ /**
+ * Metadata for scheduled indexing entries
+ */
+ export interface IndexingInfo {
+ /**
+ * Created at timestamp
+ */
+ created_at?: string;
+
+ /**
+ * Days for execution (day is represented same as in a cron expression, e.g. Monday
+ * begins with 1 )
+ */
+ days?: Array;
+
+ /**
+ * Deleted at timestamp (if soft deleted)
+ */
+ deleted_at?: string;
+
+ /**
+ * Whether the schedule is currently active
+ */
+ is_active?: boolean;
+
+ /**
+ * Knowledge base uuid associated with this schedule
+ */
+ knowledge_base_uuid?: string;
+
+ /**
+ * Last time the schedule was executed
+ */
+ last_ran_at?: string;
+
+ /**
+ * Next scheduled run
+ */
+ next_run_at?: string;
+
+ /**
+ * Scheduled time of execution (HH:MM:SS format)
+ */
+ time?: string;
+
+ /**
+ * Updated at timestamp
+ */
+ updated_at?: string;
+
+ /**
+ * Unique identifier for the scheduled indexing entry
+ */
+ uuid?: string;
+ }
+}
+
+export interface ScheduledIndexingCreateParams {
+ /**
+ * Days for execution (day is represented same as in a cron expression, e.g. Monday
+ * begins with 1 )
+ */
+ days?: Array;
+
+ /**
+ * Knowledge base uuid for which the schedule is created
+ */
+ knowledge_base_uuid?: string;
+
+ /**
+ * Time of execution (HH:MM) UTC
+ */
+ time?: string;
+}
+
+export declare namespace ScheduledIndexing {
+ export {
+ type ScheduledIndexingCreateResponse as ScheduledIndexingCreateResponse,
+ type ScheduledIndexingRetrieveResponse as ScheduledIndexingRetrieveResponse,
+ type ScheduledIndexingDeleteResponse as ScheduledIndexingDeleteResponse,
+ type ScheduledIndexingCreateParams as ScheduledIndexingCreateParams
+ };
+}
diff --git a/src/resources/agents/evaluation-metrics/workspaces/agents.ts b/src/resources/agents/evaluation-metrics/workspaces/agents.ts
index b31c2e70..840bfa68 100644
--- a/src/resources/agents/evaluation-metrics/workspaces/agents.ts
+++ b/src/resources/agents/evaluation-metrics/workspaces/agents.ts
@@ -7,6 +7,9 @@ import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
import { path } from '../../../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Agents extends APIResource {
/**
* To list all agents by a Workspace, send a GET request to
@@ -20,16 +23,8 @@ export class Agents extends APIResource {
* );
* ```
*/
- list(
- workspaceUuid: string,
- query: AgentListParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}/agents`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ list(workspaceUuid: string, query: AgentListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}/agents`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -44,16 +39,8 @@ export class Agents extends APIResource {
* );
* ```
*/
- move(
- workspaceUuid: string,
- body: AgentMoveParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/workspaces/${workspaceUuid}/agents`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ move(workspaceUuid: string, body: AgentMoveParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/workspaces/${workspaceUuid}/agents`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -101,7 +88,7 @@ export interface AgentMoveParams {
/**
* Workspace uuid to move agents to
*/
- body_workspace_uuid?: string;
+ workspace_uuid?: string;
}
export declare namespace Agents {
@@ -109,6 +96,6 @@ export declare namespace Agents {
type AgentListResponse as AgentListResponse,
type AgentMoveResponse as AgentMoveResponse,
type AgentListParams as AgentListParams,
- type AgentMoveParams as AgentMoveParams,
+ type AgentMoveParams as AgentMoveParams
};
}
diff --git a/src/resources/agents/evaluation-metrics/workspaces/index.ts b/src/resources/agents/evaluation-metrics/workspaces/index.ts
index 1fafa844..ee9944b0 100644
--- a/src/resources/agents/evaluation-metrics/workspaces/index.ts
+++ b/src/resources/agents/evaluation-metrics/workspaces/index.ts
@@ -1,20 +1,4 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export {
- Agents,
- type AgentListResponse,
- type AgentMoveResponse,
- type AgentListParams,
- type AgentMoveParams,
-} from './agents';
-export {
- Workspaces,
- type WorkspaceCreateResponse,
- type WorkspaceRetrieveResponse,
- type WorkspaceUpdateResponse,
- type WorkspaceListResponse,
- type WorkspaceDeleteResponse,
- type WorkspaceListEvaluationTestCasesResponse,
- type WorkspaceCreateParams,
- type WorkspaceUpdateParams,
-} from './workspaces';
+export { Agents, type AgentListResponse, type AgentMoveResponse, type AgentListParams, type AgentMoveParams } from './agents';;
+export { Workspaces, type WorkspaceCreateResponse, type WorkspaceRetrieveResponse, type WorkspaceUpdateResponse, type WorkspaceListResponse, type WorkspaceDeleteResponse, type WorkspaceListEvaluationTestCasesResponse, type WorkspaceCreateParams, type WorkspaceUpdateParams } from './workspaces';;
diff --git a/src/resources/agents/evaluation-metrics/workspaces/workspaces.ts b/src/resources/agents/evaluation-metrics/workspaces/workspaces.ts
index 74475cbd..17c8c740 100644
--- a/src/resources/agents/evaluation-metrics/workspaces/workspaces.ts
+++ b/src/resources/agents/evaluation-metrics/workspaces/workspaces.ts
@@ -9,6 +9,9 @@ import { APIPromise } from '../../../../core/api-promise';
import { RequestOptions } from '../../../../internal/request-options';
import { path } from '../../../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Workspaces extends APIResource {
agents: WorkspacesAgentsAPI.Agents = new WorkspacesAgentsAPI.Agents(this._client);
@@ -22,15 +25,8 @@ export class Workspaces extends APIResource {
* await client.agents.evaluationMetrics.workspaces.create();
* ```
*/
- create(
- body: WorkspaceCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/workspaces', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: WorkspaceCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/workspaces', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -47,10 +43,7 @@ export class Workspaces extends APIResource {
* ```
*/
retrieve(workspaceUuid: string, options?: RequestOptions): APIPromise {
- return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -66,16 +59,8 @@ export class Workspaces extends APIResource {
* );
* ```
*/
- update(
- workspaceUuid: string,
- body: WorkspaceUpdateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/workspaces/${workspaceUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(workspaceUuid: string, body: WorkspaceUpdateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/workspaces/${workspaceUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -88,10 +73,7 @@ export class Workspaces extends APIResource {
* ```
*/
list(options?: RequestOptions): APIPromise {
- return this._client.get('/v2/gen-ai/workspaces', {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get('/v2/gen-ai/workspaces', { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -107,10 +89,7 @@ export class Workspaces extends APIResource {
* ```
*/
delete(workspaceUuid: string, options?: RequestOptions): APIPromise {
- return this._client.delete(path`/v2/gen-ai/workspaces/${workspaceUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.delete(path`/v2/gen-ai/workspaces/${workspaceUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -125,14 +104,8 @@ export class Workspaces extends APIResource {
* );
* ```
*/
- listEvaluationTestCases(
- workspaceUuid: string,
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}/evaluation_test_cases`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ listEvaluationTestCases(workspaceUuid: string, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/workspaces/${workspaceUuid}/evaluation_test_cases`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -197,7 +170,7 @@ export interface WorkspaceUpdateParams {
/**
* Workspace UUID.
*/
- body_workspace_uuid?: string;
+ workspace_uuid?: string;
}
Workspaces.Agents = Agents;
@@ -211,7 +184,7 @@ export declare namespace Workspaces {
type WorkspaceDeleteResponse as WorkspaceDeleteResponse,
type WorkspaceListEvaluationTestCasesResponse as WorkspaceListEvaluationTestCasesResponse,
type WorkspaceCreateParams as WorkspaceCreateParams,
- type WorkspaceUpdateParams as WorkspaceUpdateParams,
+ type WorkspaceUpdateParams as WorkspaceUpdateParams
};
export {
@@ -219,6 +192,6 @@ export declare namespace Workspaces {
type AgentListResponse as AgentListResponse,
type AgentMoveResponse as AgentMoveResponse,
type AgentListParams as AgentListParams,
- type AgentMoveParams as AgentMoveParams,
+ type AgentMoveParams as AgentMoveParams
};
}
diff --git a/src/resources/agents/evaluation-runs.ts b/src/resources/agents/evaluation-runs.ts
index 76b773c5..d79fc445 100644
--- a/src/resources/agents/evaluation-runs.ts
+++ b/src/resources/agents/evaluation-runs.ts
@@ -1,11 +1,15 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
+import * as EvaluationRunsAPI from './evaluation-runs';
import * as Shared from '../shared';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class EvaluationRuns extends APIResource {
/**
* To run an evaluation test case, send a POST request to
@@ -17,15 +21,8 @@ export class EvaluationRuns extends APIResource {
* await client.agents.evaluationRuns.create();
* ```
*/
- create(
- body: EvaluationRunCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/evaluation_runs', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: EvaluationRunCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/evaluation_runs', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -41,10 +38,7 @@ export class EvaluationRuns extends APIResource {
* ```
*/
retrieve(evaluationRunUuid: string, options?: RequestOptions): APIPromise {
- return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluationRunUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluationRunUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -59,16 +53,8 @@ export class EvaluationRuns extends APIResource {
* );
* ```
*/
- listResults(
- evaluationRunUuid: string,
- query: EvaluationRunListResultsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluationRunUuid}/results`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ listResults(evaluationRunUuid: string, query: EvaluationRunListResultsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluationRunUuid}/results`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -84,20 +70,15 @@ export class EvaluationRuns extends APIResource {
* });
* ```
*/
- retrieveResults(
- promptID: number,
- params: EvaluationRunRetrieveResultsParams,
- options?: RequestOptions,
- ): APIPromise {
- const { evaluation_run_uuid } = params;
- return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluation_run_uuid}/results/${promptID}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ retrieveResults(promptID: number, params: EvaluationRunRetrieveResultsParams, options?: RequestOptions): APIPromise {
+ const { evaluation_run_uuid } = params
+ return this._client.get(path`/v2/gen-ai/evaluation_runs/${evaluation_run_uuid}/results/${promptID}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
export interface APIEvaluationMetric {
+ category?: 'METRIC_CATEGORY_UNSPECIFIED' | 'METRIC_CATEGORY_CORRECTNESS' | 'METRIC_CATEGORY_USER_OUTCOMES' | 'METRIC_CATEGORY_SAFETY_AND_SECURITY' | 'METRIC_CATEGORY_CONTEXT_QUALITY' | 'METRIC_CATEGORY_MODEL_FIT';
+
description?: string;
/**
@@ -105,17 +86,17 @@ export interface APIEvaluationMetric {
*/
inverted?: boolean;
+ is_metric_goal?: boolean;
+
metric_name?: string;
+ metric_rank?: number;
+
metric_type?: 'METRIC_TYPE_UNSPECIFIED' | 'METRIC_TYPE_GENERAL_QUALITY' | 'METRIC_TYPE_RAG_AND_TOOL';
metric_uuid?: string;
- metric_value_type?:
- | 'METRIC_VALUE_TYPE_UNSPECIFIED'
- | 'METRIC_VALUE_TYPE_NUMBER'
- | 'METRIC_VALUE_TYPE_STRING'
- | 'METRIC_VALUE_TYPE_PERCENTAGE';
+ metric_value_type?: 'METRIC_VALUE_TYPE_UNSPECIFIED' | 'METRIC_VALUE_TYPE_NUMBER' | 'METRIC_VALUE_TYPE_STRING' | 'METRIC_VALUE_TYPE_PERCENTAGE';
/**
* The maximum value for the metric.
@@ -139,11 +120,7 @@ export interface APIEvaluationMetricResult {
*/
metric_name?: string;
- metric_value_type?:
- | 'METRIC_VALUE_TYPE_UNSPECIFIED'
- | 'METRIC_VALUE_TYPE_NUMBER'
- | 'METRIC_VALUE_TYPE_STRING'
- | 'METRIC_VALUE_TYPE_PERCENTAGE';
+ metric_value_type?: 'METRIC_VALUE_TYPE_UNSPECIFIED' | 'METRIC_VALUE_TYPE_NUMBER' | 'METRIC_VALUE_TYPE_STRING' | 'METRIC_VALUE_TYPE_PERCENTAGE';
/**
* The value of the metric as a number.
@@ -162,6 +139,11 @@ export interface APIEvaluationMetricResult {
}
export interface APIEvaluationPrompt {
+ /**
+ * The evaluated trace spans.
+ */
+ evaluation_trace_spans?: Array;
+
/**
* The ground truth for the prompt.
*/
@@ -195,9 +177,84 @@ export interface APIEvaluationPrompt {
* The metric results for the prompt.
*/
prompt_level_metric_results?: Array;
+
+ /**
+ * The trace id for the prompt.
+ */
+ trace_id?: string;
}
export namespace APIEvaluationPrompt {
+ /**
+ * Represents a span within an evaluatioin trace (e.g., LLM call, tool call, etc.)
+ */
+ export interface EvaluationTraceSpan {
+ /**
+ * When the span was created
+ */
+ created_at?: string;
+
+ /**
+ * Input data for the span (flexible structure - can be messages array, string,
+ * etc.)
+ */
+ input?: unknown;
+
+ /**
+ * Name/identifier for the span
+ */
+ name?: string;
+
+ /**
+ * Output data from the span (flexible structure - can be message, string, etc.)
+ */
+ output?: unknown;
+
+ /**
+ * Any retriever span chunks that were included as part of the span.
+ */
+ retriever_chunks?: Array;
+
+ /**
+ * The span-level metric results.
+ */
+ span_level_metric_results?: Array;
+
+ /**
+ * Types of spans in a trace
+ */
+ type?: 'TRACE_SPAN_TYPE_UNKNOWN' | 'TRACE_SPAN_TYPE_LLM' | 'TRACE_SPAN_TYPE_RETRIEVER' | 'TRACE_SPAN_TYPE_TOOL';
+ }
+
+ export namespace EvaluationTraceSpan {
+ export interface RetrieverChunk {
+ /**
+ * The usage percentage of the chunk.
+ */
+ chunk_usage_pct?: number;
+
+ /**
+ * Indicates if the chunk was used in the prompt.
+ */
+ chunk_used?: boolean;
+
+ /**
+ * The index uuid (Knowledge Base) of the chunk.
+ */
+ index_uuid?: string;
+
+ /**
+ * The source name for the chunk, e.g., the file name or document title.
+ */
+ source_name?: string;
+
+ /**
+ * Text content of the chunk.
+ */
+ text?: string;
+ }
+ }
+
export interface PromptChunk {
/**
* The usage percentage of the chunk.
@@ -232,6 +289,11 @@ export interface APIEvaluationRun {
*/
agent_deleted?: boolean;
+ /**
+ * The agent deployment name
+ */
+ agent_deployment_name?: string;
+
/**
* Agent name
*/
@@ -303,16 +365,7 @@ export interface APIEvaluationRun {
/**
* Evaluation Run Statuses
*/
- status?:
- | 'EVALUATION_RUN_STATUS_UNSPECIFIED'
- | 'EVALUATION_RUN_QUEUED'
- | 'EVALUATION_RUN_RUNNING_DATASET'
- | 'EVALUATION_RUN_EVALUATING_RESULTS'
- | 'EVALUATION_RUN_CANCELLING'
- | 'EVALUATION_RUN_CANCELLED'
- | 'EVALUATION_RUN_SUCCESSFUL'
- | 'EVALUATION_RUN_PARTIALLY_SUCCESSFUL'
- | 'EVALUATION_RUN_FAILED';
+ status?: 'EVALUATION_RUN_STATUS_UNSPECIFIED' | 'EVALUATION_RUN_QUEUED' | 'EVALUATION_RUN_RUNNING_DATASET' | 'EVALUATION_RUN_EVALUATING_RESULTS' | 'EVALUATION_RUN_CANCELLING' | 'EVALUATION_RUN_CANCELLED' | 'EVALUATION_RUN_SUCCESSFUL' | 'EVALUATION_RUN_PARTIALLY_SUCCESSFUL' | 'EVALUATION_RUN_FAILED';
/**
* Test case description.
@@ -371,7 +424,12 @@ export interface EvaluationRunRetrieveResultsResponse {
export interface EvaluationRunCreateParams {
/**
- * Agent UUIDs to run the test case against.
+ * Agent deployment names to run the test case against (ADK agent workspaces).
+ */
+ agent_deployment_names?: Array;
+
+ /**
+ * Agent UUIDs to run the test case against (legacy agents).
*/
agent_uuids?: Array;
@@ -417,6 +475,6 @@ export declare namespace EvaluationRuns {
type EvaluationRunRetrieveResultsResponse as EvaluationRunRetrieveResultsResponse,
type EvaluationRunCreateParams as EvaluationRunCreateParams,
type EvaluationRunListResultsParams as EvaluationRunListResultsParams,
- type EvaluationRunRetrieveResultsParams as EvaluationRunRetrieveResultsParams,
+ type EvaluationRunRetrieveResultsParams as EvaluationRunRetrieveResultsParams
};
}
diff --git a/src/resources/agents/evaluation-test-cases.ts b/src/resources/agents/evaluation-test-cases.ts
index 87be4c49..cdf0eb99 100644
--- a/src/resources/agents/evaluation-test-cases.ts
+++ b/src/resources/agents/evaluation-test-cases.ts
@@ -6,6 +6,9 @@ import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class EvaluationTestCases extends APIResource {
/**
* To create an evaluation test-case send a POST request to
@@ -17,15 +20,8 @@ export class EvaluationTestCases extends APIResource {
* await client.agents.evaluationTestCases.create();
* ```
*/
- create(
- body: EvaluationTestCaseCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post('/v2/gen-ai/evaluation_test_cases', {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(body: EvaluationTestCaseCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post('/v2/gen-ai/evaluation_test_cases', { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -40,16 +36,8 @@ export class EvaluationTestCases extends APIResource {
* );
* ```
*/
- retrieve(
- testCaseUuid: string,
- query: EvaluationTestCaseRetrieveParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, {
- query,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ retrieve(testCaseUuid: string, query: EvaluationTestCaseRetrieveParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -64,16 +52,8 @@ export class EvaluationTestCases extends APIResource {
* );
* ```
*/
- update(
- testCaseUuid: string,
- body: EvaluationTestCaseUpdateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.put(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(testCaseUuid: string, body: EvaluationTestCaseUpdateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.put(path`/v2/gen-ai/evaluation_test_cases/${testCaseUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -87,10 +67,7 @@ export class EvaluationTestCases extends APIResource {
* ```
*/
list(options?: RequestOptions): APIPromise {
- return this._client.get('/v2/gen-ai/evaluation_test_cases', {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.get('/v2/gen-ai/evaluation_test_cases', { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -105,15 +82,8 @@ export class EvaluationTestCases extends APIResource {
* );
* ```
*/
- listEvaluationRuns(
- evaluationTestCaseUuid: string,
- query: EvaluationTestCaseListEvaluationRunsParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.get(
- path`/v2/gen-ai/evaluation_test_cases/${evaluationTestCaseUuid}/evaluation_runs`,
- { query, defaultBaseURL: 'https://api.digitalocean.com', ...options },
- );
+ listEvaluationRuns(evaluationTestCaseUuid: string, query: EvaluationTestCaseListEvaluationRunsParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.get(path`/v2/gen-ai/evaluation_test_cases/${evaluationTestCaseUuid}/evaluation_runs`, { query, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -243,6 +213,8 @@ export interface EvaluationTestCaseListEvaluationRunsResponse {
}
export interface EvaluationTestCaseCreateParams {
+ agent_workspace_name?: string;
+
/**
* Dataset against which the test‑case is executed.
*/
@@ -301,7 +273,7 @@ export interface EvaluationTestCaseUpdateParams {
/**
* Test-case UUID to update
*/
- body_test_case_uuid?: string;
+ test_case_uuid?: string;
}
export namespace EvaluationTestCaseUpdateParams {
@@ -329,6 +301,6 @@ export declare namespace EvaluationTestCases {
type EvaluationTestCaseCreateParams as EvaluationTestCaseCreateParams,
type EvaluationTestCaseRetrieveParams as EvaluationTestCaseRetrieveParams,
type EvaluationTestCaseUpdateParams as EvaluationTestCaseUpdateParams,
- type EvaluationTestCaseListEvaluationRunsParams as EvaluationTestCaseListEvaluationRunsParams,
+ type EvaluationTestCaseListEvaluationRunsParams as EvaluationTestCaseListEvaluationRunsParams
};
}
diff --git a/src/resources/agents/functions.ts b/src/resources/agents/functions.ts
index bdc8f84d..1d23a492 100644
--- a/src/resources/agents/functions.ts
+++ b/src/resources/agents/functions.ts
@@ -6,6 +6,9 @@ import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class Functions extends APIResource {
/**
* To create a function route for an agent, send a POST request to
@@ -18,16 +21,8 @@ export class Functions extends APIResource {
* );
* ```
*/
- create(
- agentUuid: string,
- body: FunctionCreateParams | null | undefined = {},
- options?: RequestOptions,
- ): APIPromise {
- return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/functions`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ create(agentUuid: string, body: FunctionCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise {
+ return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/functions`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -45,17 +40,9 @@ export class Functions extends APIResource {
* );
* ```
*/
- update(
- functionUuid: string,
- params: FunctionUpdateParams,
- options?: RequestOptions,
- ): APIPromise {
- const { path_agent_uuid, ...body } = params;
- return this._client.put(path`/v2/gen-ai/agents/${path_agent_uuid}/functions/${functionUuid}`, {
- body,
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ update(functionUuid: string, params: FunctionUpdateParams, options?: RequestOptions): APIPromise {
+ const { path_agent_uuid, ...body } = params
+ return this._client.put(path`/v2/gen-ai/agents/${path_agent_uuid}/functions/${functionUuid}`, { body, defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -70,16 +57,9 @@ export class Functions extends APIResource {
* );
* ```
*/
- delete(
- functionUuid: string,
- params: FunctionDeleteParams,
- options?: RequestOptions,
- ): APIPromise {
- const { agent_uuid } = params;
- return this._client.delete(path`/v2/gen-ai/agents/${agent_uuid}/functions/${functionUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ delete(functionUuid: string, params: FunctionDeleteParams, options?: RequestOptions): APIPromise {
+ const { agent_uuid } = params
+ return this._client.delete(path`/v2/gen-ai/agents/${agent_uuid}/functions/${functionUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
}
@@ -117,7 +97,7 @@ export interface FunctionCreateParams {
/**
* Agent id
*/
- body_agent_uuid?: string;
+ agent_uuid?: string;
/**
* Function description
@@ -184,7 +164,7 @@ export interface FunctionUpdateParams {
/**
* Body param: Function id
*/
- body_function_uuid?: string;
+ function_uuid?: string;
/**
* Body param: Describe the input schema for the function so the agent may call it
@@ -212,6 +192,6 @@ export declare namespace Functions {
type FunctionDeleteResponse as FunctionDeleteResponse,
type FunctionCreateParams as FunctionCreateParams,
type FunctionUpdateParams as FunctionUpdateParams,
- type FunctionDeleteParams as FunctionDeleteParams,
+ type FunctionDeleteParams as FunctionDeleteParams
};
}
diff --git a/src/resources/agents/index.ts b/src/resources/agents/index.ts
index 862f9855..a7a4e9b9 100644
--- a/src/resources/agents/index.ts
+++ b/src/resources/agents/index.ts
@@ -1,113 +1,13 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-export {
- APIKeys,
- type APIKeyCreateResponse,
- type APIKeyUpdateResponse,
- type APIKeyListResponse,
- type APIKeyDeleteResponse,
- type APIKeyRegenerateResponse,
- type APIKeyCreateParams,
- type APIKeyUpdateParams,
- type APIKeyListParams,
- type APIKeyDeleteParams,
- type APIKeyRegenerateParams,
-} from './api-keys';
-export {
- Agents,
- type APIAgent,
- type APIAgentAPIKeyInfo,
- type APIAgentModel,
- type APIAnthropicAPIKeyInfo,
- type APIDeploymentVisibility,
- type APIOpenAIAPIKeyInfo,
- type APIRetrievalMethod,
- type APIWorkspace,
- type AgentCreateResponse,
- type AgentRetrieveResponse,
- type AgentUpdateResponse,
- type AgentListResponse,
- type AgentDeleteResponse,
- type AgentRetrieveUsageResponse,
- type AgentUpdateStatusResponse,
- type AgentCreateParams,
- type AgentUpdateParams,
- type AgentListParams,
- type AgentRetrieveUsageParams,
- type AgentUpdateStatusParams,
-} from './agents';
-export { Chat } from './chat/index';
-export {
- EvaluationDatasets,
- type EvaluationDatasetCreateResponse,
- type EvaluationDatasetCreateFileUploadPresignedURLsResponse,
- type EvaluationDatasetCreateParams,
- type EvaluationDatasetCreateFileUploadPresignedURLsParams,
-} from './evaluation-datasets';
-export {
- EvaluationMetrics,
- type EvaluationMetricListResponse,
- type EvaluationMetricListRegionsResponse,
- type EvaluationMetricListRegionsParams,
-} from './evaluation-metrics/index';
-export {
- EvaluationRuns,
- type APIEvaluationMetric,
- type APIEvaluationMetricResult,
- type APIEvaluationPrompt,
- type APIEvaluationRun,
- type EvaluationRunCreateResponse,
- type EvaluationRunRetrieveResponse,
- type EvaluationRunListResultsResponse,
- type EvaluationRunRetrieveResultsResponse,
- type EvaluationRunCreateParams,
- type EvaluationRunListResultsParams,
- type EvaluationRunRetrieveResultsParams,
-} from './evaluation-runs';
-export {
- EvaluationTestCases,
- type APIEvaluationTestCase,
- type APIStarMetric,
- type EvaluationTestCaseCreateResponse,
- type EvaluationTestCaseRetrieveResponse,
- type EvaluationTestCaseUpdateResponse,
- type EvaluationTestCaseListResponse,
- type EvaluationTestCaseListEvaluationRunsResponse,
- type EvaluationTestCaseCreateParams,
- type EvaluationTestCaseRetrieveParams,
- type EvaluationTestCaseUpdateParams,
- type EvaluationTestCaseListEvaluationRunsParams,
-} from './evaluation-test-cases';
-export {
- Functions,
- type FunctionCreateResponse,
- type FunctionUpdateResponse,
- type FunctionDeleteResponse,
- type FunctionCreateParams,
- type FunctionUpdateParams,
- type FunctionDeleteParams,
-} from './functions';
-export {
- KnowledgeBases,
- type APILinkKnowledgeBaseOutput,
- type KnowledgeBaseDetachResponse,
- type KnowledgeBaseAttachSingleParams,
- type KnowledgeBaseDetachParams,
-} from './knowledge-bases';
-export {
- Routes,
- type RouteUpdateResponse,
- type RouteDeleteResponse,
- type RouteAddResponse,
- type RouteViewResponse,
- type RouteUpdateParams,
- type RouteDeleteParams,
- type RouteAddParams,
-} from './routes';
-export {
- Versions,
- type VersionUpdateResponse,
- type VersionListResponse,
- type VersionUpdateParams,
- type VersionListParams,
-} from './versions';
+export { APIKeys, type APIKeyCreateResponse, type APIKeyUpdateResponse, type APIKeyListResponse, type APIKeyDeleteResponse, type APIKeyRegenerateResponse, type APIKeyCreateParams, type APIKeyUpdateParams, type APIKeyListParams, type APIKeyDeleteParams, type APIKeyRegenerateParams } from './api-keys';;
+export { Agents, type APIAgent, type APIAgentAPIKeyInfo, type APIAgentModel, type APIAnthropicAPIKeyInfo, type APIDeploymentVisibility, type APIOpenAIAPIKeyInfo, type APIRetrievalMethod, type APIWorkspace, type AgentCreateResponse, type AgentRetrieveResponse, type AgentUpdateResponse, type AgentListResponse, type AgentDeleteResponse, type AgentRetrieveUsageResponse, type AgentUpdateStatusResponse, type AgentCreateParams, type AgentUpdateParams, type AgentListParams, type AgentRetrieveUsageParams, type AgentUpdateStatusParams } from './agents';;
+export { Chat } from './chat/index';;
+export { EvaluationDatasets, type EvaluationDatasetCreateResponse, type EvaluationDatasetCreateFileUploadPresignedURLsResponse, type EvaluationDatasetCreateParams, type EvaluationDatasetCreateFileUploadPresignedURLsParams } from './evaluation-datasets';;
+export { EvaluationMetrics, type EvaluationMetricListResponse, type EvaluationMetricListRegionsResponse, type EvaluationMetricListRegionsParams } from './evaluation-metrics/index';;
+export { EvaluationRuns, type APIEvaluationMetric, type APIEvaluationMetricResult, type APIEvaluationPrompt, type APIEvaluationRun, type EvaluationRunCreateResponse, type EvaluationRunRetrieveResponse, type EvaluationRunListResultsResponse, type EvaluationRunRetrieveResultsResponse, type EvaluationRunCreateParams, type EvaluationRunListResultsParams, type EvaluationRunRetrieveResultsParams } from './evaluation-runs';;
+export { EvaluationTestCases, type APIEvaluationTestCase, type APIStarMetric, type EvaluationTestCaseCreateResponse, type EvaluationTestCaseRetrieveResponse, type EvaluationTestCaseUpdateResponse, type EvaluationTestCaseListResponse, type EvaluationTestCaseListEvaluationRunsResponse, type EvaluationTestCaseCreateParams, type EvaluationTestCaseRetrieveParams, type EvaluationTestCaseUpdateParams, type EvaluationTestCaseListEvaluationRunsParams } from './evaluation-test-cases';;
+export { Functions, type FunctionCreateResponse, type FunctionUpdateResponse, type FunctionDeleteResponse, type FunctionCreateParams, type FunctionUpdateParams, type FunctionDeleteParams } from './functions';;
+export { KnowledgeBases, type APILinkKnowledgeBaseOutput, type KnowledgeBaseDetachResponse, type KnowledgeBaseAttachSingleParams, type KnowledgeBaseDetachParams } from './knowledge-bases';;
+export { Routes, type RouteUpdateResponse, type RouteDeleteResponse, type RouteAddResponse, type RouteViewResponse, type RouteUpdateParams, type RouteDeleteParams, type RouteAddParams } from './routes';;
+export { Versions, type VersionUpdateResponse, type VersionListResponse, type VersionUpdateParams, type VersionListParams } from './versions';;
diff --git a/src/resources/agents/knowledge-bases.ts b/src/resources/agents/knowledge-bases.ts
index 25f9dbc7..10318410 100644
--- a/src/resources/agents/knowledge-bases.ts
+++ b/src/resources/agents/knowledge-bases.ts
@@ -6,6 +6,9 @@ import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The API lets you build GPU-powered AI agents with pre-built or custom foundation models, function and agent routes, and RAG pipelines with knowledge bases.
+ */
export class KnowledgeBases extends APIResource {
/**
* To attach knowledge bases to an agent, send a POST request to
@@ -20,10 +23,7 @@ export class KnowledgeBases extends APIResource {
* ```
*/
attach(agentUuid: string, options?: RequestOptions): APIPromise {
- return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/knowledge_bases`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ return this._client.post(path`/v2/gen-ai/agents/${agentUuid}/knowledge_bases`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -41,16 +41,9 @@ export class KnowledgeBases extends APIResource {
* );
* ```
*/
- attachSingle(
- knowledgeBaseUuid: string,
- params: KnowledgeBaseAttachSingleParams,
- options?: RequestOptions,
- ): APIPromise {
- const { agent_uuid } = params;
- return this._client.post(path`/v2/gen-ai/agents/${agent_uuid}/knowledge_bases/${knowledgeBaseUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ attachSingle(knowledgeBaseUuid: string, params: KnowledgeBaseAttachSingleParams, options?: RequestOptions): APIPromise {
+ const { agent_uuid } = params
+ return this._client.post(path`/v2/gen-ai/agents/${agent_uuid}/knowledge_bases/${knowledgeBaseUuid}`, { defaultBaseURL: 'https://api.digitalocean.com', ...options });
}
/**
@@ -65,16 +58,9 @@ export class KnowledgeBases extends APIResource {
* );
* ```
*/
- detach(
- knowledgeBaseUuid: string,
- params: KnowledgeBaseDetachParams,
- options?: RequestOptions,
- ): APIPromise {
- const { agent_uuid } = params;
- return this._client.delete(path`/v2/gen-ai/agents/${agent_uuid}/knowledge_bases/${knowledgeBaseUuid}`, {
- defaultBaseURL: 'https://api.digitalocean.com',
- ...options,
- });
+ detach(knowledgeBaseUuid: string, params: KnowledgeBaseDetachParams, options?: RequestOptions): APIPromise