@mixedbread/sdk 0.1.0-alpha.8
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/CHANGELOG.md +210 -0
- package/LICENSE +201 -0
- package/README.md +360 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +241 -0
- package/core.d.ts.map +1 -0
- package/core.js +914 -0
- package/core.js.map +1 -0
- package/core.mjs +882 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +148 -0
- package/index.d.ts +148 -0
- package/index.d.ts.map +1 -0
- package/index.js +151 -0
- package/index.js.map +1 -0
- package/index.mjs +108 -0
- package/index.mjs.map +1 -0
- package/lib/polling.d.ts +48 -0
- package/lib/polling.d.ts.map +1 -0
- package/lib/polling.js +75 -0
- package/lib/polling.js.map +1 -0
- package/lib/polling.mjs +71 -0
- package/lib/polling.mjs.map +1 -0
- package/package.json +124 -0
- package/pagination.d.ts +30 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +45 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +41 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/extractions/content.d.ts +35 -0
- package/resources/extractions/content.d.ts.map +1 -0
- package/resources/extractions/content.js +19 -0
- package/resources/extractions/content.js.map +1 -0
- package/resources/extractions/content.mjs +15 -0
- package/resources/extractions/content.mjs.map +1 -0
- package/resources/extractions/extractions.d.ts +18 -0
- package/resources/extractions/extractions.d.ts.map +1 -0
- package/resources/extractions/extractions.js +47 -0
- package/resources/extractions/extractions.js.map +1 -0
- package/resources/extractions/extractions.mjs +20 -0
- package/resources/extractions/extractions.mjs.map +1 -0
- package/resources/extractions/index.d.ts +5 -0
- package/resources/extractions/index.d.ts.map +1 -0
- package/resources/extractions/index.js +13 -0
- package/resources/extractions/index.js.map +1 -0
- package/resources/extractions/index.mjs +6 -0
- package/resources/extractions/index.mjs.map +1 -0
- package/resources/extractions/jobs.d.ts +44 -0
- package/resources/extractions/jobs.d.ts.map +1 -0
- package/resources/extractions/jobs.js +29 -0
- package/resources/extractions/jobs.js.map +1 -0
- package/resources/extractions/jobs.mjs +25 -0
- package/resources/extractions/jobs.mjs.map +1 -0
- package/resources/extractions/schema.d.ts +85 -0
- package/resources/extractions/schema.d.ts.map +1 -0
- package/resources/extractions/schema.js +39 -0
- package/resources/extractions/schema.js.map +1 -0
- package/resources/extractions/schema.mjs +35 -0
- package/resources/extractions/schema.mjs.map +1 -0
- package/resources/files.d.ts +125 -0
- package/resources/files.d.ts.map +1 -0
- package/resources/files.js +99 -0
- package/resources/files.js.map +1 -0
- package/resources/files.mjs +71 -0
- package/resources/files.mjs.map +1 -0
- package/resources/index.d.ts +7 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +30 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +7 -0
- package/resources/index.mjs.map +1 -0
- package/resources/parsing/index.d.ts +3 -0
- package/resources/parsing/index.d.ts.map +1 -0
- package/resources/parsing/index.js +10 -0
- package/resources/parsing/index.js.map +1 -0
- package/resources/parsing/index.mjs +4 -0
- package/resources/parsing/index.mjs.map +1 -0
- package/resources/parsing/jobs.d.ts +278 -0
- package/resources/parsing/jobs.d.ts.map +1 -0
- package/resources/parsing/jobs.js +147 -0
- package/resources/parsing/jobs.js.map +1 -0
- package/resources/parsing/jobs.mjs +119 -0
- package/resources/parsing/jobs.mjs.map +1 -0
- package/resources/parsing/parsing.d.ts +10 -0
- package/resources/parsing/parsing.d.ts.map +1 -0
- package/resources/parsing/parsing.js +40 -0
- package/resources/parsing/parsing.js.map +1 -0
- package/resources/parsing/parsing.mjs +13 -0
- package/resources/parsing/parsing.mjs.map +1 -0
- package/resources/shared.d.ts +35 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/top-level.d.ts +11 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/resources/vector-stores/files.d.ts +280 -0
- package/resources/vector-stores/files.d.ts.map +1 -0
- package/resources/vector-stores/files.js +167 -0
- package/resources/vector-stores/files.js.map +1 -0
- package/resources/vector-stores/files.mjs +139 -0
- package/resources/vector-stores/files.mjs.map +1 -0
- package/resources/vector-stores/index.d.ts +3 -0
- package/resources/vector-stores/index.d.ts.map +1 -0
- package/resources/vector-stores/index.js +11 -0
- package/resources/vector-stores/index.js.map +1 -0
- package/resources/vector-stores/index.mjs +4 -0
- package/resources/vector-stores/index.mjs.map +1 -0
- package/resources/vector-stores/vector-stores.d.ts +400 -0
- package/resources/vector-stores/vector-stores.d.ts.map +1 -0
- package/resources/vector-stores/vector-stores.js +121 -0
- package/resources/vector-stores/vector-stores.js.map +1 -0
- package/resources/vector-stores/vector-stores.mjs +93 -0
- package/resources/vector-stores/vector-stores.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1208 -0
- package/src/error.ts +130 -0
- package/src/index.ts +294 -0
- package/src/lib/.keep +4 -0
- package/src/lib/polling.ts +115 -0
- package/src/pagination.ts +82 -0
- package/src/resource.ts +11 -0
- package/src/resources/extractions/content.ts +43 -0
- package/src/resources/extractions/extractions.ts +47 -0
- package/src/resources/extractions/index.ts +14 -0
- package/src/resources/extractions/jobs.ts +55 -0
- package/src/resources/extractions/schema.ts +111 -0
- package/src/resources/files.ts +181 -0
- package/src/resources/index.ts +32 -0
- package/src/resources/parsing/index.ts +12 -0
- package/src/resources/parsing/jobs.ts +438 -0
- package/src/resources/parsing/parsing.ts +32 -0
- package/src/resources/shared.ts +41 -0
- package/src/resources/top-level.ts +14 -0
- package/src/resources/vector-stores/files.ts +434 -0
- package/src/resources/vector-stores/index.ts +30 -0
- package/src/resources/vector-stores/vector-stores.ts +561 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +255 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +171 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +158 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
|
+
if (k2 === undefined) k2 = k;
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
8
|
+
}
|
9
|
+
Object.defineProperty(o, k2, desc);
|
10
|
+
}) : (function(o, m, k, k2) {
|
11
|
+
if (k2 === undefined) k2 = k;
|
12
|
+
o[k2] = m[k];
|
13
|
+
}));
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
16
|
+
}) : function(o, v) {
|
17
|
+
o["default"] = v;
|
18
|
+
});
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
20
|
+
if (mod && mod.__esModule) return mod;
|
21
|
+
var result = {};
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
23
|
+
__setModuleDefault(result, mod);
|
24
|
+
return result;
|
25
|
+
};
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
27
|
+
exports.VectorStoresLimitOffset = exports.VectorStores = void 0;
|
28
|
+
const resource_1 = require("../../resource.js");
|
29
|
+
const core_1 = require("../../core.js");
|
30
|
+
const FilesAPI = __importStar(require("./files.js"));
|
31
|
+
const files_1 = require("./files.js");
|
32
|
+
const pagination_1 = require("../../pagination.js");
|
33
|
+
class VectorStores extends resource_1.APIResource {
|
34
|
+
constructor() {
|
35
|
+
super(...arguments);
|
36
|
+
this.files = new FilesAPI.Files(this._client);
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Create a new vector store.
|
40
|
+
*
|
41
|
+
* Args: vector_store_create: VectorStoreCreate object containing the name,
|
42
|
+
* description, and metadata.
|
43
|
+
*
|
44
|
+
* Returns: VectorStore: The response containing the created vector store details.
|
45
|
+
*/
|
46
|
+
create(body, options) {
|
47
|
+
return this._client.post('/v1/vector_stores', { body, ...options });
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* Get a vector store by ID.
|
51
|
+
*
|
52
|
+
* Args: vector_store_id: The ID of the vector store to retrieve.
|
53
|
+
*
|
54
|
+
* Returns: VectorStore: The response containing the vector store details.
|
55
|
+
*/
|
56
|
+
retrieve(vectorStoreId, options) {
|
57
|
+
return this._client.get(`/v1/vector_stores/${vectorStoreId}`, options);
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Update a vector store by ID.
|
61
|
+
*
|
62
|
+
* Args: vector_store_id: The ID of the vector store to update.
|
63
|
+
* vector_store_update: VectorStoreCreate object containing the name, description,
|
64
|
+
* and metadata.
|
65
|
+
*
|
66
|
+
* Returns: VectorStore: The response containing the updated vector store details.
|
67
|
+
*/
|
68
|
+
update(vectorStoreId, body, options) {
|
69
|
+
return this._client.put(`/v1/vector_stores/${vectorStoreId}`, { body, ...options });
|
70
|
+
}
|
71
|
+
list(query = {}, options) {
|
72
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
73
|
+
return this.list({}, query);
|
74
|
+
}
|
75
|
+
return this._client.getAPIList('/v1/vector_stores', VectorStoresLimitOffset, { query, ...options });
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Delete a vector store by ID.
|
79
|
+
*
|
80
|
+
* Args: vector_store_id: The ID of the vector store to delete.
|
81
|
+
*
|
82
|
+
* Returns: VectorStore: The response containing the deleted vector store details.
|
83
|
+
*/
|
84
|
+
delete(vectorStoreId, options) {
|
85
|
+
return this._client.delete(`/v1/vector_stores/${vectorStoreId}`, options);
|
86
|
+
}
|
87
|
+
/**
|
88
|
+
* Question answering
|
89
|
+
*/
|
90
|
+
questionAnswering(body, options) {
|
91
|
+
return this._client.post('/v1/vector_stores/question-answering', { body, ...options });
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* Perform semantic search across vector store chunks.
|
95
|
+
*
|
96
|
+
* This endpoint searches through vector store chunks using semantic similarity
|
97
|
+
* matching. It supports complex search queries with filters and returns
|
98
|
+
* relevance-scored results.
|
99
|
+
*
|
100
|
+
* Args: search_params: Search configuration including: - query text or
|
101
|
+
* embeddings - metadata filters - pagination parameters - sorting preferences
|
102
|
+
* \_state: API state dependency \_ctx: Service context dependency
|
103
|
+
*
|
104
|
+
* Returns: VectorStoreSearchChunkResponse containing: - List of matched chunks
|
105
|
+
* with relevance scores - Pagination details including total result count
|
106
|
+
*
|
107
|
+
* Raises: HTTPException (400): If search parameters are invalid HTTPException
|
108
|
+
* (404): If no vector stores are found to search
|
109
|
+
*/
|
110
|
+
search(body, options) {
|
111
|
+
return this._client.post('/v1/vector_stores/search', { body, ...options });
|
112
|
+
}
|
113
|
+
}
|
114
|
+
exports.VectorStores = VectorStores;
|
115
|
+
class VectorStoresLimitOffset extends pagination_1.LimitOffset {
|
116
|
+
}
|
117
|
+
exports.VectorStoresLimitOffset = VectorStoresLimitOffset;
|
118
|
+
VectorStores.VectorStoresLimitOffset = VectorStoresLimitOffset;
|
119
|
+
VectorStores.Files = files_1.Files;
|
120
|
+
VectorStores.VectorStoreFilesLimitOffset = files_1.VectorStoreFilesLimitOffset;
|
121
|
+
//# sourceMappingURL=vector-stores.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vector-stores.js","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAG9C,qDAAoC;AACpC,sCAUiB;AACjB,oDAAuE;AAEvE,MAAa,YAAa,SAAQ,sBAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA4G3D,CAAC;IA1GC;;;;;;;OAOG;IACH,MAAM,CAAC,IAA6B,EAAE,OAA6B;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,aAAqB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CACJ,aAAqB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1,93 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
3
|
+
import { isRequestOptions } from "../../core.mjs";
|
4
|
+
import * as FilesAPI from "./files.mjs";
|
5
|
+
import { Files, VectorStoreFilesLimitOffset, } from "./files.mjs";
|
6
|
+
import { LimitOffset } from "../../pagination.mjs";
|
7
|
+
export class VectorStores extends APIResource {
|
8
|
+
constructor() {
|
9
|
+
super(...arguments);
|
10
|
+
this.files = new FilesAPI.Files(this._client);
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* Create a new vector store.
|
14
|
+
*
|
15
|
+
* Args: vector_store_create: VectorStoreCreate object containing the name,
|
16
|
+
* description, and metadata.
|
17
|
+
*
|
18
|
+
* Returns: VectorStore: The response containing the created vector store details.
|
19
|
+
*/
|
20
|
+
create(body, options) {
|
21
|
+
return this._client.post('/v1/vector_stores', { body, ...options });
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* Get a vector store by ID.
|
25
|
+
*
|
26
|
+
* Args: vector_store_id: The ID of the vector store to retrieve.
|
27
|
+
*
|
28
|
+
* Returns: VectorStore: The response containing the vector store details.
|
29
|
+
*/
|
30
|
+
retrieve(vectorStoreId, options) {
|
31
|
+
return this._client.get(`/v1/vector_stores/${vectorStoreId}`, options);
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* Update a vector store by ID.
|
35
|
+
*
|
36
|
+
* Args: vector_store_id: The ID of the vector store to update.
|
37
|
+
* vector_store_update: VectorStoreCreate object containing the name, description,
|
38
|
+
* and metadata.
|
39
|
+
*
|
40
|
+
* Returns: VectorStore: The response containing the updated vector store details.
|
41
|
+
*/
|
42
|
+
update(vectorStoreId, body, options) {
|
43
|
+
return this._client.put(`/v1/vector_stores/${vectorStoreId}`, { body, ...options });
|
44
|
+
}
|
45
|
+
list(query = {}, options) {
|
46
|
+
if (isRequestOptions(query)) {
|
47
|
+
return this.list({}, query);
|
48
|
+
}
|
49
|
+
return this._client.getAPIList('/v1/vector_stores', VectorStoresLimitOffset, { query, ...options });
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Delete a vector store by ID.
|
53
|
+
*
|
54
|
+
* Args: vector_store_id: The ID of the vector store to delete.
|
55
|
+
*
|
56
|
+
* Returns: VectorStore: The response containing the deleted vector store details.
|
57
|
+
*/
|
58
|
+
delete(vectorStoreId, options) {
|
59
|
+
return this._client.delete(`/v1/vector_stores/${vectorStoreId}`, options);
|
60
|
+
}
|
61
|
+
/**
|
62
|
+
* Question answering
|
63
|
+
*/
|
64
|
+
questionAnswering(body, options) {
|
65
|
+
return this._client.post('/v1/vector_stores/question-answering', { body, ...options });
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* Perform semantic search across vector store chunks.
|
69
|
+
*
|
70
|
+
* This endpoint searches through vector store chunks using semantic similarity
|
71
|
+
* matching. It supports complex search queries with filters and returns
|
72
|
+
* relevance-scored results.
|
73
|
+
*
|
74
|
+
* Args: search_params: Search configuration including: - query text or
|
75
|
+
* embeddings - metadata filters - pagination parameters - sorting preferences
|
76
|
+
* \_state: API state dependency \_ctx: Service context dependency
|
77
|
+
*
|
78
|
+
* Returns: VectorStoreSearchChunkResponse containing: - List of matched chunks
|
79
|
+
* with relevance scores - Pagination details including total result count
|
80
|
+
*
|
81
|
+
* Raises: HTTPException (400): If search parameters are invalid HTTPException
|
82
|
+
* (404): If no vector stores are found to search
|
83
|
+
*/
|
84
|
+
search(body, options) {
|
85
|
+
return this._client.post('/v1/vector_stores/search', { body, ...options });
|
86
|
+
}
|
87
|
+
}
|
88
|
+
export class VectorStoresLimitOffset extends LimitOffset {
|
89
|
+
}
|
90
|
+
VectorStores.VectorStoresLimitOffset = VectorStoresLimitOffset;
|
91
|
+
VectorStores.Files = Files;
|
92
|
+
VectorStores.VectorStoreFilesLimitOffset = VectorStoreFilesLimitOffset;
|
93
|
+
//# sourceMappingURL=vector-stores.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
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MG;IACH,MAAM,CAAC,aAAqB,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,qBAAqB,aAAa,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,iBAAiB,CACf,IAAwC,EACxC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACJ,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,WAAwB;CAAG;AA4YxE,YAAY,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;AAC/D,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;AAC3B,YAAY,CAAC,2BAA2B,GAAG,2BAA2B,CAAC"}
|
package/shims/node.d.ts
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
import * as types from "../_shims/node-types.js";
|
6
|
+
declare module '../_shims/manual-types' {
|
7
|
+
namespace manual {
|
8
|
+
type Agent = types.Agent;
|
9
|
+
export import fetch = types.fetch;
|
10
|
+
type Request = types.Request;
|
11
|
+
type RequestInfo = types.RequestInfo;
|
12
|
+
type RequestInit = types.RequestInit;
|
13
|
+
type Response = types.Response;
|
14
|
+
type ResponseInit = types.ResponseInit;
|
15
|
+
type ResponseType = types.ResponseType;
|
16
|
+
type BodyInit = types.BodyInit;
|
17
|
+
type Headers = types.Headers;
|
18
|
+
type HeadersInit = types.HeadersInit;
|
19
|
+
type BlobPropertyBag = types.BlobPropertyBag;
|
20
|
+
type FilePropertyBag = types.FilePropertyBag;
|
21
|
+
type FileFromPathOptions = types.FileFromPathOptions;
|
22
|
+
export import FormData = types.FormData;
|
23
|
+
export import File = types.File;
|
24
|
+
export import Blob = types.Blob;
|
25
|
+
type Readable = types.Readable;
|
26
|
+
type FsReadStream = types.FsReadStream;
|
27
|
+
export import ReadableStream = types.ReadableStream;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=node.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
package/shims/node.js
ADDED
@@ -0,0 +1,31 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
// @ts-ignore
|
27
|
+
const types = __importStar(require("../_shims/node-types.js"));
|
28
|
+
const registry_1 = require("../_shims/registry.js");
|
29
|
+
const node_runtime_1 = require("../_shims/node-runtime.js");
|
30
|
+
(0, registry_1.setShims)((0, node_runtime_1.getRuntime)());
|
31
|
+
//# sourceMappingURL=node.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,+DAA8C;AAC9C,oDAA8C;AAC9C,4DAAoD;AACpD,IAAA,mBAAQ,EAAC,IAAA,yBAAU,GAAE,CAAC,CAAC"}
|
package/shims/node.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node.mjs","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":"OACO,KAAK,KAAK;OACV,EAAE,QAAQ,EAAE;OACZ,EAAE,UAAU,EAAE;AACrB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC"}
|
package/shims/web.d.ts
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
import * as types from "../_shims/web-types.js";
|
2
|
+
declare module '../_shims/manual-types' {
|
3
|
+
namespace manual {
|
4
|
+
type Agent = types.Agent;
|
5
|
+
export import fetch = types.fetch;
|
6
|
+
type Request = types.Request;
|
7
|
+
type RequestInfo = types.RequestInfo;
|
8
|
+
type RequestInit = types.RequestInit;
|
9
|
+
type Response = types.Response;
|
10
|
+
type ResponseInit = types.ResponseInit;
|
11
|
+
type ResponseType = types.ResponseType;
|
12
|
+
type BodyInit = types.BodyInit;
|
13
|
+
type Headers = types.Headers;
|
14
|
+
type HeadersInit = types.HeadersInit;
|
15
|
+
type BlobPropertyBag = types.BlobPropertyBag;
|
16
|
+
type FilePropertyBag = types.FilePropertyBag;
|
17
|
+
type FileFromPathOptions = types.FileFromPathOptions;
|
18
|
+
export import FormData = types.FormData;
|
19
|
+
export import File = types.File;
|
20
|
+
export import Blob = types.Blob;
|
21
|
+
type Readable = types.Readable;
|
22
|
+
type FsReadStream = types.FsReadStream;
|
23
|
+
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,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
package/shims/web.js
ADDED
@@ -0,0 +1,31 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
+
// @ts-ignore
|
27
|
+
const types = __importStar(require("../_shims/web-types.js"));
|
28
|
+
const registry_1 = require("../_shims/registry.js");
|
29
|
+
const web_runtime_1 = require("../_shims/web-runtime.js");
|
30
|
+
(0, registry_1.setShims)((0, web_runtime_1.getRuntime)({ manuallyImported: true }));
|
31
|
+
//# sourceMappingURL=web.js.map
|
package/shims/web.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,8DAA6C;AAC7C,oDAA8C;AAC9C,0DAAmD;AACnD,IAAA,mBAAQ,EAAC,IAAA,wBAAU,EAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
package/shims/web.mjs
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web.mjs","sourceRoot":"","sources":["../src/shims/web.ts"],"names":[],"mappings":"OACO,KAAK,KAAK;OACV,EAAE,QAAQ,EAAE;OACZ,EAAE,UAAU,EAAE;AACrB,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# 👋 Wondering what everything in here does?
|
2
|
+
|
3
|
+
`@mixedbread/sdk` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
|
4
|
+
edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
|
5
|
+
|
6
|
+
To do this, `@mixedbread/sdk` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
|
7
|
+
|
8
|
+
It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
|
9
|
+
automatically select the correct shims for each environment. However, conditional exports are a fairly new
|
10
|
+
feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
|
11
|
+
|
12
|
+
setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
|
13
|
+
Unfortunately that's still the default setting, and it can result in errors like
|
14
|
+
getting the wrong raw `Response` type from `.asResponse()`, for example.
|
15
|
+
|
16
|
+
The user can work around these issues by manually importing one of:
|
17
|
+
|
18
|
+
- `import '@mixedbread/sdk/shims/node'`
|
19
|
+
- `import '@mixedbread/sdk/shims/web'`
|
20
|
+
|
21
|
+
All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
|
22
|
+
|
23
|
+
### How it works - Runtime
|
24
|
+
|
25
|
+
Runtime shims get installed by calling `setShims` exported by `@mixedbread/sdk/_shims/registry`.
|
26
|
+
|
27
|
+
Manually importing `@mixedbread/sdk/shims/node` or `@mixedbread/sdk/shims/web`, calls `setShims` with the respective runtime shims.
|
28
|
+
|
29
|
+
All client code imports shims from `@mixedbread/sdk/_shims/index`, which:
|
30
|
+
|
31
|
+
- checks if shims have been set manually
|
32
|
+
- if not, calls `setShims` with the shims from `@mixedbread/sdk/_shims/auto/runtime`
|
33
|
+
- re-exports the installed shims from `@mixedbread/sdk/_shims/registry`.
|
34
|
+
|
35
|
+
`@mixedbread/sdk/_shims/auto/runtime` exports web runtime shims.
|
36
|
+
If the `node` export condition is set, the export map replaces it with `@mixedbread/sdk/_shims/auto/runtime-node`.
|
37
|
+
|
38
|
+
### How it works - Type time
|
39
|
+
|
40
|
+
All client code imports shim types from `@mixedbread/sdk/_shims/index`, which selects the manual types from `@mixedbread/sdk/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@mixedbread/sdk/_shims/auto/types`.
|
41
|
+
|
42
|
+
`@mixedbread/sdk/_shims/manual-types` exports an empty namespace.
|
43
|
+
Manually importing `@mixedbread/sdk/shims/node` or `@mixedbread/sdk/shims/web` merges declarations into this empty namespace, so they get picked up by `@mixedbread/sdk/_shims/index`.
|
44
|
+
|
45
|
+
`@mixedbread/sdk/_shims/auto/types` exports web type definitions.
|
46
|
+
If the `node` export condition is set, the export map replaces it with `@mixedbread/sdk/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
|
@@ -0,0 +1,101 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
export type Agent = any;
|
5
|
+
|
6
|
+
// @ts-ignore
|
7
|
+
declare const _fetch: typeof fetch;
|
8
|
+
export { _fetch as fetch };
|
9
|
+
|
10
|
+
// @ts-ignore
|
11
|
+
type _Request = Request;
|
12
|
+
export { _Request as Request };
|
13
|
+
|
14
|
+
// @ts-ignore
|
15
|
+
type _RequestInfo = RequestInfo;
|
16
|
+
export { type _RequestInfo as RequestInfo };
|
17
|
+
|
18
|
+
// @ts-ignore
|
19
|
+
type _RequestInit = RequestInit;
|
20
|
+
export { type _RequestInit as RequestInit };
|
21
|
+
|
22
|
+
// @ts-ignore
|
23
|
+
type _Response = Response;
|
24
|
+
export { _Response as Response };
|
25
|
+
|
26
|
+
// @ts-ignore
|
27
|
+
type _ResponseInit = ResponseInit;
|
28
|
+
export { type _ResponseInit as ResponseInit };
|
29
|
+
|
30
|
+
// @ts-ignore
|
31
|
+
type _ResponseType = ResponseType;
|
32
|
+
export { type _ResponseType as ResponseType };
|
33
|
+
|
34
|
+
// @ts-ignore
|
35
|
+
type _BodyInit = BodyInit;
|
36
|
+
export { type _BodyInit as BodyInit };
|
37
|
+
|
38
|
+
// @ts-ignore
|
39
|
+
type _Headers = Headers;
|
40
|
+
export { _Headers as Headers };
|
41
|
+
|
42
|
+
// @ts-ignore
|
43
|
+
type _HeadersInit = HeadersInit;
|
44
|
+
export { type _HeadersInit as HeadersInit };
|
45
|
+
|
46
|
+
type EndingType = 'native' | 'transparent';
|
47
|
+
|
48
|
+
export interface BlobPropertyBag {
|
49
|
+
endings?: EndingType;
|
50
|
+
type?: string;
|
51
|
+
}
|
52
|
+
|
53
|
+
export interface FilePropertyBag extends BlobPropertyBag {
|
54
|
+
lastModified?: number;
|
55
|
+
}
|
56
|
+
|
57
|
+
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
58
|
+
|
59
|
+
// @ts-ignore
|
60
|
+
type _FormData = FormData;
|
61
|
+
// @ts-ignore
|
62
|
+
declare const _FormData: typeof FormData;
|
63
|
+
export { _FormData as FormData };
|
64
|
+
|
65
|
+
// @ts-ignore
|
66
|
+
type _File = File;
|
67
|
+
// @ts-ignore
|
68
|
+
declare const _File: typeof File;
|
69
|
+
export { _File as File };
|
70
|
+
|
71
|
+
// @ts-ignore
|
72
|
+
type _Blob = Blob;
|
73
|
+
// @ts-ignore
|
74
|
+
declare const _Blob: typeof Blob;
|
75
|
+
export { _Blob as Blob };
|
76
|
+
|
77
|
+
export declare class Readable {
|
78
|
+
readable: boolean;
|
79
|
+
readonly readableEnded: boolean;
|
80
|
+
readonly readableFlowing: boolean | null;
|
81
|
+
readonly readableHighWaterMark: number;
|
82
|
+
readonly readableLength: number;
|
83
|
+
readonly readableObjectMode: boolean;
|
84
|
+
destroyed: boolean;
|
85
|
+
read(size?: number): any;
|
86
|
+
pause(): this;
|
87
|
+
resume(): this;
|
88
|
+
isPaused(): boolean;
|
89
|
+
destroy(error?: Error): this;
|
90
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
|
91
|
+
}
|
92
|
+
|
93
|
+
export declare class FsReadStream extends Readable {
|
94
|
+
path: {}; // node type is string | Buffer
|
95
|
+
}
|
96
|
+
|
97
|
+
// @ts-ignore
|
98
|
+
type _ReadableStream<R = any> = ReadableStream<R>;
|
99
|
+
// @ts-ignore
|
100
|
+
declare const _ReadableStream: typeof ReadableStream;
|
101
|
+
export { _ReadableStream as ReadableStream };
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/**
|
2
|
+
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
|
3
|
+
*/
|
4
|
+
import { type Shims } from './registry';
|
5
|
+
import { getRuntime as getWebRuntime } from './web-runtime';
|
6
|
+
import { ReadStream as FsReadStream } from 'node:fs';
|
7
|
+
|
8
|
+
export function getRuntime(): Shims {
|
9
|
+
const runtime = getWebRuntime();
|
10
|
+
function isFsReadStream(value: any): value is FsReadStream {
|
11
|
+
return value instanceof FsReadStream;
|
12
|
+
}
|
13
|
+
return { ...runtime, isFsReadStream };
|
14
|
+
}
|