vellum-ai 0.3.4 → 0.3.6
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 -22
- package/Client.js +32 -31
- package/api/client/requests/GenerateBodyRequest.d.ts +3 -4
- package/api/client/requests/SearchRequestBodyRequest.d.ts +1 -11
- package/api/client/requests/SubmitCompletionActualsRequest.d.ts +1 -1
- package/api/resources/deployments/client/Client.d.ts +1 -1
- package/api/resources/deployments/client/Client.js +10 -4
- package/api/resources/deployments/client/requests/DeploymentsListRequest.d.ts +1 -3
- package/api/resources/documentIndexes/client/Client.d.ts +1 -3
- package/api/resources/documentIndexes/client/Client.js +7 -5
- package/api/resources/documentIndexes/client/requests/DocumentIndexCreateRequest.d.ts +0 -2
- package/api/resources/documents/client/Client.d.ts +1 -3
- package/api/resources/documents/client/Client.js +13 -7
- package/api/resources/documents/client/requests/PatchedDocumentUpdateRequest.d.ts +1 -3
- package/api/resources/modelVersions/client/Client.d.ts +1 -1
- package/api/resources/modelVersions/client/Client.js +4 -2
- package/api/resources/registeredPrompts/client/Client.d.ts +11 -6
- package/api/resources/registeredPrompts/client/Client.js +14 -7
- package/api/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +11 -6
- package/api/resources/sandboxes/client/Client.d.ts +4 -2
- package/api/resources/sandboxes/client/Client.js +10 -4
- package/api/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +2 -0
- package/api/resources/testSuites/client/Client.d.ts +2 -2
- package/api/resources/testSuites/client/Client.js +8 -4
- package/api/resources/workflowDeployments/client/Client.js +3 -1
- package/api/resources/workflowDeployments/client/requests/WorkflowDeploymentsListRequest.d.ts +1 -3
- 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 -22
- package/dist/Client.js +32 -31
- package/dist/api/client/requests/GenerateBodyRequest.d.ts +3 -4
- package/dist/api/client/requests/SearchRequestBodyRequest.d.ts +1 -11
- package/dist/api/client/requests/SubmitCompletionActualsRequest.d.ts +1 -1
- package/dist/api/resources/deployments/client/Client.d.ts +1 -1
- package/dist/api/resources/deployments/client/Client.js +10 -4
- package/dist/api/resources/deployments/client/requests/DeploymentsListRequest.d.ts +1 -3
- package/dist/api/resources/documentIndexes/client/Client.d.ts +1 -3
- package/dist/api/resources/documentIndexes/client/Client.js +7 -5
- package/dist/api/resources/documentIndexes/client/requests/DocumentIndexCreateRequest.d.ts +0 -2
- package/dist/api/resources/documents/client/Client.d.ts +1 -3
- package/dist/api/resources/documents/client/Client.js +13 -7
- package/dist/api/resources/documents/client/requests/PatchedDocumentUpdateRequest.d.ts +1 -3
- package/dist/api/resources/modelVersions/client/Client.d.ts +1 -1
- package/dist/api/resources/modelVersions/client/Client.js +4 -2
- package/dist/api/resources/registeredPrompts/client/Client.d.ts +11 -6
- package/dist/api/resources/registeredPrompts/client/Client.js +14 -7
- package/dist/api/resources/registeredPrompts/client/requests/RegisterPromptRequestRequest.d.ts +11 -6
- package/dist/api/resources/sandboxes/client/Client.d.ts +4 -2
- package/dist/api/resources/sandboxes/client/Client.js +10 -4
- package/dist/api/resources/sandboxes/client/requests/UpsertSandboxScenarioRequestRequest.d.ts +2 -0
- package/dist/api/resources/testSuites/client/Client.d.ts +2 -2
- package/dist/api/resources/testSuites/client/Client.js +8 -4
- package/dist/api/resources/workflowDeployments/client/Client.js +3 -1
- package/dist/api/resources/workflowDeployments/client/requests/WorkflowDeploymentsListRequest.d.ts +1 -3
- 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/jest.config.js +5 -0
- package/package.json +6 -2
- package/tests/client.test.ts +11 -0
|
@@ -58,7 +58,7 @@ class Sandboxes {
|
|
|
58
58
|
* or overwritten with default values.
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
|
-
* await vellum.sandboxes.upsertSandboxScenario("
|
|
61
|
+
* await vellum.sandboxes.upsertSandboxScenario("id", {
|
|
62
62
|
* label: "Scenario 1",
|
|
63
63
|
* inputs: [{
|
|
64
64
|
* key: "var_1",
|
|
@@ -68,6 +68,8 @@ class Sandboxes {
|
|
|
68
68
|
* key: "var_2",
|
|
69
69
|
* type: Vellum.ScenarioInputTypeEnum.Text,
|
|
70
70
|
* value: "Why hello, there!"
|
|
71
|
+
* }, {
|
|
72
|
+
* key: "key"
|
|
71
73
|
* }]
|
|
72
74
|
* })
|
|
73
75
|
*/
|
|
@@ -82,7 +84,9 @@ class Sandboxes {
|
|
|
82
84
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
83
85
|
"X-Fern-Language": "JavaScript",
|
|
84
86
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
85
|
-
"X-Fern-SDK-Version": "0.3.
|
|
87
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
88
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
89
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
86
90
|
},
|
|
87
91
|
contentType: "application/json",
|
|
88
92
|
body: yield serializers.UpsertSandboxScenarioRequestRequest.jsonOrThrow(request, {
|
|
@@ -124,7 +128,7 @@ class Sandboxes {
|
|
|
124
128
|
* Deletes an existing scenario from a sandbox, keying off of the provided scenario id.
|
|
125
129
|
*
|
|
126
130
|
* @example
|
|
127
|
-
* await vellum.sandboxes.deleteSandboxScenario("
|
|
131
|
+
* await vellum.sandboxes.deleteSandboxScenario("id", "scenario_id")
|
|
128
132
|
*/
|
|
129
133
|
deleteSandboxScenario(id, scenarioId, requestOptions) {
|
|
130
134
|
var _a;
|
|
@@ -137,7 +141,9 @@ class Sandboxes {
|
|
|
137
141
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
138
142
|
"X-Fern-Language": "JavaScript",
|
|
139
143
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
140
|
-
"X-Fern-SDK-Version": "0.3.
|
|
144
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
145
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
146
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
141
147
|
},
|
|
142
148
|
contentType: "application/json",
|
|
143
149
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : undefined,
|
|
@@ -27,7 +27,7 @@ export declare class TestSuites {
|
|
|
27
27
|
* or overwritten with default values.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
|
-
* await vellum.testSuites.upsertTestSuiteTestCase("
|
|
30
|
+
* await vellum.testSuites.upsertTestSuiteTestCase("id", {
|
|
31
31
|
* inputValues: [],
|
|
32
32
|
* evaluationValues: []
|
|
33
33
|
* })
|
|
@@ -37,7 +37,7 @@ export declare class TestSuites {
|
|
|
37
37
|
* Deletes an existing test case for a test suite, keying off of the test case id.
|
|
38
38
|
*
|
|
39
39
|
* @example
|
|
40
|
-
* await vellum.testSuites.deleteTestSuiteTestCase("
|
|
40
|
+
* await vellum.testSuites.deleteTestSuiteTestCase("id", "test_case_id")
|
|
41
41
|
*/
|
|
42
42
|
deleteTestSuiteTestCase(id: string, testCaseId: string, requestOptions?: TestSuites.RequestOptions): Promise<void>;
|
|
43
43
|
}
|
|
@@ -58,7 +58,7 @@ class TestSuites {
|
|
|
58
58
|
* or overwritten with default values.
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
|
-
* await vellum.testSuites.upsertTestSuiteTestCase("
|
|
61
|
+
* await vellum.testSuites.upsertTestSuiteTestCase("id", {
|
|
62
62
|
* inputValues: [],
|
|
63
63
|
* evaluationValues: []
|
|
64
64
|
* })
|
|
@@ -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.6",
|
|
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, {
|
|
@@ -116,7 +118,7 @@ class TestSuites {
|
|
|
116
118
|
* Deletes an existing test case for a test suite, keying off of the test case id.
|
|
117
119
|
*
|
|
118
120
|
* @example
|
|
119
|
-
* await vellum.testSuites.deleteTestSuiteTestCase("
|
|
121
|
+
* await vellum.testSuites.deleteTestSuiteTestCase("id", "test_case_id")
|
|
120
122
|
*/
|
|
121
123
|
deleteTestSuiteTestCase(id, testCaseId, requestOptions) {
|
|
122
124
|
var _a;
|
|
@@ -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.6",
|
|
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,
|
|
@@ -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.6",
|
|
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
|
@@ -27,9 +27,6 @@ export declare class VellumClient {
|
|
|
27
27
|
constructor(_options: VellumClient.Options);
|
|
28
28
|
/**
|
|
29
29
|
* Executes a deployed Prompt and returns the result.
|
|
30
|
-
*
|
|
31
|
-
* Note: This endpoint temporarily does not support prompts with function calling, support is coming soon.
|
|
32
|
-
* In the meantime, we recommend still using the `/generate` endpoint for prompts with function calling.
|
|
33
30
|
* @throws {@link Vellum.BadRequestError}
|
|
34
31
|
* @throws {@link Vellum.ForbiddenError}
|
|
35
32
|
* @throws {@link Vellum.NotFoundError}
|
|
@@ -38,9 +35,6 @@ export declare class VellumClient {
|
|
|
38
35
|
executePrompt(request: Vellum.ExecutePromptRequest, requestOptions?: VellumClient.RequestOptions): Promise<Vellum.ExecutePromptResponse>;
|
|
39
36
|
/**
|
|
40
37
|
* Executes a deployed Prompt and streams back the results.
|
|
41
|
-
*
|
|
42
|
-
* Note: This endpoint temporarily does not support prompts with function calling, support is coming soon.
|
|
43
|
-
* In the meantime, we recommend still using the `/generate-stream` endpoint for prompts with function calling
|
|
44
38
|
*/
|
|
45
39
|
executePromptStream(request: Vellum.ExecutePromptStreamRequest, requestOptions?: VellumClient.RequestOptions): Promise<core.Stream<Vellum.ExecutePromptEvent>>;
|
|
46
40
|
/**
|
|
@@ -65,10 +59,9 @@ export declare class VellumClient {
|
|
|
65
59
|
*
|
|
66
60
|
* @example
|
|
67
61
|
* await vellum.generate({
|
|
68
|
-
* requests: [
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* }
|
|
62
|
+
* requests: [{
|
|
63
|
+
* inputValues: {}
|
|
64
|
+
* }]
|
|
72
65
|
* })
|
|
73
66
|
*/
|
|
74
67
|
generate(request: Vellum.GenerateBodyRequest, requestOptions?: VellumClient.RequestOptions): Promise<Vellum.GenerateResponse>;
|
|
@@ -88,17 +81,7 @@ export declare class VellumClient {
|
|
|
88
81
|
*
|
|
89
82
|
* @example
|
|
90
83
|
* await vellum.search({
|
|
91
|
-
* query: "
|
|
92
|
-
* options: {
|
|
93
|
-
* weights: {},
|
|
94
|
-
* resultMerging: {},
|
|
95
|
-
* filters: {
|
|
96
|
-
* metadata: {
|
|
97
|
-
* combinator: Vellum.MetadataFilterRuleCombinator.And,
|
|
98
|
-
* operator: Vellum.LogicalOperator.Equals
|
|
99
|
-
* }
|
|
100
|
-
* }
|
|
101
|
-
* }
|
|
84
|
+
* query: "query"
|
|
102
85
|
* })
|
|
103
86
|
*/
|
|
104
87
|
search(request: Vellum.SearchRequestBodyRequest, requestOptions?: VellumClient.RequestOptions): Promise<Vellum.SearchResponse>;
|
|
@@ -112,7 +95,7 @@ export declare class VellumClient {
|
|
|
112
95
|
*
|
|
113
96
|
* @example
|
|
114
97
|
* await vellum.submitCompletionActuals({
|
|
115
|
-
* actuals: []
|
|
98
|
+
* actuals: [{}]
|
|
116
99
|
* })
|
|
117
100
|
*/
|
|
118
101
|
submitCompletionActuals(request: Vellum.SubmitCompletionActualsRequest, requestOptions?: VellumClient.RequestOptions): Promise<void>;
|
package/dist/Client.js
CHANGED
|
@@ -59,9 +59,6 @@ class VellumClient {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* Executes a deployed Prompt and returns the result.
|
|
62
|
-
*
|
|
63
|
-
* Note: This endpoint temporarily does not support prompts with function calling, support is coming soon.
|
|
64
|
-
* In the meantime, we recommend still using the `/generate` endpoint for prompts with function calling.
|
|
65
62
|
* @throws {@link Vellum.BadRequestError}
|
|
66
63
|
* @throws {@link Vellum.ForbiddenError}
|
|
67
64
|
* @throws {@link Vellum.NotFoundError}
|
|
@@ -78,7 +75,9 @@ class VellumClient {
|
|
|
78
75
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
79
76
|
"X-Fern-Language": "JavaScript",
|
|
80
77
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
81
|
-
"X-Fern-SDK-Version": "0.3.
|
|
78
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
79
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
80
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
82
81
|
},
|
|
83
82
|
contentType: "application/json",
|
|
84
83
|
body: yield serializers.ExecutePromptRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -127,9 +126,6 @@ class VellumClient {
|
|
|
127
126
|
}
|
|
128
127
|
/**
|
|
129
128
|
* Executes a deployed Prompt and streams back the results.
|
|
130
|
-
*
|
|
131
|
-
* Note: This endpoint temporarily does not support prompts with function calling, support is coming soon.
|
|
132
|
-
* In the meantime, we recommend still using the `/generate-stream` endpoint for prompts with function calling
|
|
133
129
|
*/
|
|
134
130
|
executePromptStream(request, requestOptions) {
|
|
135
131
|
var _a;
|
|
@@ -142,7 +138,9 @@ class VellumClient {
|
|
|
142
138
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
143
139
|
"X-Fern-Language": "JavaScript",
|
|
144
140
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
145
|
-
"X-Fern-SDK-Version": "0.3.
|
|
141
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
142
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
143
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
146
144
|
},
|
|
147
145
|
contentType: "application/json",
|
|
148
146
|
body: yield serializers.ExecutePromptStreamRequest.jsonOrThrow(request, {
|
|
@@ -215,7 +213,9 @@ class VellumClient {
|
|
|
215
213
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
216
214
|
"X-Fern-Language": "JavaScript",
|
|
217
215
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
218
|
-
"X-Fern-SDK-Version": "0.3.
|
|
216
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
217
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
218
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
219
219
|
},
|
|
220
220
|
contentType: "application/json",
|
|
221
221
|
body: yield serializers.ExecuteWorkflowRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -274,7 +274,9 @@ class VellumClient {
|
|
|
274
274
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
275
275
|
"X-Fern-Language": "JavaScript",
|
|
276
276
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
277
|
-
"X-Fern-SDK-Version": "0.3.
|
|
277
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
278
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
279
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
278
280
|
},
|
|
279
281
|
contentType: "application/json",
|
|
280
282
|
body: yield serializers.ExecuteWorkflowStreamRequest.jsonOrThrow(request, {
|
|
@@ -339,10 +341,9 @@ class VellumClient {
|
|
|
339
341
|
*
|
|
340
342
|
* @example
|
|
341
343
|
* await vellum.generate({
|
|
342
|
-
* requests: [
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* }
|
|
344
|
+
* requests: [{
|
|
345
|
+
* inputValues: {}
|
|
346
|
+
* }]
|
|
346
347
|
* })
|
|
347
348
|
*/
|
|
348
349
|
generate(request, requestOptions) {
|
|
@@ -356,7 +357,9 @@ class VellumClient {
|
|
|
356
357
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
357
358
|
"X-Fern-Language": "JavaScript",
|
|
358
359
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
359
|
-
"X-Fern-SDK-Version": "0.3.
|
|
360
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
361
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
362
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
360
363
|
},
|
|
361
364
|
contentType: "application/json",
|
|
362
365
|
body: yield serializers.GenerateBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -419,7 +422,9 @@ class VellumClient {
|
|
|
419
422
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
420
423
|
"X-Fern-Language": "JavaScript",
|
|
421
424
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
422
|
-
"X-Fern-SDK-Version": "0.3.
|
|
425
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
426
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
427
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
423
428
|
},
|
|
424
429
|
contentType: "application/json",
|
|
425
430
|
body: yield serializers.GenerateStreamBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -483,17 +488,7 @@ class VellumClient {
|
|
|
483
488
|
*
|
|
484
489
|
* @example
|
|
485
490
|
* await vellum.search({
|
|
486
|
-
* query: "
|
|
487
|
-
* options: {
|
|
488
|
-
* weights: {},
|
|
489
|
-
* resultMerging: {},
|
|
490
|
-
* filters: {
|
|
491
|
-
* metadata: {
|
|
492
|
-
* combinator: Vellum.MetadataFilterRuleCombinator.And,
|
|
493
|
-
* operator: Vellum.LogicalOperator.Equals
|
|
494
|
-
* }
|
|
495
|
-
* }
|
|
496
|
-
* }
|
|
491
|
+
* query: "query"
|
|
497
492
|
* })
|
|
498
493
|
*/
|
|
499
494
|
search(request, requestOptions) {
|
|
@@ -507,7 +502,9 @@ class VellumClient {
|
|
|
507
502
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
508
503
|
"X-Fern-Language": "JavaScript",
|
|
509
504
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
510
|
-
"X-Fern-SDK-Version": "0.3.
|
|
505
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
506
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
507
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
511
508
|
},
|
|
512
509
|
contentType: "application/json",
|
|
513
510
|
body: yield serializers.SearchRequestBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -562,7 +559,7 @@ class VellumClient {
|
|
|
562
559
|
*
|
|
563
560
|
* @example
|
|
564
561
|
* await vellum.submitCompletionActuals({
|
|
565
|
-
* actuals: []
|
|
562
|
+
* actuals: [{}]
|
|
566
563
|
* })
|
|
567
564
|
*/
|
|
568
565
|
submitCompletionActuals(request, requestOptions) {
|
|
@@ -576,7 +573,9 @@ class VellumClient {
|
|
|
576
573
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
577
574
|
"X-Fern-Language": "JavaScript",
|
|
578
575
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
579
|
-
"X-Fern-SDK-Version": "0.3.
|
|
576
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
577
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
578
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
580
579
|
},
|
|
581
580
|
contentType: "application/json",
|
|
582
581
|
body: yield serializers.SubmitCompletionActualsRequest.jsonOrThrow(request, {
|
|
@@ -639,7 +638,9 @@ class VellumClient {
|
|
|
639
638
|
X_API_KEY: yield core.Supplier.get(this._options.apiKey),
|
|
640
639
|
"X-Fern-Language": "JavaScript",
|
|
641
640
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
642
|
-
"X-Fern-SDK-Version": "0.3.
|
|
641
|
+
"X-Fern-SDK-Version": "0.3.6",
|
|
642
|
+
"X-Fern-Runtime": core.RUNTIME.type,
|
|
643
|
+
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
643
644
|
},
|
|
644
645
|
contentType: "application/json",
|
|
645
646
|
body: yield serializers.SubmitWorkflowExecutionActualsRequest.jsonOrThrow(request, {
|
|
@@ -5,17 +5,7 @@ import * as Vellum from "../..";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* query: "
|
|
9
|
-
* options: {
|
|
10
|
-
* weights: {},
|
|
11
|
-
* resultMerging: {},
|
|
12
|
-
* filters: {
|
|
13
|
-
* metadata: {
|
|
14
|
-
* combinator: Vellum.MetadataFilterRuleCombinator.And,
|
|
15
|
-
* operator: Vellum.LogicalOperator.Equals
|
|
16
|
-
* }
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
8
|
+
* query: "query"
|
|
19
9
|
* }
|
|
20
10
|
*/
|
|
21
11
|
export interface SearchRequestBodyRequest {
|