diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index cbd6da2..9f2310f 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -19,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.GRADIENT_NPM_TOKEN || secrets.NPM_TOKEN }}
+
diff --git a/.gitignore b/.gitignore
index d98d51a..2412bb7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@ dist
dist-deno
/*.tgz
.idea/
+.eslintcache
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d7a8735..c5e8a3e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.1"
+ ".": "0.1.0-alpha.2"
}
diff --git a/.stats.yml b/.stats.yml
index e30c19b..af483f0 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 173
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-621c3ebf5011c5ca508f78fccbea17de4ca6b35bfe99578c1ae2265021578d6f.yml
-openapi_spec_hash: e29d14e3e4679fcf22b3e760e49931b1
-config_hash: 3d425c415b7f7ab581418b43eb521cb3
+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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f360b9a..2178147 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,36 @@
# Changelog
+## 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)
+
+### Features
+
+* **api:** Images generations ([2b2dc1a](https://github.com/digitalocean/gradient-typescript/commit/2b2dc1ab761524a9a4e80d92f627e0777bc72828))
+* **api:** Images generations - openai ([6c3d87c](https://github.com/digitalocean/gradient-typescript/commit/6c3d87c4587799d95634709e10d05398a5b5efea))
+* **api:** manual updates ([e428407](https://github.com/digitalocean/gradient-typescript/commit/e428407732f68c3958a7a4aefebb16d6fc993ffe))
+* **api:** manual updates ([54e9764](https://github.com/digitalocean/gradient-typescript/commit/54e97647408b0713f2788163c8e62950d0978779))
+
+
+### Performance Improvements
+
+* faster formatting ([8368269](https://github.com/digitalocean/gradient-typescript/commit/83682693c05b0923eda90f309323e79be81f0959))
+
+
+### Chores
+
+* clean up LICENSING after legal review ([#3](https://github.com/digitalocean/gradient-typescript/issues/3)) ([da51ba0](https://github.com/digitalocean/gradient-typescript/commit/da51ba0ea90a8a938747e1f5500fe78e388046c6))
+* do not install brew dependencies in ./scripts/bootstrap by default ([58a58de](https://github.com/digitalocean/gradient-typescript/commit/58a58dee9cef281da36da118e2ac979cd0d755b7))
+* **internal:** codegen related update ([caea2ff](https://github.com/digitalocean/gradient-typescript/commit/caea2ff2b2b44b543ede7b06829fbb5a8d0b2694))
+* **internal:** fix incremental formatting in some cases ([353630a](https://github.com/digitalocean/gradient-typescript/commit/353630aa9fe2b61a4d4fb04b581e628fe9e5fd3f))
+* **internal:** ignore .eslintcache ([49808e2](https://github.com/digitalocean/gradient-typescript/commit/49808e27fd3936c7aaa21c194fc005f7944380b4))
+* **internal:** remove .eslintcache ([b318cc0](https://github.com/digitalocean/gradient-typescript/commit/b318cc0a5b59b443357621de22714cf9e893d4a6))
+* **internal:** remove deprecated `compilerOptions.baseUrl` from tsconfig.json ([3c74bff](https://github.com/digitalocean/gradient-typescript/commit/3c74bff79b6e18426e0bc6cb4e586a5996f4640f))
+* **internal:** use npm pack for build uploads ([2b378fc](https://github.com/digitalocean/gradient-typescript/commit/2b378fc6255fb2753373564871d0e8442b54497b))
+* **jsdoc:** fix [@link](https://github.com/link) annotations to refer only to parts of the package‘s public interface ([ffed53e](https://github.com/digitalocean/gradient-typescript/commit/ffed53e3f10f4cf70ce61c65623fc13298200aa8))
+* update author ([3dd3c2d](https://github.com/digitalocean/gradient-typescript/commit/3dd3c2d23f3896305077104a7793d7702371843b))
+* update github actions ([d678611](https://github.com/digitalocean/gradient-typescript/commit/d6786115dfe34fde95a8317d7f79a8d6aa579a01))
+
## 0.1.0-alpha.1 (2025-09-12)
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/digitalocean/gradient-typescript/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
diff --git a/README.md b/README.md
index 950a8b2..4f92110 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ The full API of this library can be found in [api.md](api.md).
import Gradient from '@digitalocean/gradient';
const client = new Gradient({
- accessToken: process.env['DIGITALOCEAN_ACCESS_TOKEN'], // This is the default and can be omitted
+ modelAccessKey: process.env['GRADIENT_MODEL_ACCESS_KEY'], // This is the default and can be omitted
});
const completion = await client.chat.completions.create({
@@ -65,7 +65,7 @@ This library includes TypeScript definitions for all request params and response
import Gradient from '@digitalocean/gradient';
const client = new Gradient({
- accessToken: process.env['DIGITALOCEAN_ACCESS_TOKEN'], // This is the default and can be omitted
+ modelAccessKey: process.env['GRADIENT_MODEL_ACCESS_KEY'], // This is the default and can be omitted
});
const params: Gradient.Chat.CompletionCreateParams = {
diff --git a/api.md b/api.md
index bc4367a..6cae98b 100644
--- a/api.md
+++ b/api.md
@@ -18,6 +18,9 @@ Types:
- GarbageCollection
- GPUInfo
- Image
+- ImageGenCompletedEvent
+- ImageGenPartialImageEvent
+- ImageGenStreamEvent
- Kernel
- MetaProperties
- NetworkV4
@@ -327,6 +330,16 @@ Methods:
- client.chat.completions.create({ ...params }) -> CompletionCreateResponse
+# Images
+
+Types:
+
+- ImageGenerateResponse
+
+Methods:
+
+- client.images.generate({ ...params }) -> ImageGenerateResponse
+
# GPUDroplets
Types:
@@ -642,6 +655,7 @@ Methods:
Types:
+- SSHKeys
- KeyCreateResponse
- KeyRetrieveResponse
- KeyUpdateResponse
@@ -707,12 +721,14 @@ Types:
- DataSourceCreateResponse
- DataSourceListResponse
- DataSourceDeleteResponse
+- DataSourceCreatePresignedURLsResponse
Methods:
- client.knowledgeBases.dataSources.create(knowledgeBaseUuid, { ...params }) -> DataSourceCreateResponse
- client.knowledgeBases.dataSources.list(knowledgeBaseUuid, { ...params }) -> DataSourceListResponse
- client.knowledgeBases.dataSources.delete(dataSourceUuid, { ...params }) -> DataSourceDeleteResponse
+- client.knowledgeBases.dataSources.createPresignedURLs({ ...params }) -> DataSourceCreatePresignedURLsResponse
## IndexingJobs
diff --git a/package.json b/package.json
index 86e8c0e..14c6dd7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@digitalocean/gradient",
- "version": "0.1.0-alpha.1",
+ "version": "0.1.0-alpha.2",
"description": "The official TypeScript library for the Gradient API",
"author": "DigitalOcean, LLC ",
"types": "dist/index.d.ts",
diff --git a/scripts/bootstrap b/scripts/bootstrap
index 062a034..a8b69ff 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,10 +4,18 @@ set -e
cd "$(dirname "$0")/.."
-if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
- echo "==> Installing Homebrew dependencies…"
- brew bundle
+ echo -n "==> Install Homebrew dependencies? (y/N): "
+ read -r response
+ case "$response" in
+ [yY][eE][sS]|[yY])
+ brew bundle
+ ;;
+ *)
+ ;;
+ esac
+ echo
}
fi
diff --git a/scripts/fast-format b/scripts/fast-format
new file mode 100755
index 0000000..53721ac
--- /dev/null
+++ b/scripts/fast-format
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+echo "Script started with $# arguments"
+echo "Arguments: $*"
+echo "Script location: $(dirname "$0")"
+
+cd "$(dirname "$0")/.."
+echo "Changed to directory: $(pwd)"
+
+if [ $# -eq 0 ]; then
+ echo "Usage: $0 [additional-formatter-args...]"
+ echo "The file should contain one file path per line"
+ exit 1
+fi
+
+FILE_LIST="$1"
+
+echo "Looking for file: $FILE_LIST"
+
+if [ ! -f "$FILE_LIST" ]; then
+ echo "Error: File '$FILE_LIST' not found"
+ exit 1
+fi
+
+echo "==> Running eslint --fix"
+ESLINT_FILES="$(grep '\.ts$' "$FILE_LIST" || true)"
+if ! [ -z "$ESLINT_FILES" ]; then
+ echo "$ESLINT_FILES" | xargs ./node_modules/.bin/eslint --cache --fix
+fi
+
+echo "==> Running prettier --write"
+# format things eslint didn't
+PRETTIER_FILES="$(grep '\.\(js\|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'
+fi
diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh
index ccf70c0..a9cb774 100755
--- a/scripts/utils/upload-artifact.sh
+++ b/scripts/utils/upload-artifact.sh
@@ -12,9 +12,11 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi
-UPLOAD_RESPONSE=$(tar "${BASE_PATH:+-C$BASE_PATH}" -cz "${ARTIFACT_PATH:-dist}" | curl -v -X PUT \
+TARBALL=$(cd dist && npm pack --silent)
+
+UPLOAD_RESPONSE=$(curl -v -X PUT \
-H "Content-Type: application/gzip" \
- --data-binary @- "$SIGNED_URL" 2>&1)
+ --data-binary "@dist/$TARBALL" "$SIGNED_URL" 2>&1)
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
diff --git a/src/client.ts b/src/client.ts
index 24c18a0..903c986 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -17,6 +17,13 @@ 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 { RegionListParams, RegionListResponse, Regions } from './resources/regions';
import {
APIAgent,
@@ -312,18 +319,54 @@ export class Gradient {
return;
}
+ if (this.modelAccessKey && values.get('authorization')) {
+ return;
+ }
+ if (nulls.has('authorization')) {
+ return;
+ }
+
+ if (this.agentAccessKey && values.get('authorization')) {
+ return;
+ }
+ if (nulls.has('authorization')) {
+ return;
+ }
+
throw new Error(
- 'Could not resolve authentication method. Expected the accessToken to be set. Or for the "Authorization" headers to be explicitly omitted',
+ '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),
+ ]);
+ }
+
+ protected async bearerAuth(opts: FinalRequestOptions): Promise {
if (this.accessToken == null) {
return undefined;
}
return buildHeaders([{ Authorization: `Bearer ${this.accessToken}` }]);
}
+ protected async modelAccessKeyAuth(opts: FinalRequestOptions): Promise {
+ if (this.modelAccessKey == null) {
+ return undefined;
+ }
+ return buildHeaders([{ Authorization: `Bearer ${this.modelAccessKey}` }]);
+ }
+
+ protected async agentAccessKeyAuth(opts: FinalRequestOptions): Promise {
+ if (this.agentAccessKey == null) {
+ return undefined;
+ }
+ return buildHeaders([{ Authorization: `Bearer ${this.agentAccessKey}` }]);
+ }
+
protected stringifyQuery(query: Record): string {
return qs.stringify(query, { arrayFormat: 'comma' });
}
@@ -814,6 +857,7 @@ export class Gradient {
agents: API.Agents = new API.Agents(this);
chat: API.Chat = new API.Chat(this);
+ images: API.Images = new API.Images(this);
gpuDroplets: API.GPUDroplets = new API.GPUDroplets(this);
inference: API.Inference = new API.Inference(this);
knowledgeBases: API.KnowledgeBases = new API.KnowledgeBases(this);
@@ -824,6 +868,7 @@ export class Gradient {
Gradient.Agents = Agents;
Gradient.Chat = Chat;
+Gradient.Images = Images;
Gradient.GPUDroplets = GPUDroplets;
Gradient.Inference = Inference;
Gradient.KnowledgeBases = KnowledgeBases;
@@ -860,6 +905,14 @@ export declare namespace Gradient {
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,
@@ -926,6 +979,9 @@ export declare namespace Gradient {
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;
diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts
index 245e849..30eada3 100644
--- a/src/internal/to-file.ts
+++ b/src/internal/to-file.ts
@@ -73,7 +73,7 @@ export type ToFileInput =
/**
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
- * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s
+ * @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
* @param {Object=} options additional properties
* @param {string=} options.type the MIME type of the content
diff --git a/src/resources/agents/chat/completions.ts b/src/resources/agents/chat/completions.ts
index 65d81da..c559148 100644
--- a/src/resources/agents/chat/completions.ts
+++ b/src/resources/agents/chat/completions.ts
@@ -90,7 +90,7 @@ export namespace CompletionCreateResponse {
* number of tokens specified in the request was reached, `tool_calls` if the model
* called a tool.
*/
- finish_reason: 'stop' | 'length' | 'tool_calls';
+ finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter';
/**
* The index of the choice in the list of choices.
@@ -133,6 +133,11 @@ export namespace CompletionCreateResponse {
*/
content: string | null;
+ /**
+ * The reasoning content generated by the model.
+ */
+ reasoning_content: string | null;
+
/**
* The refusal message generated by the model.
*/
@@ -339,6 +344,8 @@ export interface CompletionCreateParamsBase {
* monitor and detect abuse.
*/
user?: string;
+
+ [k: string]: unknown;
}
export namespace CompletionCreateParams {
@@ -350,7 +357,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the system message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `system`.
@@ -358,6 +365,23 @@ export namespace CompletionCreateParams {
role: 'system';
}
+ export namespace ChatCompletionRequestSystemMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Developer-provided instructions that the model should follow, regardless of
* messages sent by the user.
@@ -366,7 +390,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the developer message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `developer`.
@@ -374,6 +398,23 @@ export namespace CompletionCreateParams {
role: 'developer';
}
+ export namespace ChatCompletionRequestDeveloperMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Messages sent by an end user, containing prompts or additional context
* information.
@@ -382,7 +423,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the user message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `user`.
@@ -390,6 +431,23 @@ export namespace CompletionCreateParams {
role: 'user';
}
+ export namespace ChatCompletionRequestUserMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Messages sent by the model in response to user messages.
*/
@@ -402,7 +460,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the assistant message.
*/
- content?: string | Array | null;
+ content?: string | Array | null;
/**
* The tool calls generated by the model, such as function calls.
@@ -411,6 +469,21 @@ export namespace CompletionCreateParams {
}
export namespace ChatCompletionRequestAssistantMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+
export interface ToolCall {
/**
* The ID of the tool call.
@@ -549,6 +622,8 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
* generated using server-sent events.
*/
stream?: false | null;
+
+ [k: string]: unknown;
}
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
@@ -557,6 +632,8 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
* generated using server-sent events.
*/
stream: true;
+
+ [k: string]: unknown;
}
export declare namespace Completions {
diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts
index a29b966..6dd6e2c 100644
--- a/src/resources/chat/completions.ts
+++ b/src/resources/chat/completions.ts
@@ -89,7 +89,7 @@ export namespace CompletionCreateResponse {
* number of tokens specified in the request was reached, `tool_calls` if the model
* called a tool.
*/
- finish_reason: 'stop' | 'length' | 'tool_calls';
+ finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter';
/**
* The index of the choice in the list of choices.
@@ -132,6 +132,11 @@ export namespace CompletionCreateResponse {
*/
content: string | null;
+ /**
+ * The reasoning content generated by the model.
+ */
+ reasoning_content: string | null;
+
/**
* The refusal message generated by the model.
*/
@@ -338,6 +343,8 @@ export interface CompletionCreateParamsBase {
* monitor and detect abuse.
*/
user?: string;
+
+ [k: string]: unknown;
}
export namespace CompletionCreateParams {
@@ -349,7 +356,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the system message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `system`.
@@ -357,6 +364,23 @@ export namespace CompletionCreateParams {
role: 'system';
}
+ export namespace ChatCompletionRequestSystemMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Developer-provided instructions that the model should follow, regardless of
* messages sent by the user.
@@ -365,7 +389,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the developer message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `developer`.
@@ -373,6 +397,23 @@ export namespace CompletionCreateParams {
role: 'developer';
}
+ export namespace ChatCompletionRequestDeveloperMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Messages sent by an end user, containing prompts or additional context
* information.
@@ -381,7 +422,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the user message.
*/
- content: string | Array;
+ content: string | Array;
/**
* The role of the messages author, in this case `user`.
@@ -389,6 +430,23 @@ export namespace CompletionCreateParams {
role: 'user';
}
+ export namespace ChatCompletionRequestUserMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+ }
+
/**
* Messages sent by the model in response to user messages.
*/
@@ -401,7 +459,7 @@ export namespace CompletionCreateParams {
/**
* The contents of the assistant message.
*/
- content?: string | Array | null;
+ content?: string | Array | null;
/**
* The tool calls generated by the model, such as function calls.
@@ -410,6 +468,21 @@ export namespace CompletionCreateParams {
}
export namespace ChatCompletionRequestAssistantMessage {
+ /**
+ * Content part with type and text
+ */
+ export interface UnionMember1 {
+ /**
+ * The text content
+ */
+ text: string;
+
+ /**
+ * The type of content part
+ */
+ type: 'text';
+ }
+
export interface ToolCall {
/**
* The ID of the tool call.
@@ -548,6 +621,8 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
* generated using server-sent events.
*/
stream?: false | null;
+
+ [k: string]: unknown;
}
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
@@ -556,6 +631,8 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB
* generated using server-sent events.
*/
stream: true;
+
+ [k: string]: unknown;
}
export declare namespace Completions {
diff --git a/src/resources/gpu-droplets/account/account.ts b/src/resources/gpu-droplets/account/account.ts
index a0d01ec..be1d479 100644
--- a/src/resources/gpu-droplets/account/account.ts
+++ b/src/resources/gpu-droplets/account/account.ts
@@ -11,6 +11,7 @@ import {
KeyUpdateParams,
KeyUpdateResponse,
Keys,
+ SSHKeys,
} from './keys';
export class Account extends APIResource {
@@ -22,6 +23,7 @@ Account.Keys = Keys;
export declare namespace Account {
export {
Keys as Keys,
+ type SSHKeys as SSHKeys,
type KeyCreateResponse as KeyCreateResponse,
type KeyRetrieveResponse as KeyRetrieveResponse,
type KeyUpdateResponse as KeyUpdateResponse,
diff --git a/src/resources/gpu-droplets/account/index.ts b/src/resources/gpu-droplets/account/index.ts
index 90dabac..bb5815b 100644
--- a/src/resources/gpu-droplets/account/index.ts
+++ b/src/resources/gpu-droplets/account/index.ts
@@ -3,6 +3,7 @@
export { Account } from './account';
export {
Keys,
+ type SSHKeys,
type KeyCreateResponse,
type KeyRetrieveResponse,
type KeyUpdateResponse,
diff --git a/src/resources/gpu-droplets/account/keys.ts b/src/resources/gpu-droplets/account/keys.ts
index 7dcb2e3..286acd3 100644
--- a/src/resources/gpu-droplets/account/keys.ts
+++ b/src/resources/gpu-droplets/account/keys.ts
@@ -113,103 +113,43 @@ export class Keys extends APIResource {
}
}
-export interface KeyCreateResponse {
- ssh_key?: KeyCreateResponse.SSHKey;
-}
-
-export namespace KeyCreateResponse {
- export interface SSHKey {
- /**
- * A human-readable display name for this key, used to easily identify the SSH keys
- * when they are displayed.
- */
- name: string;
+export interface SSHKeys {
+ /**
+ * A human-readable display name for this key, used to easily identify the SSH keys
+ * when they are displayed.
+ */
+ name: string;
- /**
- * The entire public key string that was uploaded. Embedded into the root user's
- * `authorized_keys` file if you include this key during Droplet creation.
- */
- public_key: string;
+ /**
+ * The entire public key string that was uploaded. Embedded into the root user's
+ * `authorized_keys` file if you include this key during Droplet creation.
+ */
+ public_key: string;
- /**
- * A unique identification number for this key. Can be used to embed a specific SSH
- * key into a Droplet.
- */
- id?: number;
+ /**
+ * A unique identification number for this key. Can be used to embed a specific SSH
+ * key into a Droplet.
+ */
+ id?: number;
- /**
- * A unique identifier that differentiates this key from other keys using a format
- * that SSH recognizes. The fingerprint is created when the key is added to your
- * account.
- */
- fingerprint?: string;
- }
+ /**
+ * A unique identifier that differentiates this key from other keys using a format
+ * that SSH recognizes. The fingerprint is created when the key is added to your
+ * account.
+ */
+ fingerprint?: string;
}
-export interface KeyRetrieveResponse {
- ssh_key?: KeyRetrieveResponse.SSHKey;
+export interface KeyCreateResponse {
+ ssh_key?: SSHKeys;
}
-export namespace KeyRetrieveResponse {
- export interface SSHKey {
- /**
- * A human-readable display name for this key, used to easily identify the SSH keys
- * when they are displayed.
- */
- name: string;
-
- /**
- * The entire public key string that was uploaded. Embedded into the root user's
- * `authorized_keys` file if you include this key during Droplet creation.
- */
- public_key: string;
-
- /**
- * A unique identification number for this key. Can be used to embed a specific SSH
- * key into a Droplet.
- */
- id?: number;
-
- /**
- * A unique identifier that differentiates this key from other keys using a format
- * that SSH recognizes. The fingerprint is created when the key is added to your
- * account.
- */
- fingerprint?: string;
- }
+export interface KeyRetrieveResponse {
+ ssh_key?: SSHKeys;
}
export interface KeyUpdateResponse {
- ssh_key?: KeyUpdateResponse.SSHKey;
-}
-
-export namespace KeyUpdateResponse {
- export interface SSHKey {
- /**
- * A human-readable display name for this key, used to easily identify the SSH keys
- * when they are displayed.
- */
- name: string;
-
- /**
- * The entire public key string that was uploaded. Embedded into the root user's
- * `authorized_keys` file if you include this key during Droplet creation.
- */
- public_key: string;
-
- /**
- * A unique identification number for this key. Can be used to embed a specific SSH
- * key into a Droplet.
- */
- id?: number;
-
- /**
- * A unique identifier that differentiates this key from other keys using a format
- * that SSH recognizes. The fingerprint is created when the key is added to your
- * account.
- */
- fingerprint?: string;
- }
+ ssh_key?: SSHKeys;
}
export interface KeyListResponse {
@@ -220,36 +160,7 @@ export interface KeyListResponse {
links?: Shared.PageLinks;
- ssh_keys?: Array;
-}
-
-export namespace KeyListResponse {
- export interface SSHKey {
- /**
- * A human-readable display name for this key, used to easily identify the SSH keys
- * when they are displayed.
- */
- name: string;
-
- /**
- * The entire public key string that was uploaded. Embedded into the root user's
- * `authorized_keys` file if you include this key during Droplet creation.
- */
- public_key: string;
-
- /**
- * A unique identification number for this key. Can be used to embed a specific SSH
- * key into a Droplet.
- */
- id?: number;
-
- /**
- * A unique identifier that differentiates this key from other keys using a format
- * that SSH recognizes. The fingerprint is created when the key is added to your
- * account.
- */
- fingerprint?: string;
- }
+ ssh_keys?: Array;
}
export interface KeyCreateParams {
@@ -288,6 +199,7 @@ export interface KeyListParams {
export declare namespace Keys {
export {
+ type SSHKeys as SSHKeys,
type KeyCreateResponse as KeyCreateResponse,
type KeyRetrieveResponse as KeyRetrieveResponse,
type KeyUpdateResponse as KeyUpdateResponse,
diff --git a/src/resources/gpu-droplets/floating-ips/floating-ips.ts b/src/resources/gpu-droplets/floating-ips/floating-ips.ts
index 07a03d1..086c96a 100644
--- a/src/resources/gpu-droplets/floating-ips/floating-ips.ts
+++ b/src/resources/gpu-droplets/floating-ips/floating-ips.ts
@@ -29,9 +29,6 @@ export class FloatingIPs extends APIResource {
* - To create a new floating IP reserved to a region, send a POST request to
* `/v2/floating_ips` with the `region` attribute.
*
- * **Note**: In addition to the standard rate limiting, only 12 floating IPs may be
- * created per 60 seconds.
- *
* @example
* ```ts
* const floatingIP =
diff --git a/src/resources/images.ts b/src/resources/images.ts
new file mode 100644
index 0000000..4760368
--- /dev/null
+++ b/src/resources/images.ts
@@ -0,0 +1,256 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import * as ImagesAPI from './images';
+import * as Shared from './shared';
+import { APIPromise } from '../core/api-promise';
+import { Stream } from '../core/streaming';
+import { RequestOptions } from '../internal/request-options';
+
+export class Images extends APIResource {
+ /**
+ * Creates a high-quality image from a text prompt using GPT-IMAGE-1, the latest
+ * image generation model with automatic prompt optimization and enhanced visual
+ * capabilities.
+ *
+ * @example
+ * ```ts
+ * const response = await client.images.generate({
+ * prompt:
+ * 'A cute baby sea otter floating on its back in calm blue water',
+ * });
+ * ```
+ */
+ generate(
+ body: ImageGenerateParamsNonStreaming,
+ options?: RequestOptions,
+ ): APIPromise;
+ generate(
+ body: ImageGenerateParamsStreaming,
+ options?: RequestOptions,
+ ): APIPromise>;
+ generate(
+ body: ImageGenerateParamsBase,
+ options?: RequestOptions,
+ ): APIPromise | ImageGenerateResponse>;
+ generate(
+ body: ImageGenerateParams,
+ options?: RequestOptions,
+ ): APIPromise | APIPromise> {
+ return this._client.post('/images/generations', {
+ body,
+ defaultBaseURL: '{inferenceEndpoint}/v1',
+ ...options,
+ stream: body.stream ?? false,
+ }) as APIPromise | APIPromise>;
+ }
+}
+
+/**
+ * The response from the image generation endpoint
+ */
+export interface ImageGenerateResponse {
+ /**
+ * The Unix timestamp (in seconds) of when the images were created
+ */
+ created: number;
+
+ /**
+ * The list of generated images
+ */
+ data: Array;
+
+ /**
+ * The background setting used for the image generation
+ */
+ background?: string | null;
+
+ /**
+ * The output format of the generated image
+ */
+ output_format?: string | null;
+
+ /**
+ * The quality setting used for the image generation
+ */
+ quality?: string | null;
+
+ /**
+ * The size of the generated image
+ */
+ size?: string | null;
+
+ /**
+ * Usage statistics for the image generation request
+ */
+ usage?: ImageGenerateResponse.Usage | null;
+}
+
+export namespace ImageGenerateResponse {
+ /**
+ * Represents the content of a generated image from GPT-IMAGE-1
+ */
+ export interface Data {
+ /**
+ * The base64-encoded JSON of the generated image. GPT-IMAGE-1 returns images in
+ * b64_json format only.
+ */
+ b64_json: string;
+
+ /**
+ * The optimized prompt that was used to generate the image. GPT-IMAGE-1
+ * automatically optimizes prompts for best results.
+ */
+ revised_prompt?: string;
+ }
+
+ /**
+ * Usage statistics for the image generation request
+ */
+ export interface Usage {
+ /**
+ * Number of tokens in the input prompt
+ */
+ input_tokens: number;
+
+ /**
+ * Total number of tokens used (input + output)
+ */
+ total_tokens: number;
+
+ /**
+ * Detailed breakdown of input tokens
+ */
+ input_tokens_details?: Usage.InputTokensDetails | null;
+
+ /**
+ * Number of tokens in the generated output
+ */
+ output_tokens?: number;
+ }
+
+ export namespace Usage {
+ /**
+ * Detailed breakdown of input tokens
+ */
+ export interface InputTokensDetails {
+ /**
+ * Number of text tokens in the input
+ */
+ text_tokens?: number;
+ }
+ }
+}
+
+export type ImageGenerateParams = ImageGenerateParamsNonStreaming | ImageGenerateParamsStreaming;
+
+export interface ImageGenerateParamsBase {
+ /**
+ * A text description of the desired image(s). GPT-IMAGE-1 supports up to 32,000
+ * characters and provides automatic prompt optimization for best results.
+ */
+ prompt: string;
+
+ /**
+ * The background setting for the image generation. GPT-IMAGE-1 supports:
+ * transparent, opaque, auto.
+ */
+ background?: string | null;
+
+ /**
+ * The model to use for image generation. GPT-IMAGE-1 is the latest model offering
+ * the best quality with automatic optimization and enhanced capabilities.
+ */
+ model?: string;
+
+ /**
+ * The moderation setting for the image generation. GPT-IMAGE-1 supports: low,
+ * auto.
+ */
+ moderation?: string | null;
+
+ /**
+ * The number of images to generate. GPT-IMAGE-1 only supports n=1.
+ */
+ n?: number | null;
+
+ /**
+ * The output compression for the image generation. GPT-IMAGE-1 supports: 0-100.
+ */
+ output_compression?: number | null;
+
+ /**
+ * The output format for the image generation. GPT-IMAGE-1 supports: png, webp,
+ * jpeg.
+ */
+ output_format?: string | null;
+
+ /**
+ * The number of partial image chunks to return during streaming generation. This
+ * parameter is optional with a default of 0. When stream=true, this must be
+ * greater than 0 to receive progressive updates of the image as it's being
+ * generated. Higher values provide more frequent updates but may increase response
+ * overhead.
+ */
+ partial_images?: number | null;
+
+ /**
+ * The quality of the image that will be generated. GPT-IMAGE-1 supports: auto
+ * (automatically select best quality), high, medium, low.
+ */
+ quality?: string | null;
+
+ /**
+ * The size of the generated images. GPT-IMAGE-1 supports: auto (automatically
+ * select best size), 1536x1024 (landscape), 1024x1536 (portrait).
+ */
+ size?: string | null;
+
+ /**
+ * If set to true, partial image data will be streamed as the image is being
+ * generated. When streaming, the response will be sent as server-sent events with
+ * partial image chunks. When stream is true, partial_images must be greater
+ * than 0.
+ */
+ stream?: boolean | null;
+
+ /**
+ * A unique identifier representing your end-user, which can help DigitalOcean to
+ * monitor and detect abuse.
+ */
+ user?: string | null;
+}
+
+export namespace ImageGenerateParams {
+ export type ImageGenerateParamsNonStreaming = ImagesAPI.ImageGenerateParamsNonStreaming;
+ export type ImageGenerateParamsStreaming = ImagesAPI.ImageGenerateParamsStreaming;
+}
+
+export interface ImageGenerateParamsNonStreaming extends ImageGenerateParamsBase {
+ /**
+ * If set to true, partial image data will be streamed as the image is being
+ * generated. When streaming, the response will be sent as server-sent events with
+ * partial image chunks. When stream is true, partial_images must be greater
+ * than 0.
+ */
+ stream?: false | null;
+}
+
+export interface ImageGenerateParamsStreaming extends ImageGenerateParamsBase {
+ /**
+ * If set to true, partial image data will be streamed as the image is being
+ * generated. When streaming, the response will be sent as server-sent events with
+ * partial image chunks. When stream is true, partial_images must be greater
+ * than 0.
+ */
+ stream: true;
+}
+
+export declare namespace Images {
+ export {
+ type ImageGenerateResponse as ImageGenerateResponse,
+ type ImageGenerateParams as ImageGenerateParams,
+ type ImageGenerateParamsNonStreaming as ImageGenerateParamsNonStreaming,
+ type ImageGenerateParamsStreaming as ImageGenerateParamsStreaming,
+ };
+}
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 9311a74..bb622ec 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -43,6 +43,13 @@ export {
type GPUDropletListKernelsParams,
type GPUDropletListSnapshotsParams,
} from './gpu-droplets/gpu-droplets';
+export {
+ Images,
+ type ImageGenerateResponse,
+ type ImageGenerateParams,
+ type ImageGenerateParamsNonStreaming,
+ type ImageGenerateParamsStreaming,
+} from './images';
export { Inference } from './inference/inference';
export {
KnowledgeBases,
diff --git a/src/resources/knowledge-bases/data-sources.ts b/src/resources/knowledge-bases/data-sources.ts
index 90a442a..73271de 100644
--- a/src/resources/knowledge-bases/data-sources.ts
+++ b/src/resources/knowledge-bases/data-sources.ts
@@ -83,6 +83,27 @@ export class DataSources extends APIResource {
{ defaultBaseURL: 'https://api.digitalocean.com', ...options },
);
}
+
+ /**
+ * To create presigned URLs for knowledge base data source file upload, send a POST
+ * request to `/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls`.
+ *
+ * @example
+ * ```ts
+ * const response =
+ * await client.knowledgeBases.dataSources.createPresignedURLs();
+ * ```
+ */
+ createPresignedURLs(
+ body: DataSourceCreatePresignedURLsParams | null | undefined = {},
+ options?: RequestOptions,
+ ): APIPromise {
+ return this._client.post('/v2/gen-ai/knowledge_bases/data_sources/file_upload_presigned_urls', {
+ body,
+ defaultBaseURL: 'https://api.digitalocean.com',
+ ...options,
+ });
+ }
}
/**
@@ -313,6 +334,48 @@ export interface DataSourceDeleteResponse {
knowledge_base_uuid?: string;
}
+/**
+ * Response with pre-signed urls to upload files.
+ */
+export interface DataSourceCreatePresignedURLsResponse {
+ /**
+ * The ID generated for the request for Presigned URLs.
+ */
+ request_id?: string;
+
+ /**
+ * A list of generated presigned URLs and object keys, one per file.
+ */
+ uploads?: Array;
+}
+
+export namespace DataSourceCreatePresignedURLsResponse {
+ /**
+ * Detailed info about each presigned URL returned to the client.
+ */
+ export interface Upload {
+ /**
+ * The time the url expires at.
+ */
+ expires_at?: string;
+
+ /**
+ * The unique object key to store the file as.
+ */
+ object_key?: string;
+
+ /**
+ * The original file name.
+ */
+ original_file_name?: string;
+
+ /**
+ * The actual presigned URL the client can use to upload the file directly.
+ */
+ presigned_url?: string;
+ }
+}
+
export interface DataSourceCreateParams {
/**
* AWS S3 Data Source
@@ -354,6 +417,30 @@ export interface DataSourceDeleteParams {
knowledge_base_uuid: string;
}
+export interface DataSourceCreatePresignedURLsParams {
+ /**
+ * A list of files to generate presigned URLs for.
+ */
+ files?: Array;
+}
+
+export namespace DataSourceCreatePresignedURLsParams {
+ /**
+ * A single file’s metadata in the request.
+ */
+ export interface File {
+ /**
+ * Local filename
+ */
+ file_name?: string;
+
+ /**
+ * The size of the file in bytes.
+ */
+ file_size?: string;
+ }
+}
+
export declare namespace DataSources {
export {
type APIFileUploadDataSource as APIFileUploadDataSource,
@@ -364,8 +451,10 @@ export declare namespace DataSources {
type DataSourceCreateResponse as DataSourceCreateResponse,
type DataSourceListResponse as DataSourceListResponse,
type DataSourceDeleteResponse as DataSourceDeleteResponse,
+ type DataSourceCreatePresignedURLsResponse as DataSourceCreatePresignedURLsResponse,
type DataSourceCreateParams as DataSourceCreateParams,
type DataSourceListParams as DataSourceListParams,
type DataSourceDeleteParams as DataSourceDeleteParams,
+ type DataSourceCreatePresignedURLsParams as DataSourceCreatePresignedURLsParams,
};
}
diff --git a/src/resources/knowledge-bases/index.ts b/src/resources/knowledge-bases/index.ts
index 43716ea..f64b0d2 100644
--- a/src/resources/knowledge-bases/index.ts
+++ b/src/resources/knowledge-bases/index.ts
@@ -10,9 +10,11 @@ export {
type DataSourceCreateResponse,
type DataSourceListResponse,
type DataSourceDeleteResponse,
+ type DataSourceCreatePresignedURLsResponse,
type DataSourceCreateParams,
type DataSourceListParams,
type DataSourceDeleteParams,
+ type DataSourceCreatePresignedURLsParams,
} from './data-sources';
export {
IndexingJobs,
diff --git a/src/resources/knowledge-bases/knowledge-bases.ts b/src/resources/knowledge-bases/knowledge-bases.ts
index 2f13105..8758749 100644
--- a/src/resources/knowledge-bases/knowledge-bases.ts
+++ b/src/resources/knowledge-bases/knowledge-bases.ts
@@ -10,6 +10,8 @@ import {
APIWebCrawlerDataSource,
AwsDataSource,
DataSourceCreateParams,
+ DataSourceCreatePresignedURLsParams,
+ DataSourceCreatePresignedURLsResponse,
DataSourceCreateResponse,
DataSourceDeleteParams,
DataSourceDeleteResponse,
@@ -445,9 +447,11 @@ export declare namespace KnowledgeBases {
type DataSourceCreateResponse as DataSourceCreateResponse,
type DataSourceListResponse as DataSourceListResponse,
type DataSourceDeleteResponse as DataSourceDeleteResponse,
+ type DataSourceCreatePresignedURLsResponse as DataSourceCreatePresignedURLsResponse,
type DataSourceCreateParams as DataSourceCreateParams,
type DataSourceListParams as DataSourceListParams,
type DataSourceDeleteParams as DataSourceDeleteParams,
+ type DataSourceCreatePresignedURLsParams as DataSourceCreatePresignedURLsParams,
};
export {
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index ca1e475..3633e97 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -197,7 +197,7 @@ export namespace ChatCompletionChunk {
* number of tokens specified in the request was reached, `tool_calls` if the model
* called a tool.
*/
- finish_reason: 'stop' | 'length' | 'tool_calls' | null;
+ finish_reason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | null;
/**
* The index of the choice in the list of choices.
@@ -220,6 +220,11 @@ export namespace ChatCompletionChunk {
*/
content?: string | null;
+ /**
+ * The reasoning content generated by the model.
+ */
+ reasoning_content?: string | null;
+
/**
* The refusal message generated by the model.
*/
@@ -795,6 +800,145 @@ export interface Image {
type?: 'base' | 'snapshot' | 'backup' | 'custom' | 'admin';
}
+/**
+ * Emitted when image generation has completed and the final image is available.
+ */
+export interface ImageGenCompletedEvent {
+ /**
+ * Base64-encoded image data, suitable for rendering as an image.
+ */
+ b64_json: string;
+
+ /**
+ * The background setting for the generated image.
+ */
+ background: 'transparent' | 'opaque' | 'auto';
+
+ /**
+ * The Unix timestamp when the event was created.
+ */
+ created_at: number;
+
+ /**
+ * The output format for the generated image.
+ */
+ output_format: 'png' | 'webp' | 'jpeg';
+
+ /**
+ * The quality setting for the generated image.
+ */
+ quality: 'low' | 'medium' | 'high' | 'auto';
+
+ /**
+ * The size of the generated image.
+ */
+ size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
+
+ /**
+ * The type of the event. Always `image_generation.completed`.
+ */
+ type: 'image_generation.completed';
+
+ /**
+ * For `gpt-image-1` only, the token usage information for the image generation.
+ */
+ usage: ImageGenCompletedEvent.Usage;
+}
+
+export namespace ImageGenCompletedEvent {
+ /**
+ * For `gpt-image-1` only, the token usage information for the image generation.
+ */
+ export interface Usage {
+ /**
+ * The number of tokens (images and text) in the input prompt.
+ */
+ input_tokens: number;
+
+ /**
+ * The input tokens detailed information for the image generation.
+ */
+ input_tokens_details: Usage.InputTokensDetails;
+
+ /**
+ * The number of image tokens in the output image.
+ */
+ output_tokens: number;
+
+ /**
+ * The total number of tokens (images and text) used for the image generation.
+ */
+ total_tokens: number;
+ }
+
+ export namespace Usage {
+ /**
+ * The input tokens detailed information for the image generation.
+ */
+ export interface InputTokensDetails {
+ /**
+ * The number of image tokens in the input prompt.
+ */
+ image_tokens: number;
+
+ /**
+ * The number of text tokens in the input prompt.
+ */
+ text_tokens: number;
+ }
+ }
+}
+
+/**
+ * Emitted when a partial image is available during image generation streaming.
+ */
+export interface ImageGenPartialImageEvent {
+ /**
+ * Base64-encoded partial image data, suitable for rendering as an image.
+ */
+ b64_json: string;
+
+ /**
+ * The background setting for the requested image.
+ */
+ background: 'transparent' | 'opaque' | 'auto';
+
+ /**
+ * The Unix timestamp when the event was created.
+ */
+ created_at: number;
+
+ /**
+ * The output format for the requested image.
+ */
+ output_format: 'png' | 'webp' | 'jpeg';
+
+ /**
+ * 0-based index for the partial image (streaming).
+ */
+ partial_image_index: number;
+
+ /**
+ * The quality setting for the requested image.
+ */
+ quality: 'low' | 'medium' | 'high' | 'auto';
+
+ /**
+ * The size of the requested image.
+ */
+ size: '1024x1024' | '1024x1536' | '1536x1024' | 'auto';
+
+ /**
+ * The type of the event. Always `image_generation.partial_image`.
+ */
+ type: 'image_generation.partial_image';
+}
+
+/**
+ * Emitted when a partial image is available during image generation streaming.
+ */
+export type ImageGenStreamEvent = ImageGenPartialImageEvent | ImageGenCompletedEvent;
+
/**
* @deprecated **Note**: All Droplets created after March 2017 use internal kernels
* by default. These Droplets will have this attribute set to `null`.
@@ -956,7 +1100,7 @@ export interface Size {
/**
* An array containing the region slugs where this size is available for Droplet
- * creates. regions:read is required to view.
+ * creates.
*/
regions: Array;
diff --git a/src/version.ts b/src/version.ts
index b0bfd9e..a528f63 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.1.0-alpha.1'; // x-release-please-version
+export const VERSION = '0.1.0-alpha.2'; // x-release-please-version
diff --git a/tests/api-resources/agents/agents.test.ts b/tests/api-resources/agents/agents.test.ts
index 8f79fc6..f299460 100644
--- a/tests/api-resources/agents/agents.test.ts
+++ b/tests/api-resources/agents/agents.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/api-keys.test.ts b/tests/api-resources/agents/api-keys.test.ts
index 5a2b6ea..e7cf051 100644
--- a/tests/api-resources/agents/api-keys.test.ts
+++ b/tests/api-resources/agents/api-keys.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/chat/completions.test.ts b/tests/api-resources/agents/chat/completions.test.ts
index 11c97de..4981bcb 100644
--- a/tests/api-resources/agents/chat/completions.test.ts
+++ b/tests/api-resources/agents/chat/completions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-datasets.test.ts b/tests/api-resources/agents/evaluation-datasets.test.ts
index ee8a998..53fbc66 100644
--- a/tests/api-resources/agents/evaluation-datasets.test.ts
+++ b/tests/api-resources/agents/evaluation-datasets.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/anthropic/keys.test.ts b/tests/api-resources/agents/evaluation-metrics/anthropic/keys.test.ts
index 5c144d2..5c96717 100644
--- a/tests/api-resources/agents/evaluation-metrics/anthropic/keys.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/anthropic/keys.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/evaluation-metrics.test.ts b/tests/api-resources/agents/evaluation-metrics/evaluation-metrics.test.ts
index 9e7a295..20670f2 100644
--- a/tests/api-resources/agents/evaluation-metrics/evaluation-metrics.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/evaluation-metrics.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/models.test.ts b/tests/api-resources/agents/evaluation-metrics/models.test.ts
index 6852c89..fcc8425 100644
--- a/tests/api-resources/agents/evaluation-metrics/models.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/models.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/oauth2/dropbox.test.ts b/tests/api-resources/agents/evaluation-metrics/oauth2/dropbox.test.ts
index aa9779b..b4d0e13 100644
--- a/tests/api-resources/agents/evaluation-metrics/oauth2/dropbox.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/oauth2/dropbox.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/oauth2/oauth2.test.ts b/tests/api-resources/agents/evaluation-metrics/oauth2/oauth2.test.ts
index 9bd0f8f..cb353f1 100644
--- a/tests/api-resources/agents/evaluation-metrics/oauth2/oauth2.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/oauth2/oauth2.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/openai/keys.test.ts b/tests/api-resources/agents/evaluation-metrics/openai/keys.test.ts
index 4e185b1..3306324 100644
--- a/tests/api-resources/agents/evaluation-metrics/openai/keys.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/openai/keys.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/workspaces/agents.test.ts b/tests/api-resources/agents/evaluation-metrics/workspaces/agents.test.ts
index c21df32..f05d594 100644
--- a/tests/api-resources/agents/evaluation-metrics/workspaces/agents.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/workspaces/agents.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-metrics/workspaces/workspaces.test.ts b/tests/api-resources/agents/evaluation-metrics/workspaces/workspaces.test.ts
index 3347365..340d283 100644
--- a/tests/api-resources/agents/evaluation-metrics/workspaces/workspaces.test.ts
+++ b/tests/api-resources/agents/evaluation-metrics/workspaces/workspaces.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-runs.test.ts b/tests/api-resources/agents/evaluation-runs.test.ts
index a697c84..20aa833 100644
--- a/tests/api-resources/agents/evaluation-runs.test.ts
+++ b/tests/api-resources/agents/evaluation-runs.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/evaluation-test-cases.test.ts b/tests/api-resources/agents/evaluation-test-cases.test.ts
index b89d652..e57a6b5 100644
--- a/tests/api-resources/agents/evaluation-test-cases.test.ts
+++ b/tests/api-resources/agents/evaluation-test-cases.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/functions.test.ts b/tests/api-resources/agents/functions.test.ts
index 09d0352..775389e 100644
--- a/tests/api-resources/agents/functions.test.ts
+++ b/tests/api-resources/agents/functions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/knowledge-bases.test.ts b/tests/api-resources/agents/knowledge-bases.test.ts
index 1cca1bb..aa575f2 100644
--- a/tests/api-resources/agents/knowledge-bases.test.ts
+++ b/tests/api-resources/agents/knowledge-bases.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/routes.test.ts b/tests/api-resources/agents/routes.test.ts
index 6fb32f6..00f0d4b 100644
--- a/tests/api-resources/agents/routes.test.ts
+++ b/tests/api-resources/agents/routes.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/agents/versions.test.ts b/tests/api-resources/agents/versions.test.ts
index 020d302..af0da44 100644
--- a/tests/api-resources/agents/versions.test.ts
+++ b/tests/api-resources/agents/versions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts
index 0017d48..42d966d 100644
--- a/tests/api-resources/chat/completions.test.ts
+++ b/tests/api-resources/chat/completions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/databases/schema-registry/config.test.ts b/tests/api-resources/databases/schema-registry/config.test.ts
index 309cfab..5a58a67 100644
--- a/tests/api-resources/databases/schema-registry/config.test.ts
+++ b/tests/api-resources/databases/schema-registry/config.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/account/keys.test.ts b/tests/api-resources/gpu-droplets/account/keys.test.ts
index 7023377..8c4282f 100644
--- a/tests/api-resources/gpu-droplets/account/keys.test.ts
+++ b/tests/api-resources/gpu-droplets/account/keys.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/actions.test.ts b/tests/api-resources/gpu-droplets/actions.test.ts
index 044546e..3ab1754 100644
--- a/tests/api-resources/gpu-droplets/actions.test.ts
+++ b/tests/api-resources/gpu-droplets/actions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/autoscale.test.ts b/tests/api-resources/gpu-droplets/autoscale.test.ts
index 09e0a80..31e8df0 100644
--- a/tests/api-resources/gpu-droplets/autoscale.test.ts
+++ b/tests/api-resources/gpu-droplets/autoscale.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/backups.test.ts b/tests/api-resources/gpu-droplets/backups.test.ts
index 776b7be..5638af9 100644
--- a/tests/api-resources/gpu-droplets/backups.test.ts
+++ b/tests/api-resources/gpu-droplets/backups.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/destroy-with-associated-resources.test.ts b/tests/api-resources/gpu-droplets/destroy-with-associated-resources.test.ts
index b335df3..ec46c07 100644
--- a/tests/api-resources/gpu-droplets/destroy-with-associated-resources.test.ts
+++ b/tests/api-resources/gpu-droplets/destroy-with-associated-resources.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/firewalls/droplets.test.ts b/tests/api-resources/gpu-droplets/firewalls/droplets.test.ts
index b27db70..5ee4546 100644
--- a/tests/api-resources/gpu-droplets/firewalls/droplets.test.ts
+++ b/tests/api-resources/gpu-droplets/firewalls/droplets.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/firewalls/firewalls.test.ts b/tests/api-resources/gpu-droplets/firewalls/firewalls.test.ts
index 2d63f99..e0c8dfa 100644
--- a/tests/api-resources/gpu-droplets/firewalls/firewalls.test.ts
+++ b/tests/api-resources/gpu-droplets/firewalls/firewalls.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/firewalls/rules.test.ts b/tests/api-resources/gpu-droplets/firewalls/rules.test.ts
index 8d79c74..c30ffc0 100644
--- a/tests/api-resources/gpu-droplets/firewalls/rules.test.ts
+++ b/tests/api-resources/gpu-droplets/firewalls/rules.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/firewalls/tags.test.ts b/tests/api-resources/gpu-droplets/firewalls/tags.test.ts
index 89caced..c4a39f9 100644
--- a/tests/api-resources/gpu-droplets/firewalls/tags.test.ts
+++ b/tests/api-resources/gpu-droplets/firewalls/tags.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/floating-ips/actions.test.ts b/tests/api-resources/gpu-droplets/floating-ips/actions.test.ts
index b91aac1..d0a8b3c 100644
--- a/tests/api-resources/gpu-droplets/floating-ips/actions.test.ts
+++ b/tests/api-resources/gpu-droplets/floating-ips/actions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/floating-ips/floating-ips.test.ts b/tests/api-resources/gpu-droplets/floating-ips/floating-ips.test.ts
index efe7595..fb6c540 100644
--- a/tests/api-resources/gpu-droplets/floating-ips/floating-ips.test.ts
+++ b/tests/api-resources/gpu-droplets/floating-ips/floating-ips.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/gpu-droplets.test.ts b/tests/api-resources/gpu-droplets/gpu-droplets.test.ts
index 43ac117..112ebd0 100644
--- a/tests/api-resources/gpu-droplets/gpu-droplets.test.ts
+++ b/tests/api-resources/gpu-droplets/gpu-droplets.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/images/actions.test.ts b/tests/api-resources/gpu-droplets/images/actions.test.ts
index ea35d47..e6a849b 100644
--- a/tests/api-resources/gpu-droplets/images/actions.test.ts
+++ b/tests/api-resources/gpu-droplets/images/actions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/images/images.test.ts b/tests/api-resources/gpu-droplets/images/images.test.ts
index 808b2e2..5865610 100644
--- a/tests/api-resources/gpu-droplets/images/images.test.ts
+++ b/tests/api-resources/gpu-droplets/images/images.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/load-balancers/droplets.test.ts b/tests/api-resources/gpu-droplets/load-balancers/droplets.test.ts
index 231ddd4..eb8c4bb 100644
--- a/tests/api-resources/gpu-droplets/load-balancers/droplets.test.ts
+++ b/tests/api-resources/gpu-droplets/load-balancers/droplets.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/load-balancers/forwarding-rules.test.ts b/tests/api-resources/gpu-droplets/load-balancers/forwarding-rules.test.ts
index 07bf037..ed2a816 100644
--- a/tests/api-resources/gpu-droplets/load-balancers/forwarding-rules.test.ts
+++ b/tests/api-resources/gpu-droplets/load-balancers/forwarding-rules.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/load-balancers/load-balancers.test.ts b/tests/api-resources/gpu-droplets/load-balancers/load-balancers.test.ts
index 0278450..95b097a 100644
--- a/tests/api-resources/gpu-droplets/load-balancers/load-balancers.test.ts
+++ b/tests/api-resources/gpu-droplets/load-balancers/load-balancers.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/sizes.test.ts b/tests/api-resources/gpu-droplets/sizes.test.ts
index 0c50ec7..0fef610 100644
--- a/tests/api-resources/gpu-droplets/sizes.test.ts
+++ b/tests/api-resources/gpu-droplets/sizes.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/snapshots.test.ts b/tests/api-resources/gpu-droplets/snapshots.test.ts
index 7fa710a..a98ce15 100644
--- a/tests/api-resources/gpu-droplets/snapshots.test.ts
+++ b/tests/api-resources/gpu-droplets/snapshots.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/volumes/actions.test.ts b/tests/api-resources/gpu-droplets/volumes/actions.test.ts
index b649c72..bdb9765 100644
--- a/tests/api-resources/gpu-droplets/volumes/actions.test.ts
+++ b/tests/api-resources/gpu-droplets/volumes/actions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/volumes/snapshots.test.ts b/tests/api-resources/gpu-droplets/volumes/snapshots.test.ts
index 426e47f..852eb93 100644
--- a/tests/api-resources/gpu-droplets/volumes/snapshots.test.ts
+++ b/tests/api-resources/gpu-droplets/volumes/snapshots.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/gpu-droplets/volumes/volumes.test.ts b/tests/api-resources/gpu-droplets/volumes/volumes.test.ts
index 0906e41..f938c26 100644
--- a/tests/api-resources/gpu-droplets/volumes/volumes.test.ts
+++ b/tests/api-resources/gpu-droplets/volumes/volumes.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts
new file mode 100644
index 0000000..d728a2c
--- /dev/null
+++ b/tests/api-resources/images.test.ts
@@ -0,0 +1,42 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import Gradient from '@digitalocean/gradient';
+
+const client = new Gradient({
+ accessToken: 'My Access Token',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource images', () => {
+ // Prism tests are disabled
+ test.skip('generate: only required params', async () => {
+ const responsePromise = client.images.generate({
+ prompt: 'A cute baby sea otter floating on its back in calm blue water',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // Prism tests are disabled
+ test.skip('generate: required and optional params', async () => {
+ const response = await client.images.generate({
+ prompt: 'A cute baby sea otter floating on its back in calm blue water',
+ background: 'auto',
+ model: 'openai-gpt-image-1',
+ moderation: 'auto',
+ n: 1,
+ output_compression: 100,
+ output_format: 'png',
+ partial_images: 1,
+ quality: 'auto',
+ size: 'auto',
+ stream: false,
+ user: 'user-1234',
+ });
+ });
+});
diff --git a/tests/api-resources/inference/api-keys.test.ts b/tests/api-resources/inference/api-keys.test.ts
index 186c547..d12443c 100644
--- a/tests/api-resources/inference/api-keys.test.ts
+++ b/tests/api-resources/inference/api-keys.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/knowledge-bases/data-sources.test.ts b/tests/api-resources/knowledge-bases/data-sources.test.ts
index a5d77fa..e5c7517 100644
--- a/tests/api-resources/knowledge-bases/data-sources.test.ts
+++ b/tests/api-resources/knowledge-bases/data-sources.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
@@ -101,4 +99,27 @@ describe('resource dataSources', () => {
{ knowledge_base_uuid: '"123e4567-e89b-12d3-a456-426614174000"' },
);
});
+
+ // Prism tests are disabled
+ test.skip('createPresignedURLs', async () => {
+ const responsePromise = client.knowledgeBases.dataSources.createPresignedURLs();
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ // Prism tests are disabled
+ test.skip('createPresignedURLs: request options and params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ client.knowledgeBases.dataSources.createPresignedURLs(
+ { files: [{ file_name: 'example name', file_size: 'file_size' }] },
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(Gradient.NotFoundError);
+ });
});
diff --git a/tests/api-resources/knowledge-bases/indexing-jobs.test.ts b/tests/api-resources/knowledge-bases/indexing-jobs.test.ts
index ff34604..efac3a8 100644
--- a/tests/api-resources/knowledge-bases/indexing-jobs.test.ts
+++ b/tests/api-resources/knowledge-bases/indexing-jobs.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/knowledge-bases/knowledge-bases.test.ts b/tests/api-resources/knowledge-bases/knowledge-bases.test.ts
index d42e609..2735566 100644
--- a/tests/api-resources/knowledge-bases/knowledge-bases.test.ts
+++ b/tests/api-resources/knowledge-bases/knowledge-bases.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/models/models.test.ts b/tests/api-resources/models/models.test.ts
index 6fb2625..bffc2e5 100644
--- a/tests/api-resources/models/models.test.ts
+++ b/tests/api-resources/models/models.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/models/providers/anthropic.test.ts b/tests/api-resources/models/providers/anthropic.test.ts
index 08fdca4..10256b0 100644
--- a/tests/api-resources/models/providers/anthropic.test.ts
+++ b/tests/api-resources/models/providers/anthropic.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/models/providers/openai.test.ts b/tests/api-resources/models/providers/openai.test.ts
index 7b7c5f9..486c0e0 100644
--- a/tests/api-resources/models/providers/openai.test.ts
+++ b/tests/api-resources/models/providers/openai.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/api-resources/regions.test.ts b/tests/api-resources/regions.test.ts
index a624fde..60dfa5c 100644
--- a/tests/api-resources/regions.test.ts
+++ b/tests/api-resources/regions.test.ts
@@ -4,8 +4,6 @@ import Gradient from '@digitalocean/gradient';
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 47b737b..11828f9 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -24,8 +24,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
defaultHeaders: { 'X-My-Default-Header': '2' },
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
test('they are used in the request', async () => {
@@ -89,24 +87,14 @@ describe('instantiate client', () => {
error: jest.fn(),
};
- const client = new Gradient({
- logger: logger,
- logLevel: 'debug',
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, logLevel: 'debug', accessToken: 'My Access Token' });
await forceAPIResponseForClient(client);
expect(debugMock).toHaveBeenCalled();
});
test('default logLevel is warn', async () => {
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
expect(client.logLevel).toBe('warn');
});
@@ -119,13 +107,7 @@ describe('instantiate client', () => {
error: jest.fn(),
};
- const client = new Gradient({
- logger: logger,
- logLevel: 'info',
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, logLevel: 'info', accessToken: 'My Access Token' });
await forceAPIResponseForClient(client);
expect(debugMock).not.toHaveBeenCalled();
@@ -141,12 +123,7 @@ describe('instantiate client', () => {
};
process.env['GRADIENT_LOG'] = 'debug';
- const client = new Gradient({
- logger: logger,
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, accessToken: 'My Access Token' });
expect(client.logLevel).toBe('debug');
await forceAPIResponseForClient(client);
@@ -163,12 +140,7 @@ describe('instantiate client', () => {
};
process.env['GRADIENT_LOG'] = 'not a log level';
- const client = new Gradient({
- logger: logger,
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, accessToken: 'My Access Token' });
expect(client.logLevel).toBe('warn');
expect(warnMock).toHaveBeenCalledWith(
'process.env[\'GRADIENT_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]',
@@ -185,13 +157,7 @@ describe('instantiate client', () => {
};
process.env['GRADIENT_LOG'] = 'debug';
- const client = new Gradient({
- logger: logger,
- logLevel: 'off',
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, logLevel: 'off', accessToken: 'My Access Token' });
await forceAPIResponseForClient(client);
expect(debugMock).not.toHaveBeenCalled();
@@ -207,13 +173,7 @@ describe('instantiate client', () => {
};
process.env['GRADIENT_LOG'] = 'not a log level';
- const client = new Gradient({
- logger: logger,
- logLevel: 'debug',
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ logger: logger, logLevel: 'debug', accessToken: 'My Access Token' });
expect(client.logLevel).toBe('debug');
expect(warnMock).not.toHaveBeenCalled();
});
@@ -225,8 +185,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
defaultQuery: { apiVersion: 'foo' },
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo');
});
@@ -236,8 +194,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
defaultQuery: { apiVersion: 'foo', hello: 'world' },
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/foo?apiVersion=foo&hello=world');
});
@@ -247,8 +203,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
defaultQuery: { hello: 'world' },
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
expect(client.buildURL('/foo', { hello: undefined })).toEqual('http://localhost:5000/foo');
});
@@ -258,8 +212,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: 'http://localhost:5000/',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
fetch: (url) => {
return Promise.resolve(
new Response(JSON.stringify({ url, custom: true }), {
@@ -278,8 +230,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: 'http://localhost:5000/',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
fetch: defaultFetch,
});
});
@@ -288,8 +238,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
fetch: (...args) => {
return new Promise((resolve, reject) =>
setTimeout(
@@ -322,8 +270,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: 'http://localhost:5000/',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
fetch: testFetch,
});
@@ -336,8 +282,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: 'http://localhost:5000/custom/path/',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo');
});
@@ -346,8 +290,6 @@ describe('instantiate client', () => {
const client = new Gradient({
baseURL: 'http://localhost:5000/custom/path',
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
expect(client.buildURL('/foo', null)).toEqual('http://localhost:5000/custom/path/foo');
});
@@ -357,61 +299,35 @@ describe('instantiate client', () => {
});
test('explicit option', () => {
- const client = new Gradient({
- baseURL: 'https://example.com',
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ baseURL: 'https://example.com', accessToken: 'My Access Token' });
expect(client.baseURL).toEqual('https://example.com');
});
test('env variable', () => {
process.env['GRADIENT_BASE_URL'] = 'https://example.com/from_env';
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
expect(client.baseURL).toEqual('https://example.com/from_env');
});
test('empty env variable', () => {
process.env['GRADIENT_BASE_URL'] = ''; // empty
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
expect(client.baseURL).toEqual('https://api.digitalocean.com');
});
test('blank env variable', () => {
process.env['GRADIENT_BASE_URL'] = ' '; // blank
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
expect(client.baseURL).toEqual('https://api.digitalocean.com');
});
});
test('maxRetries option is correctly set', () => {
- const client = new Gradient({
- maxRetries: 4,
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ maxRetries: 4, accessToken: 'My Access Token' });
expect(client.maxRetries).toEqual(4);
// default
- const client2 = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client2 = new Gradient({ accessToken: 'My Access Token' });
expect(client2.maxRetries).toEqual(2);
});
@@ -421,8 +337,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
maxRetries: 3,
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
const newClient = client.withOptions({
@@ -449,8 +363,6 @@ describe('instantiate client', () => {
defaultHeaders: { 'X-Test-Header': 'test-value' },
defaultQuery: { 'test-param': 'test-value' },
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
const newClient = client.withOptions({
@@ -469,8 +381,6 @@ describe('instantiate client', () => {
baseURL: 'http://localhost:5000/',
timeout: 1000,
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
});
// Modify the client properties directly after creation
@@ -500,36 +410,20 @@ describe('instantiate client', () => {
test('with environment variable arguments', () => {
// set options via env var
process.env['DIGITALOCEAN_ACCESS_TOKEN'] = 'My Access Token';
- process.env['GRADIENT_MODEL_ACCESS_KEY'] = 'My Model Access Key';
- process.env['GRADIENT_AGENT_ACCESS_KEY'] = 'My Agent Access Key';
const client = new Gradient();
expect(client.accessToken).toBe('My Access Token');
- expect(client.modelAccessKey).toBe('My Model Access Key');
- expect(client.agentAccessKey).toBe('My Agent Access Key');
});
test('with overridden environment variable arguments', () => {
// set options via env var
process.env['DIGITALOCEAN_ACCESS_TOKEN'] = 'another My Access Token';
- process.env['GRADIENT_MODEL_ACCESS_KEY'] = 'another My Model Access Key';
- process.env['GRADIENT_AGENT_ACCESS_KEY'] = 'another My Agent Access Key';
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
expect(client.accessToken).toBe('My Access Token');
- expect(client.modelAccessKey).toBe('My Model Access Key');
- expect(client.agentAccessKey).toBe('My Agent Access Key');
});
});
describe('request building', () => {
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
describe('custom headers', () => {
test('handles undefined', async () => {
@@ -548,11 +442,7 @@ describe('request building', () => {
});
describe('default encoder', () => {
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- });
+ const client = new Gradient({ accessToken: 'My Access Token' });
class Serializable {
toJSON() {
@@ -637,13 +527,7 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- timeout: 10,
- fetch: testFetch,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', timeout: 10, fetch: testFetch });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
expect(count).toEqual(2);
@@ -673,13 +557,7 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- fetch: testFetch,
- maxRetries: 4,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
@@ -703,13 +581,7 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- fetch: testFetch,
- maxRetries: 4,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
expect(
await client.request({
@@ -740,8 +612,6 @@ describe('retries', () => {
};
const client = new Gradient({
accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
fetch: testFetch,
maxRetries: 4,
defaultHeaders: { 'X-Stainless-Retry-Count': null },
@@ -773,13 +643,7 @@ describe('retries', () => {
capturedRequest = init;
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- fetch: testFetch,
- maxRetries: 4,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
expect(
await client.request({
@@ -809,12 +673,7 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- fetch: testFetch,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', fetch: testFetch });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
expect(count).toEqual(2);
@@ -844,12 +703,7 @@ describe('retries', () => {
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
- const client = new Gradient({
- accessToken: 'My Access Token',
- modelAccessKey: 'My Model Access Key',
- agentAccessKey: 'My Agent Access Key',
- fetch: testFetch,
- });
+ const client = new Gradient({ accessToken: 'My Access Token', fetch: testFetch });
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
expect(count).toEqual(2);
diff --git a/tsconfig.build.json b/tsconfig.build.json
index 8b77c29..2a9e17f 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -5,8 +5,8 @@
"compilerOptions": {
"rootDir": "./dist/src",
"paths": {
- "@digitalocean/gradient/*": ["dist/src/*"],
- "@digitalocean/gradient": ["dist/src/index.ts"]
+ "@digitalocean/gradient/*": ["./dist/src/*"],
+ "@digitalocean/gradient": ["./dist/src/index.ts"]
},
"noEmit": false,
"declaration": true,
diff --git a/tsconfig.json b/tsconfig.json
index d47611b..217845d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,10 +7,9 @@
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
- "baseUrl": "./",
"paths": {
- "@digitalocean/gradient/*": ["src/*"],
- "@digitalocean/gradient": ["src/index.ts"]
+ "@digitalocean/gradient/*": ["./src/*"],
+ "@digitalocean/gradient": ["./src/index.ts"]
},
"noEmit": true,