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
|
@@ -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;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./GenerateBodyRequest";
|
|
1
2
|
export * from "./BlockTypeEnum";
|
|
2
3
|
export * from "./ChatMessage";
|
|
3
4
|
export * from "./ChatMessageRequest";
|
|
@@ -15,6 +16,9 @@ export * from "./GenerateResponse";
|
|
|
15
16
|
export * from "./GenerateResult";
|
|
16
17
|
export * from "./GenerateResultData";
|
|
17
18
|
export * from "./GenerateResultError";
|
|
19
|
+
export * from "./GenerateStreamResponse";
|
|
20
|
+
export * from "./GenerateStreamResult";
|
|
21
|
+
export * from "./GenerateStreamResultData";
|
|
18
22
|
export * from "./IndexingStateEnum";
|
|
19
23
|
export * from "./LogprobsEnum";
|
|
20
24
|
export * from "./ModelTypeEnum";
|
package/dist/api/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./GenerateBodyRequest"), exports);
|
|
17
18
|
__exportStar(require("./BlockTypeEnum"), exports);
|
|
18
19
|
__exportStar(require("./ChatMessage"), exports);
|
|
19
20
|
__exportStar(require("./ChatMessageRequest"), exports);
|
|
@@ -31,6 +32,9 @@ __exportStar(require("./GenerateResponse"), exports);
|
|
|
31
32
|
__exportStar(require("./GenerateResult"), exports);
|
|
32
33
|
__exportStar(require("./GenerateResultData"), exports);
|
|
33
34
|
__exportStar(require("./GenerateResultError"), exports);
|
|
35
|
+
__exportStar(require("./GenerateStreamResponse"), exports);
|
|
36
|
+
__exportStar(require("./GenerateStreamResult"), exports);
|
|
37
|
+
__exportStar(require("./GenerateStreamResultData"), exports);
|
|
34
38
|
__exportStar(require("./IndexingStateEnum"), exports);
|
|
35
39
|
__exportStar(require("./LogprobsEnum"), exports);
|
|
36
40
|
__exportStar(require("./ModelTypeEnum"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallbackQueue = void 0;
|
|
4
|
+
class CallbackQueue {
|
|
5
|
+
queue = Promise.resolve();
|
|
6
|
+
wrap(callback) {
|
|
7
|
+
if (callback == null) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return (...args) => {
|
|
11
|
+
this.queue = this.queue.then(() => {
|
|
12
|
+
return callback(...args);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
toPromise() {
|
|
17
|
+
return this.queue;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CallbackQueue = CallbackQueue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CallbackQueue } from "./CallbackQueue";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CallbackQueue = void 0;
|
|
4
|
+
var CallbackQueue_1 = require("./CallbackQueue");
|
|
5
|
+
Object.defineProperty(exports, "CallbackQueue", { enumerable: true, get: function () { return CallbackQueue_1.CallbackQueue; } });
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -29,4 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.serialization = void 0;
|
|
30
30
|
exports.serialization = __importStar(require("./schemas"));
|
|
31
31
|
__exportStar(require("./fetcher"), exports);
|
|
32
|
+
__exportStar(require("./streaming-fetcher"), exports);
|
|
33
|
+
__exportStar(require("./callback-queue"), exports);
|
|
32
34
|
__exportStar(require("./form-data-utils"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import URLSearchParams from "@ungap/url-search-params";
|
|
2
|
+
import { AxiosAdapter } from "axios";
|
|
3
|
+
export declare type StreamingFetchFunction = (args: StreamingFetcher.Args) => Promise<void>;
|
|
4
|
+
export declare namespace StreamingFetcher {
|
|
5
|
+
interface Args {
|
|
6
|
+
url: string;
|
|
7
|
+
method: string;
|
|
8
|
+
headers?: Record<string, string | undefined>;
|
|
9
|
+
queryParameters?: URLSearchParams;
|
|
10
|
+
body?: unknown;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
withCredentials?: boolean;
|
|
13
|
+
adapter?: AxiosAdapter;
|
|
14
|
+
onData: (data: unknown) => void;
|
|
15
|
+
onError?: (err: unknown) => void;
|
|
16
|
+
onFinish?: () => void;
|
|
17
|
+
abortController?: AbortController;
|
|
18
|
+
responseChunkPrefix?: string;
|
|
19
|
+
terminator?: string;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export declare const streamingFetcher: StreamingFetchFunction;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.streamingFetcher = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const streamingFetcher = async (args) => {
|
|
9
|
+
const headers = {};
|
|
10
|
+
if (args.body !== undefined) {
|
|
11
|
+
headers["Content-Type"] = "application/json";
|
|
12
|
+
}
|
|
13
|
+
if (args.headers != null) {
|
|
14
|
+
for (const [key, value] of Object.entries(args.headers)) {
|
|
15
|
+
if (value != null) {
|
|
16
|
+
headers[key] = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
let response;
|
|
21
|
+
try {
|
|
22
|
+
response = await (0, axios_1.default)({
|
|
23
|
+
url: args.url,
|
|
24
|
+
params: args.queryParameters,
|
|
25
|
+
method: args.method,
|
|
26
|
+
headers,
|
|
27
|
+
data: args.body,
|
|
28
|
+
timeout: args.timeoutMs,
|
|
29
|
+
transitional: {
|
|
30
|
+
clarifyTimeoutError: true,
|
|
31
|
+
},
|
|
32
|
+
withCredentials: args.withCredentials,
|
|
33
|
+
signal: args.abortController?.signal,
|
|
34
|
+
responseType: "stream",
|
|
35
|
+
adapter: args.adapter,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
args.onError?.(error);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
response.data.on("data", (data) => {
|
|
43
|
+
for (const line of data.toString().split("\n")) {
|
|
44
|
+
let data = line;
|
|
45
|
+
if (args.responseChunkPrefix != null) {
|
|
46
|
+
if (!data.startsWith(args.responseChunkPrefix)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
data = data.substring(args.responseChunkPrefix.length);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(data);
|
|
53
|
+
args.onData(parsed);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
args.onError?.(error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (args.onFinish != null) {
|
|
61
|
+
response.data.on("end", args.onFinish);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.streamingFetcher = streamingFetcher;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { streamingFetcher, type StreamingFetcher, type StreamingFetchFunction } from "./StreamingFetcher";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamingFetcher = void 0;
|
|
4
|
+
var StreamingFetcher_1 = require("./StreamingFetcher");
|
|
5
|
+
Object.defineProperty(exports, "streamingFetcher", { enumerable: true, get: function () { return StreamingFetcher_1.streamingFetcher; } });
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubmitCompletionActualsRequest = exports.SearchRequestBodyRequest =
|
|
4
|
-
var GenerateBodyRequest_1 = require("./GenerateBodyRequest");
|
|
5
|
-
Object.defineProperty(exports, "GenerateBodyRequest", { enumerable: true, get: function () { return GenerateBodyRequest_1.GenerateBodyRequest; } });
|
|
3
|
+
exports.SubmitCompletionActualsRequest = exports.SearchRequestBodyRequest = void 0;
|
|
6
4
|
var SearchRequestBodyRequest_1 = require("./SearchRequestBodyRequest");
|
|
7
5
|
Object.defineProperty(exports, "SearchRequestBodyRequest", { enumerable: true, get: function () { return SearchRequestBodyRequest_1.SearchRequestBodyRequest; } });
|
|
8
6
|
var SubmitCompletionActualsRequest_1 = require("./SubmitCompletionActualsRequest");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
import * as serializers from "
|
|
5
|
-
import * as Vellum from "
|
|
6
|
-
import * as core from "
|
|
7
|
-
export declare const GenerateBodyRequest: core.serialization.
|
|
4
|
+
import * as serializers from "..";
|
|
5
|
+
import * as Vellum from "../../api";
|
|
6
|
+
import * as core from "../../core";
|
|
7
|
+
export declare const GenerateBodyRequest: core.serialization.ObjectSchema<serializers.GenerateBodyRequest.Raw, Vellum.GenerateBodyRequest>;
|
|
8
8
|
export declare namespace GenerateBodyRequest {
|
|
9
9
|
interface Raw {
|
|
10
10
|
deployment_id?: string | null;
|
|
@@ -27,10 +27,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.GenerateBodyRequest = void 0;
|
|
30
|
-
const core = __importStar(require("
|
|
30
|
+
const core = __importStar(require("../../core"));
|
|
31
31
|
exports.GenerateBodyRequest = core.serialization.object({
|
|
32
32
|
deploymentId: core.serialization.property("deployment_id", core.serialization.string().optional()),
|
|
33
33
|
deploymentName: core.serialization.property("deployment_name", core.serialization.string().optional()),
|
|
34
|
-
requests: core.serialization.list(core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("
|
|
35
|
-
options: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("
|
|
34
|
+
requests: core.serialization.list(core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).GenerateRequest)),
|
|
35
|
+
options: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).GenerateOptionsRequest).optional(),
|
|
36
36
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "..";
|
|
5
|
+
import * as Vellum from "../../api";
|
|
6
|
+
import * as core from "../../core";
|
|
7
|
+
export declare const GenerateStreamResponse: core.serialization.ObjectSchema<serializers.GenerateStreamResponse.Raw, Vellum.GenerateStreamResponse>;
|
|
8
|
+
export declare namespace GenerateStreamResponse {
|
|
9
|
+
interface Raw {
|
|
10
|
+
delta: serializers.GenerateStreamResult.Raw;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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.GenerateStreamResponse = void 0;
|
|
30
|
+
const core = __importStar(require("../../core"));
|
|
31
|
+
exports.GenerateStreamResponse = core.serialization.object({
|
|
32
|
+
delta: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).GenerateStreamResult),
|
|
33
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "..";
|
|
5
|
+
import * as Vellum from "../../api";
|
|
6
|
+
import * as core from "../../core";
|
|
7
|
+
export declare const GenerateStreamResult: core.serialization.ObjectSchema<serializers.GenerateStreamResult.Raw, Vellum.GenerateStreamResult>;
|
|
8
|
+
export declare namespace GenerateStreamResult {
|
|
9
|
+
interface Raw {
|
|
10
|
+
request_index: number;
|
|
11
|
+
data?: serializers.GenerateStreamResultData.Raw | null;
|
|
12
|
+
error?: serializers.GenerateResultError.Raw | null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.GenerateStreamResult = void 0;
|
|
30
|
+
const core = __importStar(require("../../core"));
|
|
31
|
+
exports.GenerateStreamResult = core.serialization.object({
|
|
32
|
+
requestIndex: core.serialization.property("request_index", core.serialization.number()),
|
|
33
|
+
data: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).GenerateStreamResultData).optional(),
|
|
34
|
+
error: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).GenerateResultError).optional(),
|
|
35
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as serializers from "..";
|
|
5
|
+
import * as Vellum from "../../api";
|
|
6
|
+
import * as core from "../../core";
|
|
7
|
+
export declare const GenerateStreamResultData: core.serialization.ObjectSchema<serializers.GenerateStreamResultData.Raw, Vellum.GenerateStreamResultData>;
|
|
8
|
+
export declare namespace GenerateStreamResultData {
|
|
9
|
+
interface Raw {
|
|
10
|
+
completion_index: number;
|
|
11
|
+
completion: serializers.EnrichedNormalizedCompletion.Raw;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.GenerateStreamResultData = void 0;
|
|
30
|
+
const core = __importStar(require("../../core"));
|
|
31
|
+
exports.GenerateStreamResultData = core.serialization.object({
|
|
32
|
+
completionIndex: core.serialization.property("completion_index", core.serialization.number()),
|
|
33
|
+
completion: core.serialization.lazyObject(async () => (await Promise.resolve().then(() => __importStar(require("..")))).EnrichedNormalizedCompletion),
|
|
34
|
+
});
|