vellum-ai 0.0.10 → 0.0.11
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 +36 -0
- package/Client.js +102 -12
- package/api/client/requests/index.d.ts +0 -1
- package/api/errors/BadRequestError.d.ts +7 -0
- package/api/errors/BadRequestError.js +41 -0
- package/api/errors/InternalServerError.d.ts +7 -0
- package/api/errors/InternalServerError.js +41 -0
- package/api/errors/NotFoundError.d.ts +7 -0
- package/api/errors/NotFoundError.js +41 -0
- package/api/errors/index.d.ts +3 -0
- package/api/errors/index.js +19 -0
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/api/resources/documents/client/Client.d.ts +17 -0
- package/api/resources/documents/client/Client.js +31 -4
- package/api/resources/documents/client/requests/DocumentsListRequest.d.ts +12 -0
- package/api/resources/modelVersions/client/Client.d.ts +7 -0
- package/api/resources/modelVersions/client/Client.js +7 -0
- package/api/resources/sandboxes/client/Client.d.ts +11 -0
- package/api/resources/sandboxes/client/Client.js +11 -0
- package/api/resources/testSuites/client/Client.d.ts +11 -0
- package/api/resources/testSuites/client/Client.js +11 -0
- package/api/{client/requests → types}/GenerateBodyRequest.d.ts +1 -1
- package/api/types/GenerateStreamResponse.d.ts +7 -0
- package/api/types/GenerateStreamResult.d.ts +9 -0
- package/api/types/GenerateStreamResult.js +5 -0
- package/api/types/GenerateStreamResultData.d.ts +8 -0
- package/api/types/GenerateStreamResultData.js +5 -0
- package/api/types/index.d.ts +4 -0
- package/api/types/index.js +4 -0
- package/core/callback-queue/CallbackQueue.d.ts +6 -0
- package/core/callback-queue/CallbackQueue.js +20 -0
- package/core/callback-queue/index.d.ts +1 -0
- package/core/callback-queue/index.js +5 -0
- package/core/index.d.ts +2 -0
- package/core/index.js +2 -0
- package/core/streaming-fetcher/StreamingFetcher.d.ts +22 -0
- package/core/streaming-fetcher/StreamingFetcher.js +64 -0
- package/core/streaming-fetcher/index.d.ts +1 -0
- package/core/streaming-fetcher/index.js +5 -0
- package/dist/Client.d.ts +36 -0
- package/dist/Client.js +102 -12
- package/dist/api/client/requests/index.d.ts +0 -1
- package/dist/api/errors/BadRequestError.d.ts +7 -0
- package/dist/api/errors/BadRequestError.js +41 -0
- package/dist/api/errors/InternalServerError.d.ts +7 -0
- package/dist/api/errors/InternalServerError.js +41 -0
- package/dist/api/errors/NotFoundError.d.ts +7 -0
- package/dist/api/errors/NotFoundError.js +41 -0
- package/dist/api/errors/index.d.ts +3 -0
- package/dist/api/errors/index.js +19 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/resources/documents/client/Client.d.ts +17 -0
- package/dist/api/resources/documents/client/Client.js +31 -4
- package/dist/api/resources/documents/client/requests/DocumentsListRequest.d.ts +12 -0
- package/dist/api/resources/modelVersions/client/Client.d.ts +7 -0
- package/dist/api/resources/modelVersions/client/Client.js +7 -0
- package/dist/api/resources/sandboxes/client/Client.d.ts +11 -0
- package/dist/api/resources/sandboxes/client/Client.js +11 -0
- package/dist/api/resources/testSuites/client/Client.d.ts +11 -0
- package/dist/api/resources/testSuites/client/Client.js +11 -0
- package/dist/api/{client/requests → types}/GenerateBodyRequest.d.ts +1 -1
- package/dist/api/types/GenerateBodyRequest.js +5 -0
- package/dist/api/types/GenerateStreamResponse.d.ts +7 -0
- package/dist/api/types/GenerateStreamResponse.js +5 -0
- package/dist/api/types/GenerateStreamResult.d.ts +9 -0
- package/dist/api/types/GenerateStreamResult.js +5 -0
- package/dist/api/types/GenerateStreamResultData.d.ts +8 -0
- package/dist/api/types/GenerateStreamResultData.js +5 -0
- package/dist/api/types/index.d.ts +4 -0
- package/dist/api/types/index.js +4 -0
- package/dist/core/callback-queue/CallbackQueue.d.ts +6 -0
- package/dist/core/callback-queue/CallbackQueue.js +20 -0
- package/dist/core/callback-queue/index.d.ts +1 -0
- package/dist/core/callback-queue/index.js +5 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/streaming-fetcher/StreamingFetcher.d.ts +22 -0
- package/dist/core/streaming-fetcher/StreamingFetcher.js +64 -0
- package/dist/core/streaming-fetcher/index.d.ts +1 -0
- package/dist/core/streaming-fetcher/index.js +5 -0
- package/dist/serialization/client/requests/index.d.ts +0 -1
- package/dist/serialization/client/requests/index.js +1 -3
- package/dist/serialization/{client/requests → types}/GenerateBodyRequest.d.ts +4 -4
- package/dist/serialization/{client/requests → types}/GenerateBodyRequest.js +3 -3
- package/dist/serialization/types/GenerateStreamResponse.d.ts +12 -0
- package/dist/serialization/types/GenerateStreamResponse.js +33 -0
- package/dist/serialization/types/GenerateStreamResult.d.ts +14 -0
- package/dist/serialization/types/GenerateStreamResult.js +35 -0
- package/dist/serialization/types/GenerateStreamResultData.d.ts +13 -0
- package/dist/serialization/types/GenerateStreamResultData.js +34 -0
- package/dist/serialization/types/index.d.ts +4 -0
- package/dist/serialization/types/index.js +4 -0
- package/package.json +1 -1
- package/serialization/client/requests/index.d.ts +0 -1
- package/serialization/client/requests/index.js +1 -3
- package/serialization/{client/requests → types}/GenerateBodyRequest.d.ts +4 -4
- package/serialization/{client/requests → types}/GenerateBodyRequest.js +3 -3
- package/serialization/types/GenerateStreamResponse.d.ts +12 -0
- package/serialization/types/GenerateStreamResponse.js +33 -0
- package/serialization/types/GenerateStreamResult.d.ts +14 -0
- package/serialization/types/GenerateStreamResult.js +35 -0
- package/serialization/types/GenerateStreamResultData.d.ts +13 -0
- package/serialization/types/GenerateStreamResultData.js +34 -0
- package/serialization/types/index.d.ts +4 -0
- package/serialization/types/index.js +4 -0
- /package/api/{client/requests → types}/GenerateBodyRequest.js +0 -0
- /package/{dist/api/client/requests/GenerateBodyRequest.js → api/types/GenerateStreamResponse.js} +0 -0
package/Client.d.ts
CHANGED
|
@@ -17,8 +17,44 @@ export declare namespace VellumClient {
|
|
|
17
17
|
export declare class VellumClient {
|
|
18
18
|
protected readonly options: VellumClient.Options;
|
|
19
19
|
constructor(options: VellumClient.Options);
|
|
20
|
+
/**
|
|
21
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
22
|
+
*
|
|
23
|
+
* Generate a completion using a previously defined deployment.
|
|
24
|
+
*
|
|
25
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
26
|
+
* @throws {Vellum.BadRequestError}
|
|
27
|
+
* @throws {Vellum.NotFoundError}
|
|
28
|
+
* @throws {Vellum.InternalServerError}
|
|
29
|
+
*/
|
|
20
30
|
generate(request: Vellum.GenerateBodyRequest): Promise<Vellum.GenerateResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* @throws {Vellum.BadRequestError}
|
|
33
|
+
* @throws {Vellum.NotFoundError}
|
|
34
|
+
* @throws {Vellum.InternalServerError}
|
|
35
|
+
*/
|
|
36
|
+
generateStream(request: Vellum.GenerateBodyRequest, cb: (data: Vellum.GenerateStreamResponse) => void, opts?: Pick<core.StreamingFetcher.Args, "onError" | "onFinish" | "abortController" | "timeoutMs">): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
39
|
+
*
|
|
40
|
+
* Perform a search against a document index.
|
|
41
|
+
*
|
|
42
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
43
|
+
* @throws {Vellum.BadRequestError}
|
|
44
|
+
* @throws {Vellum.NotFoundError}
|
|
45
|
+
* @throws {Vellum.InternalServerError}
|
|
46
|
+
*/
|
|
21
47
|
search(request: Vellum.SearchRequestBodyRequest): Promise<Vellum.SearchResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
50
|
+
*
|
|
51
|
+
* Used to submit feedback regarding the quality of previously generated completions.
|
|
52
|
+
*
|
|
53
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
54
|
+
* @throws {Vellum.BadRequestError}
|
|
55
|
+
* @throws {Vellum.NotFoundError}
|
|
56
|
+
* @throws {Vellum.InternalServerError}
|
|
57
|
+
*/
|
|
22
58
|
submitCompletionActuals(request: Vellum.SubmitCompletionActualsRequest): Promise<void>;
|
|
23
59
|
protected _documents: Documents | undefined;
|
|
24
60
|
get documents(): Documents;
|
package/Client.js
CHANGED
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.VellumClient = void 0;
|
|
33
33
|
const environments = __importStar(require("./environments"));
|
|
34
34
|
const core = __importStar(require("./core"));
|
|
35
|
+
const Vellum = __importStar(require("./api"));
|
|
35
36
|
const url_join_1 = __importDefault(require("url-join"));
|
|
36
37
|
const serializers = __importStar(require("./serialization"));
|
|
37
38
|
const errors = __importStar(require("./errors"));
|
|
@@ -44,6 +45,16 @@ class VellumClient {
|
|
|
44
45
|
constructor(options) {
|
|
45
46
|
this.options = options;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
50
|
+
*
|
|
51
|
+
* Generate a completion using a previously defined deployment.
|
|
52
|
+
*
|
|
53
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
54
|
+
* @throws {Vellum.BadRequestError}
|
|
55
|
+
* @throws {Vellum.NotFoundError}
|
|
56
|
+
* @throws {Vellum.InternalServerError}
|
|
57
|
+
*/
|
|
47
58
|
async generate(request) {
|
|
48
59
|
const _response = await core.fetcher({
|
|
49
60
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/generate"),
|
|
@@ -62,10 +73,19 @@ class VellumClient {
|
|
|
62
73
|
});
|
|
63
74
|
}
|
|
64
75
|
if (_response.error.reason === "status-code") {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
switch (_response.error.statusCode) {
|
|
77
|
+
case 400:
|
|
78
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
79
|
+
case 404:
|
|
80
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
81
|
+
case 500:
|
|
82
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
83
|
+
default:
|
|
84
|
+
throw new errors.VellumError({
|
|
85
|
+
statusCode: _response.error.statusCode,
|
|
86
|
+
body: _response.error.body,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
69
89
|
}
|
|
70
90
|
switch (_response.error.reason) {
|
|
71
91
|
case "non-json":
|
|
@@ -81,6 +101,48 @@ class VellumClient {
|
|
|
81
101
|
});
|
|
82
102
|
}
|
|
83
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* @throws {Vellum.BadRequestError}
|
|
106
|
+
* @throws {Vellum.NotFoundError}
|
|
107
|
+
* @throws {Vellum.InternalServerError}
|
|
108
|
+
*/
|
|
109
|
+
async generateStream(request, cb, opts) {
|
|
110
|
+
const _queue = new core.CallbackQueue();
|
|
111
|
+
await core.streamingFetcher({
|
|
112
|
+
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, "v1/generate-stream"),
|
|
113
|
+
method: "POST",
|
|
114
|
+
headers: {
|
|
115
|
+
X_API_KEY: await core.Supplier.get(this.options.apiKey),
|
|
116
|
+
},
|
|
117
|
+
body: await serializers.GenerateBodyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
118
|
+
onData: _queue.wrap(async (data) => {
|
|
119
|
+
const parsed = await serializers.GenerateStreamResponse.parse(data, {
|
|
120
|
+
unrecognizedObjectKeys: "passthrough",
|
|
121
|
+
allowUnrecognizedUnionMembers: true,
|
|
122
|
+
allowUnrecognizedEnumValues: true,
|
|
123
|
+
});
|
|
124
|
+
if (parsed.ok) {
|
|
125
|
+
cb(parsed.value);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
opts?.onError?.(parsed.errors);
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
onError: opts?.onError != null ? _queue.wrap(opts.onError) : undefined,
|
|
132
|
+
onFinish: opts?.onFinish != null ? _queue.wrap(opts.onFinish) : undefined,
|
|
133
|
+
abortController: opts?.abortController,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
138
|
+
*
|
|
139
|
+
* Perform a search against a document index.
|
|
140
|
+
*
|
|
141
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
142
|
+
* @throws {Vellum.BadRequestError}
|
|
143
|
+
* @throws {Vellum.NotFoundError}
|
|
144
|
+
* @throws {Vellum.InternalServerError}
|
|
145
|
+
*/
|
|
84
146
|
async search(request) {
|
|
85
147
|
const _response = await core.fetcher({
|
|
86
148
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/search"),
|
|
@@ -99,10 +161,19 @@ class VellumClient {
|
|
|
99
161
|
});
|
|
100
162
|
}
|
|
101
163
|
if (_response.error.reason === "status-code") {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
164
|
+
switch (_response.error.statusCode) {
|
|
165
|
+
case 400:
|
|
166
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
167
|
+
case 404:
|
|
168
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
169
|
+
case 500:
|
|
170
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
171
|
+
default:
|
|
172
|
+
throw new errors.VellumError({
|
|
173
|
+
statusCode: _response.error.statusCode,
|
|
174
|
+
body: _response.error.body,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
106
177
|
}
|
|
107
178
|
switch (_response.error.reason) {
|
|
108
179
|
case "non-json":
|
|
@@ -118,6 +189,16 @@ class VellumClient {
|
|
|
118
189
|
});
|
|
119
190
|
}
|
|
120
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
194
|
+
*
|
|
195
|
+
* Used to submit feedback regarding the quality of previously generated completions.
|
|
196
|
+
*
|
|
197
|
+
* **Note:** Uses a base url of `https://predict.vellum.ai`.
|
|
198
|
+
* @throws {Vellum.BadRequestError}
|
|
199
|
+
* @throws {Vellum.NotFoundError}
|
|
200
|
+
* @throws {Vellum.InternalServerError}
|
|
201
|
+
*/
|
|
121
202
|
async submitCompletionActuals(request) {
|
|
122
203
|
const _response = await core.fetcher({
|
|
123
204
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).predict, "v1/submit-completion-actuals"),
|
|
@@ -134,10 +215,19 @@ class VellumClient {
|
|
|
134
215
|
return;
|
|
135
216
|
}
|
|
136
217
|
if (_response.error.reason === "status-code") {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
218
|
+
switch (_response.error.statusCode) {
|
|
219
|
+
case 400:
|
|
220
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
221
|
+
case 404:
|
|
222
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
223
|
+
case 500:
|
|
224
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
225
|
+
default:
|
|
226
|
+
throw new errors.VellumError({
|
|
227
|
+
statusCode: _response.error.statusCode,
|
|
228
|
+
body: _response.error.body,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
141
231
|
}
|
|
142
232
|
switch (_response.error.reason) {
|
|
143
233
|
case "non-json":
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.BadRequestError = void 0;
|
|
30
|
+
const errors = __importStar(require("../../errors"));
|
|
31
|
+
class BadRequestError extends errors.VellumError {
|
|
32
|
+
constructor(body) {
|
|
33
|
+
super({
|
|
34
|
+
message: "BadRequestError",
|
|
35
|
+
statusCode: 400,
|
|
36
|
+
body: body,
|
|
37
|
+
});
|
|
38
|
+
Object.setPrototypeOf(this, BadRequestError.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.BadRequestError = BadRequestError;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.InternalServerError = void 0;
|
|
30
|
+
const errors = __importStar(require("../../errors"));
|
|
31
|
+
class InternalServerError extends errors.VellumError {
|
|
32
|
+
constructor(body) {
|
|
33
|
+
super({
|
|
34
|
+
message: "InternalServerError",
|
|
35
|
+
statusCode: 500,
|
|
36
|
+
body: body,
|
|
37
|
+
});
|
|
38
|
+
Object.setPrototypeOf(this, InternalServerError.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.InternalServerError = InternalServerError;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.NotFoundError = void 0;
|
|
30
|
+
const errors = __importStar(require("../../errors"));
|
|
31
|
+
class NotFoundError extends errors.VellumError {
|
|
32
|
+
constructor(body) {
|
|
33
|
+
super({
|
|
34
|
+
message: "NotFoundError",
|
|
35
|
+
statusCode: 404,
|
|
36
|
+
body: body,
|
|
37
|
+
});
|
|
38
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.NotFoundError = NotFoundError;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BadRequestError"), exports);
|
|
18
|
+
__exportStar(require("./NotFoundError"), exports);
|
|
19
|
+
__exportStar(require("./InternalServerError"), exports);
|
package/api/index.d.ts
CHANGED
package/api/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
|
+
__exportStar(require("./errors"), exports);
|
|
18
19
|
__exportStar(require("./resources"), exports);
|
|
19
20
|
__exportStar(require("./client"), exports);
|
|
@@ -15,6 +15,23 @@ export declare namespace Documents {
|
|
|
15
15
|
export declare class Documents {
|
|
16
16
|
protected readonly options: Documents.Options;
|
|
17
17
|
constructor(options: Documents.Options);
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
21
|
+
*
|
|
22
|
+
* Used to list documents. Optionally filter on supported fields.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
18
25
|
list(request?: Vellum.DocumentsListRequest): Promise<Vellum.PaginatedSlimDocumentList>;
|
|
26
|
+
/**
|
|
27
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
28
|
+
*
|
|
29
|
+
* Upload a document to be indexed and used for search.
|
|
30
|
+
*
|
|
31
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
32
|
+
* @throws {Vellum.BadRequestError}
|
|
33
|
+
* @throws {Vellum.NotFoundError}
|
|
34
|
+
* @throws {Vellum.InternalServerError}
|
|
35
|
+
*/
|
|
19
36
|
upload(contents: File | fs.ReadStream, request: Vellum.UploadDocumentBodyRequest): Promise<Vellum.UploadDocumentResponse>;
|
|
20
37
|
}
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
exports.Documents = void 0;
|
|
33
33
|
const environments = __importStar(require("../../../../environments"));
|
|
34
34
|
const core = __importStar(require("../../../../core"));
|
|
35
|
+
const Vellum = __importStar(require("../../.."));
|
|
35
36
|
const url_search_params_1 = __importDefault(require("@ungap/url-search-params"));
|
|
36
37
|
const url_join_1 = __importDefault(require("url-join"));
|
|
37
38
|
const serializers = __importStar(require("../../../../serialization"));
|
|
@@ -42,6 +43,13 @@ class Documents {
|
|
|
42
43
|
constructor(options) {
|
|
43
44
|
this.options = options;
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
49
|
+
*
|
|
50
|
+
* Used to list documents. Optionally filter on supported fields.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
45
53
|
async list(request = {}) {
|
|
46
54
|
const { documentIndexId, limit, offset, ordering } = request;
|
|
47
55
|
const _queryParams = new url_search_params_1.default();
|
|
@@ -93,6 +101,16 @@ class Documents {
|
|
|
93
101
|
});
|
|
94
102
|
}
|
|
95
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* <strong style="background-color:#4caf50; color:white; padding:4px; border-radius:4px">Stable</strong>
|
|
106
|
+
*
|
|
107
|
+
* Upload a document to be indexed and used for search.
|
|
108
|
+
*
|
|
109
|
+
* **Note:** Uses a base url of `https://documents.vellum.ai`.
|
|
110
|
+
* @throws {Vellum.BadRequestError}
|
|
111
|
+
* @throws {Vellum.NotFoundError}
|
|
112
|
+
* @throws {Vellum.InternalServerError}
|
|
113
|
+
*/
|
|
96
114
|
async upload(contents, request) {
|
|
97
115
|
const _request = new form_data_1.default();
|
|
98
116
|
if (request.addToIndexNames != null) {
|
|
@@ -128,10 +146,19 @@ class Documents {
|
|
|
128
146
|
});
|
|
129
147
|
}
|
|
130
148
|
if (_response.error.reason === "status-code") {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
149
|
+
switch (_response.error.statusCode) {
|
|
150
|
+
case 400:
|
|
151
|
+
throw new Vellum.BadRequestError(_response.error.body);
|
|
152
|
+
case 404:
|
|
153
|
+
throw new Vellum.NotFoundError(_response.error.body);
|
|
154
|
+
case 500:
|
|
155
|
+
throw new Vellum.InternalServerError(_response.error.body);
|
|
156
|
+
default:
|
|
157
|
+
throw new errors.VellumError({
|
|
158
|
+
statusCode: _response.error.statusCode,
|
|
159
|
+
body: _response.error.body,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
135
162
|
}
|
|
136
163
|
switch (_response.error.reason) {
|
|
137
164
|
case "non-json":
|
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface DocumentsListRequest {
|
|
5
|
+
/**
|
|
6
|
+
* Filter down to only those documents that are included in the specified index. You may provide either the Vellum-generated ID or the unique name of the index specified upon initial creation.
|
|
7
|
+
*/
|
|
5
8
|
documentIndexId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Number of results to return per page.
|
|
11
|
+
*/
|
|
6
12
|
limit?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The initial index from which to return the results.
|
|
15
|
+
*/
|
|
7
16
|
offset?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Which field to use when ordering the results.
|
|
19
|
+
*/
|
|
8
20
|
ordering?: string;
|
|
9
21
|
}
|
|
@@ -13,5 +13,12 @@ export declare namespace ModelVersions {
|
|
|
13
13
|
export declare class ModelVersions {
|
|
14
14
|
protected readonly options: ModelVersions.Options;
|
|
15
15
|
constructor(options: ModelVersions.Options);
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
19
|
+
*
|
|
20
|
+
* Used to retrieve a model version given its ID.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
16
23
|
retrieve(id: string): Promise<Vellum.ModelVersionRead>;
|
|
17
24
|
}
|
|
@@ -40,6 +40,13 @@ class ModelVersions {
|
|
|
40
40
|
constructor(options) {
|
|
41
41
|
this.options = options;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
46
|
+
*
|
|
47
|
+
* Used to retrieve a model version given its ID.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
43
50
|
async retrieve(id) {
|
|
44
51
|
const _response = await core.fetcher({
|
|
45
52
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, `v1/model-versions/${id}`),
|
|
@@ -13,5 +13,16 @@ export declare namespace Sandboxes {
|
|
|
13
13
|
export declare class Sandboxes {
|
|
14
14
|
protected readonly options: Sandboxes.Options;
|
|
15
15
|
constructor(options: Sandboxes.Options);
|
|
16
|
+
/**
|
|
17
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
18
|
+
*
|
|
19
|
+
* Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
|
|
20
|
+
*
|
|
21
|
+
* If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
|
|
22
|
+
* is found, a new scenario will be appended to the end.
|
|
23
|
+
*
|
|
24
|
+
* Note that a full replacement of the scenario is performed, so any fields not provided will be removed
|
|
25
|
+
* or overwritten with default values.
|
|
26
|
+
*/
|
|
16
27
|
upsertSandboxScenario(id: string, request: Vellum.UpsertSandboxScenarioRequestRequest): Promise<Vellum.SandboxScenario>;
|
|
17
28
|
}
|
|
@@ -40,6 +40,17 @@ class Sandboxes {
|
|
|
40
40
|
constructor(options) {
|
|
41
41
|
this.options = options;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
45
|
+
*
|
|
46
|
+
* Upserts a new scenario for a sandbox, keying off of the optionally provided scenario id.
|
|
47
|
+
*
|
|
48
|
+
* If an id is provided and has a match, the scenario will be updated. If no id is provided or no match
|
|
49
|
+
* is found, a new scenario will be appended to the end.
|
|
50
|
+
*
|
|
51
|
+
* Note that a full replacement of the scenario is performed, so any fields not provided will be removed
|
|
52
|
+
* or overwritten with default values.
|
|
53
|
+
*/
|
|
43
54
|
async upsertSandboxScenario(id, request) {
|
|
44
55
|
const _response = await core.fetcher({
|
|
45
56
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, `v1/sandboxes/${id}/scenarios`),
|
|
@@ -13,5 +13,16 @@ export declare namespace TestSuites {
|
|
|
13
13
|
export declare class TestSuites {
|
|
14
14
|
protected readonly options: TestSuites.Options;
|
|
15
15
|
constructor(options: TestSuites.Options);
|
|
16
|
+
/**
|
|
17
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
18
|
+
*
|
|
19
|
+
* Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
|
20
|
+
*
|
|
21
|
+
* If an id is provided and has a match, the test case will be updated. If no id is provided or no match
|
|
22
|
+
* is found, a new test case will be appended to the end.
|
|
23
|
+
*
|
|
24
|
+
* Note that a full replacement of the test case is performed, so any fields not provided will be removed
|
|
25
|
+
* or overwritten with default values.
|
|
26
|
+
*/
|
|
16
27
|
upsertTestSuiteTestCase(id: string, request: Vellum.TestSuiteTestCaseRequest): Promise<Vellum.TestSuiteTestCase>;
|
|
17
28
|
}
|
|
@@ -40,6 +40,17 @@ class TestSuites {
|
|
|
40
40
|
constructor(options) {
|
|
41
41
|
this.options = options;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* <strong style="background-color:#ffc107; color:white; padding:4px; border-radius:4px">Unstable</strong>
|
|
45
|
+
*
|
|
46
|
+
* Upserts a new test case for a test suite, keying off of the optionally provided test case id.
|
|
47
|
+
*
|
|
48
|
+
* If an id is provided and has a match, the test case will be updated. If no id is provided or no match
|
|
49
|
+
* is found, a new test case will be appended to the end.
|
|
50
|
+
*
|
|
51
|
+
* Note that a full replacement of the test case is performed, so any fields not provided will be removed
|
|
52
|
+
* or overwritten with default values.
|
|
53
|
+
*/
|
|
43
54
|
async upsertTestSuiteTestCase(id, request) {
|
|
44
55
|
const _response = await core.fetcher({
|
|
45
56
|
url: (0, url_join_1.default)((this.options.environment ?? environments.VellumEnvironment.Production).default, `v1/test-suites/${id}/test-cases`),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as Vellum from "
|
|
4
|
+
import * as Vellum from "..";
|
|
5
5
|
export interface GenerateBodyRequest {
|
|
6
6
|
/** The ID of the deployment. Must provide either this or deployment_name. */
|
|
7
7
|
deploymentId?: string;
|