vellum-ai 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +5 -2
- package/Client.js +43 -20
- package/api/resources/deployments/client/Client.d.ts +2 -2
- package/api/resources/deployments/client/Client.js +10 -4
- package/api/resources/documentIndexes/client/Client.d.ts +2 -2
- package/api/resources/documentIndexes/client/Client.js +7 -3
- package/api/resources/documents/client/Client.d.ts +2 -2
- package/api/resources/documents/client/Client.js +13 -5
- package/api/resources/folderEntities/client/Client.d.ts +31 -0
- package/api/resources/folderEntities/client/Client.js +106 -0
- package/api/resources/folderEntities/client/index.d.ts +1 -0
- package/api/resources/folderEntities/client/index.js +17 -0
- package/api/resources/folderEntities/client/requests/AddEntityToFolderRequest.d.ts +13 -0
- package/api/resources/folderEntities/client/requests/AddEntityToFolderRequest.js +5 -0
- package/api/resources/folderEntities/client/requests/index.d.ts +1 -0
- package/api/resources/folderEntities/client/requests/index.js +2 -0
- package/api/resources/folderEntities/index.d.ts +1 -0
- package/api/resources/folderEntities/index.js +17 -0
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/modelVersions/client/Client.d.ts +2 -2
- package/api/resources/modelVersions/client/Client.js +4 -2
- package/api/resources/registeredPrompts/client/Client.d.ts +2 -2
- package/api/resources/registeredPrompts/client/Client.js +4 -2
- package/api/resources/sandboxes/client/Client.d.ts +2 -2
- package/api/resources/sandboxes/client/Client.js +7 -3
- package/api/resources/testSuites/client/Client.d.ts +2 -2
- package/api/resources/testSuites/client/Client.js +7 -3
- package/api/resources/workflowDeployments/client/Client.d.ts +2 -2
- package/api/resources/workflowDeployments/client/Client.js +4 -2
- package/core/fetcher/Fetcher.js +8 -1
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/runtime/index.d.ts +1 -0
- package/core/runtime/index.js +5 -0
- package/core/runtime/runtime.d.ts +8 -0
- package/core/runtime/runtime.js +82 -0
- package/core/streaming-fetcher/Stream.d.ts +4 -0
- package/core/streaming-fetcher/Stream.js +63 -5
- package/dist/Client.d.ts +5 -2
- package/dist/Client.js +43 -20
- package/dist/api/resources/deployments/client/Client.d.ts +2 -2
- package/dist/api/resources/deployments/client/Client.js +10 -4
- package/dist/api/resources/documentIndexes/client/Client.d.ts +2 -2
- package/dist/api/resources/documentIndexes/client/Client.js +7 -3
- package/dist/api/resources/documents/client/Client.d.ts +2 -2
- package/dist/api/resources/documents/client/Client.js +13 -5
- package/dist/api/resources/folderEntities/client/Client.d.ts +31 -0
- package/dist/api/resources/folderEntities/client/Client.js +106 -0
- package/dist/api/resources/folderEntities/client/index.d.ts +1 -0
- package/dist/api/resources/folderEntities/client/index.js +17 -0
- package/dist/api/resources/folderEntities/client/requests/AddEntityToFolderRequest.d.ts +13 -0
- package/dist/api/resources/folderEntities/client/requests/AddEntityToFolderRequest.js +5 -0
- package/dist/api/resources/folderEntities/client/requests/index.d.ts +1 -0
- package/dist/api/resources/folderEntities/client/requests/index.js +2 -0
- package/dist/api/resources/folderEntities/index.d.ts +1 -0
- package/dist/api/resources/folderEntities/index.js +17 -0
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/modelVersions/client/Client.d.ts +2 -2
- package/dist/api/resources/modelVersions/client/Client.js +4 -2
- package/dist/api/resources/registeredPrompts/client/Client.d.ts +2 -2
- package/dist/api/resources/registeredPrompts/client/Client.js +4 -2
- package/dist/api/resources/sandboxes/client/Client.d.ts +2 -2
- package/dist/api/resources/sandboxes/client/Client.js +7 -3
- package/dist/api/resources/testSuites/client/Client.d.ts +2 -2
- package/dist/api/resources/testSuites/client/Client.js +7 -3
- package/dist/api/resources/workflowDeployments/client/Client.d.ts +2 -2
- package/dist/api/resources/workflowDeployments/client/Client.js +4 -2
- package/dist/core/fetcher/Fetcher.js +8 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/runtime/index.d.ts +1 -0
- package/dist/core/runtime/index.js +5 -0
- package/dist/core/runtime/runtime.d.ts +8 -0
- package/dist/core/runtime/runtime.js +82 -0
- package/dist/core/streaming-fetcher/Stream.d.ts +4 -0
- package/dist/core/streaming-fetcher/Stream.js +63 -5
- package/dist/serialization/resources/folderEntities/client/index.d.ts +1 -0
- package/dist/serialization/resources/folderEntities/client/index.js +17 -0
- package/dist/serialization/resources/folderEntities/client/requests/AddEntityToFolderRequest.d.ts +12 -0
- package/dist/serialization/resources/folderEntities/client/requests/AddEntityToFolderRequest.js +33 -0
- package/dist/serialization/resources/folderEntities/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/folderEntities/client/requests/index.js +5 -0
- package/dist/serialization/resources/folderEntities/index.d.ts +1 -0
- package/dist/serialization/resources/folderEntities/index.js +17 -0
- package/dist/serialization/resources/index.d.ts +2 -0
- package/dist/serialization/resources/index.js +3 -1
- package/jest.config.js +5 -0
- package/package.json +6 -2
- package/serialization/resources/folderEntities/client/index.d.ts +1 -0
- package/serialization/resources/folderEntities/client/index.js +17 -0
- package/serialization/resources/folderEntities/client/requests/AddEntityToFolderRequest.d.ts +12 -0
- package/serialization/resources/folderEntities/client/requests/AddEntityToFolderRequest.js +33 -0
- package/serialization/resources/folderEntities/client/requests/index.d.ts +1 -0
- package/serialization/resources/folderEntities/client/requests/index.js +5 -0
- package/serialization/resources/folderEntities/index.d.ts +1 -0
- package/serialization/resources/folderEntities/index.js +17 -0
- package/serialization/resources/index.d.ts +2 -0
- package/serialization/resources/index.js +3 -1
- package/tests/client.test.ts +11 -0
|
@@ -45,7 +45,7 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
45
45
|
const serializers = __importStar(require("../../../../serialization"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class ModelVersions {
|
|
48
|
-
constructor(_options) {
|
|
48
|
+
constructor(_options = {}) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -65,7 +65,9 @@ class ModelVersions {
|
|
|
65
65
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
66
66
|
"X-Fern-Language": "JavaScript",
|
|
67
67
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
68
|
-
"X-Fern-SDK-Version": "0.3.
|
|
68
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
69
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
70
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
69
71
|
},
|
|
70
72
|
contentType: "application/json",
|
|
71
73
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : undefined,
|
|
@@ -7,7 +7,7 @@ import * as Vellum from "../../..";
|
|
|
7
7
|
export declare namespace RegisteredPrompts {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.VellumEnvironment | environments.VellumEnvironmentUrls>;
|
|
10
|
-
apiKey
|
|
10
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
11
|
}
|
|
12
12
|
interface RequestOptions {
|
|
13
13
|
timeoutInSeconds?: number;
|
|
@@ -16,7 +16,7 @@ export declare namespace RegisteredPrompts {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class RegisteredPrompts {
|
|
18
18
|
protected readonly _options: RegisteredPrompts.Options;
|
|
19
|
-
constructor(_options
|
|
19
|
+
constructor(_options?: RegisteredPrompts.Options);
|
|
20
20
|
/**
|
|
21
21
|
* Registers a prompt within Vellum and creates associated Vellum entities. Intended to be used by integration
|
|
22
22
|
* partners, not directly by Vellum users.
|
|
@@ -46,7 +46,7 @@ const serializers = __importStar(require("../../../../serialization"));
|
|
|
46
46
|
const url_join_1 = __importDefault(require("url-join"));
|
|
47
47
|
const errors = __importStar(require("../../../../errors"));
|
|
48
48
|
class RegisteredPrompts {
|
|
49
|
-
constructor(_options) {
|
|
49
|
+
constructor(_options = {}) {
|
|
50
50
|
this._options = _options;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
@@ -96,7 +96,9 @@ class RegisteredPrompts {
|
|
|
96
96
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
97
97
|
"X-Fern-Language": "JavaScript",
|
|
98
98
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
99
|
-
"X-Fern-SDK-Version": "0.3.
|
|
99
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
100
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
101
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
100
102
|
},
|
|
101
103
|
contentType: "application/json",
|
|
102
104
|
body: yield serializers.RegisterPromptRequestRequest.jsonOrThrow(request, {
|
|
@@ -7,7 +7,7 @@ import * as Vellum from "../../..";
|
|
|
7
7
|
export declare namespace Sandboxes {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.VellumEnvironment | environments.VellumEnvironmentUrls>;
|
|
10
|
-
apiKey
|
|
10
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
11
|
}
|
|
12
12
|
interface RequestOptions {
|
|
13
13
|
timeoutInSeconds?: number;
|
|
@@ -16,7 +16,7 @@ export declare namespace Sandboxes {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class Sandboxes {
|
|
18
18
|
protected readonly _options: Sandboxes.Options;
|
|
19
|
-
constructor(_options
|
|
19
|
+
constructor(_options?: Sandboxes.Options);
|
|
20
20
|
/**
|
|
21
21
|
* Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
|
|
22
22
|
*
|
|
@@ -45,7 +45,7 @@ const serializers = __importStar(require("../../../../serialization"));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class Sandboxes {
|
|
48
|
-
constructor(_options) {
|
|
48
|
+
constructor(_options = {}) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -84,7 +84,9 @@ class Sandboxes {
|
|
|
84
84
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
85
85
|
"X-Fern-Language": "JavaScript",
|
|
86
86
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
87
|
-
"X-Fern-SDK-Version": "0.3.
|
|
87
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
88
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
89
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
88
90
|
},
|
|
89
91
|
contentType: "application/json",
|
|
90
92
|
body: yield serializers.UpsertSandboxScenarioRequestRequest.jsonOrThrow(request, {
|
|
@@ -139,7 +141,9 @@ class Sandboxes {
|
|
|
139
141
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
140
142
|
"X-Fern-Language": "JavaScript",
|
|
141
143
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
142
|
-
"X-Fern-SDK-Version": "0.3.
|
|
144
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
145
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
146
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
143
147
|
},
|
|
144
148
|
contentType: "application/json",
|
|
145
149
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : undefined,
|
|
@@ -7,7 +7,7 @@ import * as Vellum from "../../..";
|
|
|
7
7
|
export declare namespace TestSuites {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.VellumEnvironment | environments.VellumEnvironmentUrls>;
|
|
10
|
-
apiKey
|
|
10
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
11
|
}
|
|
12
12
|
interface RequestOptions {
|
|
13
13
|
timeoutInSeconds?: number;
|
|
@@ -16,7 +16,7 @@ export declare namespace TestSuites {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class TestSuites {
|
|
18
18
|
protected readonly _options: TestSuites.Options;
|
|
19
|
-
constructor(_options
|
|
19
|
+
constructor(_options?: TestSuites.Options);
|
|
20
20
|
/**
|
|
21
21
|
* Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
|
22
22
|
*
|
|
@@ -45,7 +45,7 @@ const serializers = __importStar(require("../../../../serialization"));
|
|
|
45
45
|
const url_join_1 = __importDefault(require("url-join"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class TestSuites {
|
|
48
|
-
constructor(_options) {
|
|
48
|
+
constructor(_options = {}) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
@@ -74,7 +74,9 @@ class TestSuites {
|
|
|
74
74
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
75
75
|
"X-Fern-Language": "JavaScript",
|
|
76
76
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
77
|
-
"X-Fern-SDK-Version": "0.3.
|
|
77
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
78
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
79
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
78
80
|
},
|
|
79
81
|
contentType: "application/json",
|
|
80
82
|
body: yield serializers.UpsertTestSuiteTestCaseRequest.jsonOrThrow(request, {
|
|
@@ -129,7 +131,9 @@ class TestSuites {
|
|
|
129
131
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
130
132
|
"X-Fern-Language": "JavaScript",
|
|
131
133
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
132
|
-
"X-Fern-SDK-Version": "0.3.
|
|
134
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
135
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
136
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
133
137
|
},
|
|
134
138
|
contentType: "application/json",
|
|
135
139
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : undefined,
|
|
@@ -7,7 +7,7 @@ import * as Vellum from "../../..";
|
|
|
7
7
|
export declare namespace WorkflowDeployments {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.VellumEnvironment | environments.VellumEnvironmentUrls>;
|
|
10
|
-
apiKey
|
|
10
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
11
|
}
|
|
12
12
|
interface RequestOptions {
|
|
13
13
|
timeoutInSeconds?: number;
|
|
@@ -16,6 +16,6 @@ export declare namespace WorkflowDeployments {
|
|
|
16
16
|
}
|
|
17
17
|
export declare class WorkflowDeployments {
|
|
18
18
|
protected readonly _options: WorkflowDeployments.Options;
|
|
19
|
-
constructor(_options
|
|
19
|
+
constructor(_options?: WorkflowDeployments.Options);
|
|
20
20
|
list(request?: Vellum.WorkflowDeploymentsListRequest, requestOptions?: WorkflowDeployments.RequestOptions): Promise<Vellum.PaginatedSlimWorkflowDeploymentList>;
|
|
21
21
|
}
|
|
@@ -45,7 +45,7 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
45
45
|
const serializers = __importStar(require("../../../../serialization"));
|
|
46
46
|
const errors = __importStar(require("../../../../errors"));
|
|
47
47
|
class WorkflowDeployments {
|
|
48
|
-
constructor(_options) {
|
|
48
|
+
constructor(_options = {}) {
|
|
49
49
|
this._options = _options;
|
|
50
50
|
}
|
|
51
51
|
list(request = {}, requestOptions) {
|
|
@@ -73,7 +73,9 @@ class WorkflowDeployments {
|
|
|
73
73
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
74
74
|
"X-Fern-Language": "JavaScript",
|
|
75
75
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
76
|
-
"X-Fern-SDK-Version": "0.3.
|
|
76
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
77
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
78
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
77
79
|
},
|
|
78
80
|
contentType: "application/json",
|
|
79
81
|
queryParameters: _queryParams,
|
package/core/fetcher/Fetcher.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.fetcher = void 0;
|
|
16
16
|
const form_data_1 = __importDefault(require("form-data"));
|
|
17
17
|
const qs_1 = __importDefault(require("qs"));
|
|
18
|
+
const runtime_1 = require("../runtime");
|
|
18
19
|
const INITIAL_RETRY_DELAY = 1;
|
|
19
20
|
const MAX_RETRY_DELAY = 60;
|
|
20
21
|
const DEFAULT_MAX_RETRIES = 2;
|
|
@@ -40,10 +41,16 @@ function fetcherImpl(args) {
|
|
|
40
41
|
// @ts-expect-error
|
|
41
42
|
body = args.body;
|
|
42
43
|
}
|
|
44
|
+
else if (args.body instanceof Uint8Array) {
|
|
45
|
+
body = args.body;
|
|
46
|
+
}
|
|
43
47
|
else {
|
|
44
48
|
body = JSON.stringify(args.body);
|
|
45
49
|
}
|
|
46
|
-
|
|
50
|
+
// In Node.js environments, the SDK always uses`node-fetch`.
|
|
51
|
+
// If not in Node.js the SDK uses global fetch if available,
|
|
52
|
+
// and falls back to node-fetch.
|
|
53
|
+
const fetchFn = runtime_1.RUNTIME.type === "node" ? require("node-fetch") : typeof fetch == "function" ? fetch : require("node-fetch");
|
|
47
54
|
const makeRequest = () => __awaiter(this, void 0, void 0, function* () {
|
|
48
55
|
const controller = new AbortController();
|
|
49
56
|
let abortId = undefined;
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -28,5 +28,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.serialization = void 0;
|
|
30
30
|
__exportStar(require("./fetcher"), exports);
|
|
31
|
+
__exportStar(require("./runtime"), exports);
|
|
31
32
|
__exportStar(require("./streaming-fetcher"), exports);
|
|
32
33
|
exports.serialization = __importStar(require("./schemas"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RUNTIME } from "./runtime";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
3
|
+
*/
|
|
4
|
+
export declare const RUNTIME: Runtime;
|
|
5
|
+
export interface Runtime {
|
|
6
|
+
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown";
|
|
7
|
+
version?: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RUNTIME = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
7
|
+
*/
|
|
8
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
9
|
+
/**
|
|
10
|
+
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
11
|
+
*/
|
|
12
|
+
const isWebWorker = typeof self === "object" &&
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === "function" &&
|
|
15
|
+
(((_a = self.constructor) === null || _a === void 0 ? void 0 : _a.name) === "DedicatedWorkerGlobalScope" ||
|
|
16
|
+
((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === "ServiceWorkerGlobalScope" ||
|
|
17
|
+
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === "SharedWorkerGlobalScope");
|
|
18
|
+
/**
|
|
19
|
+
* A constant that indicates whether the environment the code is running is Deno.
|
|
20
|
+
*/
|
|
21
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
22
|
+
/**
|
|
23
|
+
* A constant that indicates whether the environment the code is running is Bun.sh.
|
|
24
|
+
*/
|
|
25
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
26
|
+
/**
|
|
27
|
+
* A constant that indicates whether the environment the code is running is Node.JS.
|
|
28
|
+
*/
|
|
29
|
+
const isNode = typeof process !== "undefined" &&
|
|
30
|
+
Boolean(process.version) &&
|
|
31
|
+
Boolean((_d = process.versions) === null || _d === void 0 ? void 0 : _d.node) &&
|
|
32
|
+
// Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions
|
|
33
|
+
!isDeno &&
|
|
34
|
+
!isBun;
|
|
35
|
+
/**
|
|
36
|
+
* A constant that indicates whether the environment the code is running is in React-Native.
|
|
37
|
+
* https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
|
|
38
|
+
*/
|
|
39
|
+
const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === void 0 ? void 0 : navigator.product) === "ReactNative";
|
|
40
|
+
/**
|
|
41
|
+
* A constant that indicates which environment and version the SDK is running in.
|
|
42
|
+
*/
|
|
43
|
+
exports.RUNTIME = evaluateRuntime();
|
|
44
|
+
function evaluateRuntime() {
|
|
45
|
+
if (isBrowser) {
|
|
46
|
+
return {
|
|
47
|
+
type: "browser",
|
|
48
|
+
version: window.navigator.userAgent,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (isWebWorker) {
|
|
52
|
+
return {
|
|
53
|
+
type: "web-worker",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (isDeno) {
|
|
57
|
+
return {
|
|
58
|
+
type: "deno",
|
|
59
|
+
version: Deno.version.deno,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (isBun) {
|
|
63
|
+
return {
|
|
64
|
+
type: "bun",
|
|
65
|
+
version: Bun.version,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (isNode) {
|
|
69
|
+
return {
|
|
70
|
+
type: "node",
|
|
71
|
+
version: process.versions.node,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (isReactNative) {
|
|
75
|
+
return {
|
|
76
|
+
type: "react-native",
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
type: "unknown",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -13,3 +13,7 @@ export declare class Stream<T> implements AsyncIterable<T> {
|
|
|
13
13
|
private iterMessages;
|
|
14
14
|
[Symbol.asyncIterator](): AsyncIterator<T, void, unknown>;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Browser polyfill for ReadableStream
|
|
18
|
+
*/
|
|
19
|
+
export declare function readableStreamAsyncIterable<T>(stream: any): AsyncIterableIterator<T>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
12
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
13
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -19,7 +28,7 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
|
|
|
19
28
|
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
20
29
|
};
|
|
21
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.Stream = void 0;
|
|
31
|
+
exports.readableStreamAsyncIterable = exports.Stream = void 0;
|
|
23
32
|
class Stream {
|
|
24
33
|
constructor({ stream, parse, terminator, }) {
|
|
25
34
|
this.stream = stream;
|
|
@@ -29,11 +38,21 @@ class Stream {
|
|
|
29
38
|
iterMessages() {
|
|
30
39
|
return __asyncGenerator(this, arguments, function* iterMessages_1() {
|
|
31
40
|
var e_1, _a;
|
|
41
|
+
const decoder = new TextDecoder("utf8");
|
|
42
|
+
const stream = readableStreamAsyncIterable(this.stream);
|
|
32
43
|
let previous = "";
|
|
33
44
|
try {
|
|
34
|
-
for (var
|
|
35
|
-
const chunk =
|
|
36
|
-
|
|
45
|
+
for (var stream_1 = __asyncValues(stream), stream_1_1; stream_1_1 = yield __await(stream_1.next()), !stream_1_1.done;) {
|
|
46
|
+
const chunk = stream_1_1.value;
|
|
47
|
+
let bufferChunk = "";
|
|
48
|
+
// Buffer is present in Node.js environment
|
|
49
|
+
if (typeof Buffer !== "undefined") {
|
|
50
|
+
bufferChunk += Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
51
|
+
}
|
|
52
|
+
// TextDecoder is present in Browser environment
|
|
53
|
+
else if (typeof TextDecoder !== "undefined") {
|
|
54
|
+
bufferChunk += decoder.decode(chunk);
|
|
55
|
+
}
|
|
37
56
|
previous += bufferChunk;
|
|
38
57
|
let terminatorIndex;
|
|
39
58
|
while ((terminatorIndex = previous.indexOf(this.terminator)) >= 0) {
|
|
@@ -47,7 +66,7 @@ class Stream {
|
|
|
47
66
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
67
|
finally {
|
|
49
68
|
try {
|
|
50
|
-
if (
|
|
69
|
+
if (stream_1_1 && !stream_1_1.done && (_a = stream_1.return)) yield __await(_a.call(stream_1));
|
|
51
70
|
}
|
|
52
71
|
finally { if (e_1) throw e_1.error; }
|
|
53
72
|
}
|
|
@@ -73,3 +92,42 @@ class Stream {
|
|
|
73
92
|
}
|
|
74
93
|
}
|
|
75
94
|
exports.Stream = Stream;
|
|
95
|
+
/**
|
|
96
|
+
* Browser polyfill for ReadableStream
|
|
97
|
+
*/
|
|
98
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
|
+
function readableStreamAsyncIterable(stream) {
|
|
100
|
+
if (stream[Symbol.asyncIterator]) {
|
|
101
|
+
return stream;
|
|
102
|
+
}
|
|
103
|
+
const reader = stream.getReader();
|
|
104
|
+
return {
|
|
105
|
+
next() {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
try {
|
|
108
|
+
const result = yield reader.read();
|
|
109
|
+
if (result === null || result === void 0 ? void 0 : result.done) {
|
|
110
|
+
reader.releaseLock();
|
|
111
|
+
} // release lock when stream becomes closed
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
reader.releaseLock(); // release lock when stream becomes errored
|
|
116
|
+
throw e;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
return() {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const cancelPromise = reader.cancel();
|
|
123
|
+
reader.releaseLock();
|
|
124
|
+
yield cancelPromise;
|
|
125
|
+
return { done: true, value: undefined };
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
[Symbol.asyncIterator]() {
|
|
129
|
+
return this;
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
exports.readableStreamAsyncIterable = readableStreamAsyncIterable;
|
package/dist/Client.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import * as Vellum from "./api";
|
|
|
7
7
|
import { Deployments } from "./api/resources/deployments/client/Client";
|
|
8
8
|
import { DocumentIndexes } from "./api/resources/documentIndexes/client/Client";
|
|
9
9
|
import { Documents } from "./api/resources/documents/client/Client";
|
|
10
|
+
import { FolderEntities } from "./api/resources/folderEntities/client/Client";
|
|
10
11
|
import { ModelVersions } from "./api/resources/modelVersions/client/Client";
|
|
11
12
|
import { RegisteredPrompts } from "./api/resources/registeredPrompts/client/Client";
|
|
12
13
|
import { Sandboxes } from "./api/resources/sandboxes/client/Client";
|
|
@@ -15,7 +16,7 @@ import { WorkflowDeployments } from "./api/resources/workflowDeployments/client/
|
|
|
15
16
|
export declare namespace VellumClient {
|
|
16
17
|
interface Options {
|
|
17
18
|
environment?: core.Supplier<environments.VellumEnvironment | environments.VellumEnvironmentUrls>;
|
|
18
|
-
apiKey
|
|
19
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
19
20
|
}
|
|
20
21
|
interface RequestOptions {
|
|
21
22
|
timeoutInSeconds?: number;
|
|
@@ -24,7 +25,7 @@ export declare namespace VellumClient {
|
|
|
24
25
|
}
|
|
25
26
|
export declare class VellumClient {
|
|
26
27
|
protected readonly _options: VellumClient.Options;
|
|
27
|
-
constructor(_options
|
|
28
|
+
constructor(_options?: VellumClient.Options);
|
|
28
29
|
/**
|
|
29
30
|
* Executes a deployed Prompt and returns the result.
|
|
30
31
|
* @throws {@link Vellum.BadRequestError}
|
|
@@ -116,6 +117,8 @@ export declare class VellumClient {
|
|
|
116
117
|
get documentIndexes(): DocumentIndexes;
|
|
117
118
|
protected _documents: Documents | undefined;
|
|
118
119
|
get documents(): Documents;
|
|
120
|
+
protected _folderEntities: FolderEntities | undefined;
|
|
121
|
+
get folderEntities(): FolderEntities;
|
|
119
122
|
protected _modelVersions: ModelVersions | undefined;
|
|
120
123
|
get modelVersions(): ModelVersions;
|
|
121
124
|
protected _registeredPrompts: RegisteredPrompts | undefined;
|
package/dist/Client.js
CHANGED
|
@@ -48,13 +48,14 @@ const errors = __importStar(require("./errors"));
|
|
|
48
48
|
const Client_1 = require("./api/resources/deployments/client/Client");
|
|
49
49
|
const Client_2 = require("./api/resources/documentIndexes/client/Client");
|
|
50
50
|
const Client_3 = require("./api/resources/documents/client/Client");
|
|
51
|
-
const Client_4 = require("./api/resources/
|
|
52
|
-
const Client_5 = require("./api/resources/
|
|
53
|
-
const Client_6 = require("./api/resources/
|
|
54
|
-
const Client_7 = require("./api/resources/
|
|
55
|
-
const Client_8 = require("./api/resources/
|
|
51
|
+
const Client_4 = require("./api/resources/folderEntities/client/Client");
|
|
52
|
+
const Client_5 = require("./api/resources/modelVersions/client/Client");
|
|
53
|
+
const Client_6 = require("./api/resources/registeredPrompts/client/Client");
|
|
54
|
+
const Client_7 = require("./api/resources/sandboxes/client/Client");
|
|
55
|
+
const Client_8 = require("./api/resources/testSuites/client/Client");
|
|
56
|
+
const Client_9 = require("./api/resources/workflowDeployments/client/Client");
|
|
56
57
|
class VellumClient {
|
|
57
|
-
constructor(_options) {
|
|
58
|
+
constructor(_options = {}) {
|
|
58
59
|
this._options = _options;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -75,7 +76,9 @@ class VellumClient {
|
|
|
75
76
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
76
77
|
"X-Fern-Language": "JavaScript",
|
|
77
78
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
78
|
-
"X-Fern-SDK-Version": "0.3.
|
|
79
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
80
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
81
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
79
82
|
},
|
|
80
83
|
contentType: "application/json",
|
|
81
84
|
body: yield serializers.ExecutePromptRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -136,7 +139,9 @@ class VellumClient {
|
|
|
136
139
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
137
140
|
"X-Fern-Language": "JavaScript",
|
|
138
141
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
139
|
-
"X-Fern-SDK-Version": "0.3.
|
|
142
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
143
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
144
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
140
145
|
},
|
|
141
146
|
contentType: "application/json",
|
|
142
147
|
body: yield serializers.ExecutePromptStreamRequest.jsonOrThrow(request, {
|
|
@@ -209,7 +214,9 @@ class VellumClient {
|
|
|
209
214
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
210
215
|
"X-Fern-Language": "JavaScript",
|
|
211
216
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
212
|
-
"X-Fern-SDK-Version": "0.3.
|
|
217
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
218
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
219
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
213
220
|
},
|
|
214
221
|
contentType: "application/json",
|
|
215
222
|
body: yield serializers.ExecuteWorkflowRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -268,7 +275,9 @@ class VellumClient {
|
|
|
268
275
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
269
276
|
"X-Fern-Language": "JavaScript",
|
|
270
277
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
271
|
-
"X-Fern-SDK-Version": "0.3.
|
|
278
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
279
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
280
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
272
281
|
},
|
|
273
282
|
contentType: "application/json",
|
|
274
283
|
body: yield serializers.ExecuteWorkflowStreamRequest.jsonOrThrow(request, {
|
|
@@ -349,7 +358,9 @@ class VellumClient {
|
|
|
349
358
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
350
359
|
"X-Fern-Language": "JavaScript",
|
|
351
360
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
352
|
-
"X-Fern-SDK-Version": "0.3.
|
|
361
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
362
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
363
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
353
364
|
},
|
|
354
365
|
contentType: "application/json",
|
|
355
366
|
body: yield serializers.GenerateBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -412,7 +423,9 @@ class VellumClient {
|
|
|
412
423
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
413
424
|
"X-Fern-Language": "JavaScript",
|
|
414
425
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
415
|
-
"X-Fern-SDK-Version": "0.3.
|
|
426
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
427
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
428
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
416
429
|
},
|
|
417
430
|
contentType: "application/json",
|
|
418
431
|
body: yield serializers.GenerateStreamBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -490,7 +503,9 @@ class VellumClient {
|
|
|
490
503
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
491
504
|
"X-Fern-Language": "JavaScript",
|
|
492
505
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
493
|
-
"X-Fern-SDK-Version": "0.3.
|
|
506
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
507
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
508
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
494
509
|
},
|
|
495
510
|
contentType: "application/json",
|
|
496
511
|
body: yield serializers.SearchRequestBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -559,7 +574,9 @@ class VellumClient {
|
|
|
559
574
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
560
575
|
"X-Fern-Language": "JavaScript",
|
|
561
576
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
562
|
-
"X-Fern-SDK-Version": "0.3.
|
|
577
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
578
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
579
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
563
580
|
},
|
|
564
581
|
contentType: "application/json",
|
|
565
582
|
body: yield serializers.SubmitCompletionActualsRequest.jsonOrThrow(request, {
|
|
@@ -622,7 +639,9 @@ class VellumClient {
|
|
|
622
639
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
623
640
|
"X-Fern-Language": "JavaScript",
|
|
624
641
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
625
|
-
"X-Fern-SDK-Version": "0.3.
|
|
642
|
+
"X-Fern-SDK-Version": "0.3.7",
|
|
643
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
644
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
626
645
|
},
|
|
627
646
|
contentType: "application/json",
|
|
628
647
|
body: yield serializers.SubmitWorkflowExecutionActualsRequest.jsonOrThrow(request, {
|
|
@@ -667,25 +686,29 @@ class VellumClient {
|
|
|
667
686
|
var _a;
|
|
668
687
|
return ((_a = this._documents) !== null && _a !== void 0 ? _a : (this._documents = new Client_3.Documents(this._options)));
|
|
669
688
|
}
|
|
689
|
+
get folderEntities() {
|
|
690
|
+
var _a;
|
|
691
|
+
return ((_a = this._folderEntities) !== null && _a !== void 0 ? _a : (this._folderEntities = new Client_4.FolderEntities(this._options)));
|
|
692
|
+
}
|
|
670
693
|
get modelVersions() {
|
|
671
694
|
var _a;
|
|
672
|
-
return ((_a = this._modelVersions) !== null && _a !== void 0 ? _a : (this._modelVersions = new
|
|
695
|
+
return ((_a = this._modelVersions) !== null && _a !== void 0 ? _a : (this._modelVersions = new Client_5.ModelVersions(this._options)));
|
|
673
696
|
}
|
|
674
697
|
get registeredPrompts() {
|
|
675
698
|
var _a;
|
|
676
|
-
return ((_a = this._registeredPrompts) !== null && _a !== void 0 ? _a : (this._registeredPrompts = new
|
|
699
|
+
return ((_a = this._registeredPrompts) !== null && _a !== void 0 ? _a : (this._registeredPrompts = new Client_6.RegisteredPrompts(this._options)));
|
|
677
700
|
}
|
|
678
701
|
get sandboxes() {
|
|
679
702
|
var _a;
|
|
680
|
-
return ((_a = this._sandboxes) !== null && _a !== void 0 ? _a : (this._sandboxes = new
|
|
703
|
+
return ((_a = this._sandboxes) !== null && _a !== void 0 ? _a : (this._sandboxes = new Client_7.Sandboxes(this._options)));
|
|
681
704
|
}
|
|
682
705
|
get testSuites() {
|
|
683
706
|
var _a;
|
|
684
|
-
return ((_a = this._testSuites) !== null && _a !== void 0 ? _a : (this._testSuites = new
|
|
707
|
+
return ((_a = this._testSuites) !== null && _a !== void 0 ? _a : (this._testSuites = new Client_8.TestSuites(this._options)));
|
|
685
708
|
}
|
|
686
709
|
get workflowDeployments() {
|
|
687
710
|
var _a;
|
|
688
|
-
return ((_a = this._workflowDeployments) !== null && _a !== void 0 ? _a : (this._workflowDeployments = new
|
|
711
|
+
return ((_a = this._workflowDeployments) !== null && _a !== void 0 ? _a : (this._workflowDeployments = new Client_9.WorkflowDeployments(this._options)));
|
|
689
712
|
}
|
|
690
713
|
}
|
|
691
714
|
exports.VellumClient = VellumClient;
|