@mixedbread/sdk 0.1.0-alpha.10
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 +230 -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 +915 -0
- package/core.js.map +1 -0
- package/core.mjs +883 -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 +169 -0
- package/index.d.ts +169 -0
- package/index.d.ts.map +1 -0
- package/index.js +175 -0
- package/index.js.map +1 -0
- package/index.mjs +132 -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/embeddings.d.ts +177 -0
- package/resources/embeddings.d.ts.map +1 -0
- package/resources/embeddings.js +20 -0
- package/resources/embeddings.js.map +1 -0
- package/resources/embeddings.mjs +16 -0
- package/resources/embeddings.mjs.map +1 -0
- package/resources/extractions/content.d.ts +33 -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 +84 -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 +8 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +32 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +8 -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 +290 -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 +165 -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 +284 -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 +425 -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 +346 -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/embeddings.ts +248 -0
- package/src/resources/extractions/content.ts +42 -0
- package/src/resources/extractions/extractions.ts +47 -0
- package/src/resources/extractions/index.ts +14 -0
- package/src/resources/extractions/jobs.ts +105 -0
- package/src/resources/extractions/schema.ts +111 -0
- package/src/resources/files.ts +181 -0
- package/src/resources/index.ts +39 -0
- package/src/resources/parsing/index.ts +12 -0
- package/src/resources/parsing/jobs.ts +453 -0
- package/src/resources/parsing/parsing.ts +32 -0
- package/src/resources/shared.ts +41 -0
- package/src/resources/top-level.ts +231 -0
- package/src/resources/vector-stores/files.ts +439 -0
- package/src/resources/vector-stores/index.ts +31 -0
- package/src/resources/vector-stores/vector-stores.ts +592 -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
package/lib/polling.mjs
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
/**
|
2
|
+
* Utilities for polling operations
|
3
|
+
*/
|
4
|
+
/**
|
5
|
+
* Asynchronously polls an operation until a condition is met or timeout/max attempts are reached.
|
6
|
+
*
|
7
|
+
* @param options - Configuration options for polling
|
8
|
+
* @returns The result of the operation once condition is met
|
9
|
+
* @throws Error if maxAttempts is reached
|
10
|
+
* @throws Error if timeoutSeconds is reached
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* ```typescript
|
14
|
+
* const result = await poll({
|
15
|
+
* fn: () => fetchData(),
|
16
|
+
* condition: (result) => result.status === 'completed',
|
17
|
+
* maxAttempts: 5,
|
18
|
+
* timeoutSeconds: 60,
|
19
|
+
* intervalSeconds: 2
|
20
|
+
* });
|
21
|
+
* ```
|
22
|
+
*/
|
23
|
+
export async function poll(options) {
|
24
|
+
const { fn, condition, maxAttempts, timeoutSeconds, intervalSeconds = 1.0, onRetry, errorHandler, } = options;
|
25
|
+
const startTime = new Date();
|
26
|
+
let attempt = 0;
|
27
|
+
// eslint-disable-next-line no-constant-condition
|
28
|
+
while (true) {
|
29
|
+
attempt += 1;
|
30
|
+
try {
|
31
|
+
const result = await fn();
|
32
|
+
if (condition(result)) {
|
33
|
+
return result;
|
34
|
+
}
|
35
|
+
if (onRetry) {
|
36
|
+
onRetry(result, attempt);
|
37
|
+
}
|
38
|
+
let waitTime;
|
39
|
+
if (typeof intervalSeconds === 'function') {
|
40
|
+
waitTime = intervalSeconds(result);
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
waitTime = intervalSeconds;
|
44
|
+
}
|
45
|
+
// Check timeout and attempts before sleeping
|
46
|
+
if (maxAttempts && attempt >= maxAttempts) {
|
47
|
+
throw new Error(`Maximum attempts (${maxAttempts}) reached`);
|
48
|
+
}
|
49
|
+
if (timeoutSeconds) {
|
50
|
+
const elapsed = (new Date().getTime() - startTime.getTime()) / 1000;
|
51
|
+
if (elapsed >= timeoutSeconds) {
|
52
|
+
throw new Error(`Timeout (${timeoutSeconds}s) reached`);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
// Sleep asynchronously
|
56
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime * 1000));
|
57
|
+
}
|
58
|
+
catch (e) {
|
59
|
+
if (errorHandler && e instanceof Error) {
|
60
|
+
const sleepTime = errorHandler(e);
|
61
|
+
if (sleepTime !== null) {
|
62
|
+
// Sleep and continue
|
63
|
+
await new Promise((resolve) => setTimeout(resolve, sleepTime * 1000));
|
64
|
+
continue;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
throw e;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
//# sourceMappingURL=polling.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"polling.mjs","sourceRoot":"","sources":["../src/lib/polling.ts"],"names":[],"mappings":"AAAA;;GAEG;AA8BH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAI,OAAuB;IACnD,MAAM,EACJ,EAAE,EACF,SAAS,EACT,WAAW,EACX,cAAc,EACd,eAAe,GAAG,GAAG,EACrB,OAAO,EACP,YAAY,GACb,GAAG,OAAO,CAAC;IAEZ,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,iDAAiD;IACjD,OAAO,IAAI,EAAE;QACX,OAAO,IAAI,CAAC,CAAC;QAEb,IAAI;YACF,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;YAE1B,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;gBACrB,OAAO,MAAM,CAAC;aACf;YAED,IAAI,OAAO,EAAE;gBACX,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aAC1B;YAED,IAAI,QAAgB,CAAC;YAErB,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE;gBACzC,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;aACpC;iBAAM;gBACL,QAAQ,GAAG,eAAe,CAAC;aAC5B;YAED,6CAA6C;YAC7C,IAAI,WAAW,IAAI,OAAO,IAAI,WAAW,EAAE;gBACzC,MAAM,IAAI,KAAK,CAAC,qBAAqB,WAAW,WAAW,CAAC,CAAC;aAC9D;YAED,IAAI,cAAc,EAAE;gBAClB,MAAM,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;gBACpE,IAAI,OAAO,IAAI,cAAc,EAAE;oBAC7B,MAAM,IAAI,KAAK,CAAC,YAAY,cAAc,YAAY,CAAC,CAAC;iBACzD;aACF;YAED,uBAAuB;YACvB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;SACtE;QAAC,OAAO,CAAC,EAAE;YACV,IAAI,YAAY,IAAI,CAAC,YAAY,KAAK,EAAE;gBACtC,MAAM,SAAS,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBAClC,IAAI,SAAS,KAAK,IAAI,EAAE;oBACtB,qBAAqB;oBACrB,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC;oBACtE,SAAS;iBACV;aACF;YACD,MAAM,CAAC,CAAC;SACT;KACF;AACH,CAAC"}
|
package/package.json
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
{
|
2
|
+
"name": "@mixedbread/sdk",
|
3
|
+
"version": "0.1.0-alpha.10",
|
4
|
+
"description": "The official TypeScript library for the Mixedbread API",
|
5
|
+
"author": "Mixedbread <support@mixedbread.com>",
|
6
|
+
"types": "./index.d.ts",
|
7
|
+
"main": "./index.js",
|
8
|
+
"type": "commonjs",
|
9
|
+
"repository": "github:mixedbread-ai/mixedbread-ts",
|
10
|
+
"license": "Apache-2.0",
|
11
|
+
"packageManager": "yarn@1.22.22",
|
12
|
+
"files": [
|
13
|
+
"**/*"
|
14
|
+
],
|
15
|
+
"private": false,
|
16
|
+
"scripts": {
|
17
|
+
"test": "./scripts/test",
|
18
|
+
"build": "./scripts/build",
|
19
|
+
"format": "prettier --write --cache --cache-strategy metadata . !dist",
|
20
|
+
"tsn": "ts-node -r tsconfig-paths/register",
|
21
|
+
"lint": "./scripts/lint",
|
22
|
+
"fix": "./scripts/format"
|
23
|
+
},
|
24
|
+
"dependencies": {
|
25
|
+
"@types/node": "^18.11.18",
|
26
|
+
"@types/node-fetch": "^2.6.4",
|
27
|
+
"abort-controller": "^3.0.0",
|
28
|
+
"agentkeepalive": "^4.2.1",
|
29
|
+
"form-data-encoder": "1.7.2",
|
30
|
+
"formdata-node": "^4.3.2",
|
31
|
+
"node-fetch": "^2.6.7"
|
32
|
+
},
|
33
|
+
"sideEffects": [
|
34
|
+
"./_shims/index.js",
|
35
|
+
"./_shims/index.mjs",
|
36
|
+
"./shims/node.js",
|
37
|
+
"./shims/node.mjs",
|
38
|
+
"./shims/web.js",
|
39
|
+
"./shims/web.mjs"
|
40
|
+
],
|
41
|
+
"imports": {
|
42
|
+
"@mixedbread/sdk": ".",
|
43
|
+
"@mixedbread/sdk/*": "./src/*"
|
44
|
+
},
|
45
|
+
"exports": {
|
46
|
+
"./_shims/auto/*": {
|
47
|
+
"deno": {
|
48
|
+
"types": "./_shims/auto/*.d.ts",
|
49
|
+
"require": "./_shims/auto/*.js",
|
50
|
+
"default": "./_shims/auto/*.mjs"
|
51
|
+
},
|
52
|
+
"bun": {
|
53
|
+
"types": "./_shims/auto/*.d.ts",
|
54
|
+
"require": "./_shims/auto/*-bun.js",
|
55
|
+
"default": "./_shims/auto/*-bun.mjs"
|
56
|
+
},
|
57
|
+
"browser": {
|
58
|
+
"types": "./_shims/auto/*.d.ts",
|
59
|
+
"require": "./_shims/auto/*.js",
|
60
|
+
"default": "./_shims/auto/*.mjs"
|
61
|
+
},
|
62
|
+
"worker": {
|
63
|
+
"types": "./_shims/auto/*.d.ts",
|
64
|
+
"require": "./_shims/auto/*.js",
|
65
|
+
"default": "./_shims/auto/*.mjs"
|
66
|
+
},
|
67
|
+
"workerd": {
|
68
|
+
"types": "./_shims/auto/*.d.ts",
|
69
|
+
"require": "./_shims/auto/*.js",
|
70
|
+
"default": "./_shims/auto/*.mjs"
|
71
|
+
},
|
72
|
+
"node": {
|
73
|
+
"types": "./_shims/auto/*-node.d.ts",
|
74
|
+
"require": "./_shims/auto/*-node.js",
|
75
|
+
"default": "./_shims/auto/*-node.mjs"
|
76
|
+
},
|
77
|
+
"types": "./_shims/auto/*.d.ts",
|
78
|
+
"require": "./_shims/auto/*.js",
|
79
|
+
"default": "./_shims/auto/*.mjs"
|
80
|
+
},
|
81
|
+
".": {
|
82
|
+
"require": {
|
83
|
+
"types": "./index.d.ts",
|
84
|
+
"default": "./index.js"
|
85
|
+
},
|
86
|
+
"types": "./index.d.mts",
|
87
|
+
"default": "./index.mjs"
|
88
|
+
},
|
89
|
+
"./*.mjs": {
|
90
|
+
"types": [
|
91
|
+
"./*.d.ts",
|
92
|
+
"./*/index.d.ts"
|
93
|
+
],
|
94
|
+
"default": [
|
95
|
+
"./*.mjs",
|
96
|
+
"./*/index.mjs"
|
97
|
+
]
|
98
|
+
},
|
99
|
+
"./*.js": {
|
100
|
+
"types": [
|
101
|
+
"./*.d.ts",
|
102
|
+
"./*/index.d.ts"
|
103
|
+
],
|
104
|
+
"default": [
|
105
|
+
"./*.js",
|
106
|
+
"./*/index.js"
|
107
|
+
]
|
108
|
+
},
|
109
|
+
"./*": {
|
110
|
+
"types": [
|
111
|
+
"./*.d.ts",
|
112
|
+
"./*/index.d.ts"
|
113
|
+
],
|
114
|
+
"require": [
|
115
|
+
"./*.js",
|
116
|
+
"./*/index.js"
|
117
|
+
],
|
118
|
+
"default": [
|
119
|
+
"./*.mjs",
|
120
|
+
"./*/index.mjs"
|
121
|
+
]
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
package/pagination.d.ts
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from "./core.js";
|
2
|
+
export interface LimitOffsetResponse<Item> {
|
3
|
+
data: Array<Item>;
|
4
|
+
pagination: LimitOffsetResponse.Pagination;
|
5
|
+
}
|
6
|
+
export declare namespace LimitOffsetResponse {
|
7
|
+
interface Pagination {
|
8
|
+
total?: number;
|
9
|
+
offset?: number;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
export interface LimitOffsetParams {
|
13
|
+
/**
|
14
|
+
* The number of elements to skip.
|
15
|
+
*/
|
16
|
+
offset?: number;
|
17
|
+
/**
|
18
|
+
* The maximum number of elements to fetch.
|
19
|
+
*/
|
20
|
+
limit?: number;
|
21
|
+
}
|
22
|
+
export declare class LimitOffset<Item> extends AbstractPage<Item> implements LimitOffsetResponse<Item> {
|
23
|
+
data: Array<Item>;
|
24
|
+
pagination: LimitOffsetResponse.Pagination;
|
25
|
+
constructor(client: APIClient, response: Response, body: LimitOffsetResponse<Item>, options: FinalRequestOptions);
|
26
|
+
getPaginatedItems(): Item[];
|
27
|
+
nextPageParams(): Partial<LimitOffsetParams> | null;
|
28
|
+
nextPageInfo(): PageInfo | null;
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=pagination.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE1F,MAAM,WAAW,mBAAmB,CAAC,IAAI;IACvC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAElB,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;CAC5C;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,UAAU;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW,CAAC,IAAI,CAAE,SAAQ,YAAY,CAAC,IAAI,CAAE,YAAW,mBAAmB,CAAC,IAAI,CAAC;IAC5F,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAElB,UAAU,EAAE,mBAAmB,CAAC,UAAU,CAAC;gBAGzC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC,EAC/B,OAAO,EAAE,mBAAmB;IAQ9B,iBAAiB,IAAI,IAAI,EAAE;IAK3B,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;IASnD,YAAY,IAAI,QAAQ,GAAG,IAAI;CAoBhC"}
|
package/pagination.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.LimitOffset = void 0;
|
5
|
+
const core_1 = require("./core.js");
|
6
|
+
class LimitOffset extends core_1.AbstractPage {
|
7
|
+
constructor(client, response, body, options) {
|
8
|
+
super(client, response, body, options);
|
9
|
+
this.data = body.data || [];
|
10
|
+
this.pagination = body.pagination || {};
|
11
|
+
}
|
12
|
+
getPaginatedItems() {
|
13
|
+
return this.data ?? [];
|
14
|
+
}
|
15
|
+
// @deprecated Please use `nextPageInfo()` instead
|
16
|
+
nextPageParams() {
|
17
|
+
const info = this.nextPageInfo();
|
18
|
+
if (!info)
|
19
|
+
return null;
|
20
|
+
if ('params' in info)
|
21
|
+
return info.params;
|
22
|
+
const params = Object.fromEntries(info.url.searchParams);
|
23
|
+
if (!Object.keys(params).length)
|
24
|
+
return null;
|
25
|
+
return params;
|
26
|
+
}
|
27
|
+
nextPageInfo() {
|
28
|
+
const offset = this.pagination?.offset;
|
29
|
+
if (!offset) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
const length = this.getPaginatedItems().length;
|
33
|
+
const currentCount = offset + length;
|
34
|
+
const totalCount = this.pagination?.total;
|
35
|
+
if (!totalCount) {
|
36
|
+
return null;
|
37
|
+
}
|
38
|
+
if (currentCount < totalCount) {
|
39
|
+
return { params: { offset: currentCount } };
|
40
|
+
}
|
41
|
+
return null;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
exports.LimitOffset = LimitOffset;
|
45
|
+
//# sourceMappingURL=pagination.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA0F;AA4B1F,MAAa,WAAkB,SAAQ,mBAAkB;IAKvD,YACE,MAAiB,EACjB,QAAkB,EAClB,IAA+B,EAC/B,OAA4B;QAE5B,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC/C,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;QAErC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;QAC1C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,IAAI,CAAC;SACb;QAED,IAAI,YAAY,GAAG,UAAU,EAAE;YAC7B,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC;SAC7C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAnDD,kCAmDC"}
|
package/pagination.mjs
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
import { AbstractPage } from "./core.mjs";
|
3
|
+
export class LimitOffset extends AbstractPage {
|
4
|
+
constructor(client, response, body, options) {
|
5
|
+
super(client, response, body, options);
|
6
|
+
this.data = body.data || [];
|
7
|
+
this.pagination = body.pagination || {};
|
8
|
+
}
|
9
|
+
getPaginatedItems() {
|
10
|
+
return this.data ?? [];
|
11
|
+
}
|
12
|
+
// @deprecated Please use `nextPageInfo()` instead
|
13
|
+
nextPageParams() {
|
14
|
+
const info = this.nextPageInfo();
|
15
|
+
if (!info)
|
16
|
+
return null;
|
17
|
+
if ('params' in info)
|
18
|
+
return info.params;
|
19
|
+
const params = Object.fromEntries(info.url.searchParams);
|
20
|
+
if (!Object.keys(params).length)
|
21
|
+
return null;
|
22
|
+
return params;
|
23
|
+
}
|
24
|
+
nextPageInfo() {
|
25
|
+
const offset = this.pagination?.offset;
|
26
|
+
if (!offset) {
|
27
|
+
return null;
|
28
|
+
}
|
29
|
+
const length = this.getPaginatedItems().length;
|
30
|
+
const currentCount = offset + length;
|
31
|
+
const totalCount = this.pagination?.total;
|
32
|
+
if (!totalCount) {
|
33
|
+
return null;
|
34
|
+
}
|
35
|
+
if (currentCount < totalCount) {
|
36
|
+
return { params: { offset: currentCount } };
|
37
|
+
}
|
38
|
+
return null;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
//# sourceMappingURL=pagination.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,YAAY,EAAsD;AA4B3E,MAAM,OAAO,WAAkB,SAAQ,YAAkB;IAKvD,YACE,MAAiB,EACjB,QAAkB,EAClB,IAA+B,EAC/B,OAA4B;QAE5B,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,YAAY;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC;QAC/C,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;QAErC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;QAC1C,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,IAAI,CAAC;SACb;QAED,IAAI,YAAY,GAAG,UAAU,EAAE;YAC7B,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC;SAC7C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/resource.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,qBAAa,WAAW;IACtB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC;gBAElB,MAAM,EAAE,UAAU;CAG/B"}
|
package/resource.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.APIResource = void 0;
|
5
|
+
class APIResource {
|
6
|
+
constructor(client) {
|
7
|
+
this._client = client;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.APIResource = APIResource;
|
11
|
+
//# sourceMappingURL=resource.js.map
|
package/resource.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAItF,MAAa,WAAW;IAGtB,YAAY,MAAkB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF;AAND,kCAMC"}
|
package/resource.mjs
ADDED
package/resource.mjs.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resource.mjs","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAItF,MAAM,OAAO,WAAW;IAGtB,YAAY,MAAkB;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"}
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import { APIResource } from "../resource.js";
|
2
|
+
import * as Core from "../core.js";
|
3
|
+
export declare class Embeddings extends APIResource {
|
4
|
+
/**
|
5
|
+
* Create embeddings for text or images using the specified model, encoding format,
|
6
|
+
* and normalization.
|
7
|
+
*
|
8
|
+
* Args: params: The parameters for creating embeddings.
|
9
|
+
*
|
10
|
+
* Returns: EmbeddingCreateResponse: The response containing the embeddings.
|
11
|
+
*/
|
12
|
+
create(body: EmbeddingCreateParams, options?: Core.RequestOptions): Core.APIPromise<EmbeddingCreateResponse>;
|
13
|
+
}
|
14
|
+
export interface Embedding {
|
15
|
+
/**
|
16
|
+
* The encoded embedding.
|
17
|
+
*/
|
18
|
+
embedding: Array<number> | Array<number> | string;
|
19
|
+
/**
|
20
|
+
* The index of the embedding.
|
21
|
+
*/
|
22
|
+
index: number;
|
23
|
+
/**
|
24
|
+
* The object type of the embedding.
|
25
|
+
*/
|
26
|
+
object: 'embedding';
|
27
|
+
}
|
28
|
+
export interface EmbeddingCreateResponse {
|
29
|
+
/**
|
30
|
+
* The usage of the model
|
31
|
+
*/
|
32
|
+
usage: EmbeddingCreateResponse.Usage;
|
33
|
+
/**
|
34
|
+
* The model used
|
35
|
+
*/
|
36
|
+
model: string;
|
37
|
+
/**
|
38
|
+
* The created embeddings.
|
39
|
+
*/
|
40
|
+
data: Array<Embedding> | Array<EmbeddingCreateResponse.UnionMember1>;
|
41
|
+
/**
|
42
|
+
* The object type of the response
|
43
|
+
*/
|
44
|
+
object?: 'list' | 'parsing_job' | 'job' | 'embedding' | 'embedding_dict' | 'text_document' | 'file' | 'vector_store' | 'vector_store.file' | 'api_key';
|
45
|
+
/**
|
46
|
+
* Whether the embeddings are normalized.
|
47
|
+
*/
|
48
|
+
normalized: boolean;
|
49
|
+
/**
|
50
|
+
* The encoding format of the embeddings.
|
51
|
+
*/
|
52
|
+
encoding_format: 'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8' | Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
|
53
|
+
/**
|
54
|
+
* The number of dimensions used for the embeddings.
|
55
|
+
*/
|
56
|
+
dimensions: number | null;
|
57
|
+
}
|
58
|
+
export declare namespace EmbeddingCreateResponse {
|
59
|
+
/**
|
60
|
+
* The usage of the model
|
61
|
+
*/
|
62
|
+
interface Usage {
|
63
|
+
/**
|
64
|
+
* The number of tokens used for the prompt
|
65
|
+
*/
|
66
|
+
prompt_tokens: number;
|
67
|
+
/**
|
68
|
+
* The total number of tokens used
|
69
|
+
*/
|
70
|
+
total_tokens: number;
|
71
|
+
/**
|
72
|
+
* The number of tokens used for the completion
|
73
|
+
*/
|
74
|
+
completion_tokens?: number | null;
|
75
|
+
}
|
76
|
+
interface UnionMember1 {
|
77
|
+
/**
|
78
|
+
* The encoded embedding data by encoding format.Returned, if more than one
|
79
|
+
* encoding format is used.
|
80
|
+
*/
|
81
|
+
embedding: UnionMember1.Embedding;
|
82
|
+
/**
|
83
|
+
* The index of the embedding.
|
84
|
+
*/
|
85
|
+
index: number;
|
86
|
+
/**
|
87
|
+
* The object type of the embedding.
|
88
|
+
*/
|
89
|
+
object: 'embedding_dict';
|
90
|
+
}
|
91
|
+
namespace UnionMember1 {
|
92
|
+
/**
|
93
|
+
* The encoded embedding data by encoding format.Returned, if more than one
|
94
|
+
* encoding format is used.
|
95
|
+
*/
|
96
|
+
interface Embedding {
|
97
|
+
float?: Array<number>;
|
98
|
+
int8?: Array<number>;
|
99
|
+
uint8?: Array<number>;
|
100
|
+
binary?: Array<number>;
|
101
|
+
ubinary?: Array<number>;
|
102
|
+
base64?: Array<string>;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
export interface EmbeddingCreateParams {
|
107
|
+
/**
|
108
|
+
* The model to use for creating embeddings.
|
109
|
+
*/
|
110
|
+
model: string;
|
111
|
+
/**
|
112
|
+
* The input to create embeddings for.
|
113
|
+
*/
|
114
|
+
input: string | EmbeddingCreateParams.ImageURLInput | EmbeddingCreateParams.TextInput;
|
115
|
+
/**
|
116
|
+
* The number of dimensions to use for the embeddings.
|
117
|
+
*/
|
118
|
+
dimensions?: number | null;
|
119
|
+
/**
|
120
|
+
* The prompt to use for the embedding creation.
|
121
|
+
*/
|
122
|
+
prompt?: string | null;
|
123
|
+
/**
|
124
|
+
* Whether to normalize the embeddings.
|
125
|
+
*/
|
126
|
+
normalized?: boolean;
|
127
|
+
/**
|
128
|
+
* The encoding format of the embeddings.
|
129
|
+
*/
|
130
|
+
encoding_format?: 'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8' | Array<'float' | 'float16' | 'base64' | 'binary' | 'ubinary' | 'int8' | 'uint8'>;
|
131
|
+
}
|
132
|
+
export declare namespace EmbeddingCreateParams {
|
133
|
+
/**
|
134
|
+
* Model for image input validation.
|
135
|
+
*/
|
136
|
+
interface ImageURLInput {
|
137
|
+
/**
|
138
|
+
* Input type identifier
|
139
|
+
*/
|
140
|
+
type?: 'image_url';
|
141
|
+
/**
|
142
|
+
* The image input specification.
|
143
|
+
*/
|
144
|
+
image: ImageURLInput.Image;
|
145
|
+
}
|
146
|
+
namespace ImageURLInput {
|
147
|
+
/**
|
148
|
+
* The image input specification.
|
149
|
+
*/
|
150
|
+
interface Image {
|
151
|
+
/**
|
152
|
+
* The image URL. Can be either a URL or a Data URI.
|
153
|
+
*/
|
154
|
+
url: string;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
/**
|
158
|
+
* Model for text input validation.
|
159
|
+
*
|
160
|
+
* Attributes: type: Input type identifier, always "text" text: The actual text
|
161
|
+
* content, with length and whitespace constraints
|
162
|
+
*/
|
163
|
+
interface TextInput {
|
164
|
+
/**
|
165
|
+
* Input type identifier
|
166
|
+
*/
|
167
|
+
type?: 'text';
|
168
|
+
/**
|
169
|
+
* Text content to process
|
170
|
+
*/
|
171
|
+
text: string;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
export declare namespace Embeddings {
|
175
|
+
export { type Embedding as Embedding, type EmbeddingCreateResponse as EmbeddingCreateResponse, type EmbeddingCreateParams as EmbeddingCreateParams, };
|
176
|
+
}
|
177
|
+
//# sourceMappingURL=embeddings.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"embeddings.d.ts","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":"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"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.Embeddings = void 0;
|
5
|
+
const resource_1 = require("../resource.js");
|
6
|
+
class Embeddings extends resource_1.APIResource {
|
7
|
+
/**
|
8
|
+
* Create embeddings for text or images using the specified model, encoding format,
|
9
|
+
* and normalization.
|
10
|
+
*
|
11
|
+
* Args: params: The parameters for creating embeddings.
|
12
|
+
*
|
13
|
+
* Returns: EmbeddingCreateResponse: The response containing the embeddings.
|
14
|
+
*/
|
15
|
+
create(body, options) {
|
16
|
+
return this._client.post('/v1/embeddings', { body, ...options });
|
17
|
+
}
|
18
|
+
}
|
19
|
+
exports.Embeddings = Embeddings;
|
20
|
+
//# sourceMappingURL=embeddings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"embeddings.js","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,UAAW,SAAQ,sBAAW;IACzC;;;;;;;OAOG;IACH,MAAM,CACJ,IAA2B,EAC3B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAfD,gCAeC"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
import { APIResource } from "../resource.mjs";
|
3
|
+
export class Embeddings extends APIResource {
|
4
|
+
/**
|
5
|
+
* Create embeddings for text or images using the specified model, encoding format,
|
6
|
+
* and normalization.
|
7
|
+
*
|
8
|
+
* Args: params: The parameters for creating embeddings.
|
9
|
+
*
|
10
|
+
* Returns: EmbeddingCreateResponse: The response containing the embeddings.
|
11
|
+
*/
|
12
|
+
create(body, options) {
|
13
|
+
return this._client.post('/v1/embeddings', { body, ...options });
|
14
|
+
}
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=embeddings.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"embeddings.mjs","sourceRoot":"","sources":["../src/resources/embeddings.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,UAAW,SAAQ,WAAW;IACzC;;;;;;;OAOG;IACH,MAAM,CACJ,IAA2B,EAC3B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;CACF"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { APIResource } from "../../resource.js";
|
2
|
+
import * as Core from "../../core.js";
|
3
|
+
export declare class Content extends APIResource {
|
4
|
+
/**
|
5
|
+
* Extract content from a string using the provided schema.
|
6
|
+
*
|
7
|
+
* Args: params: The parameters for extracting content from a string.
|
8
|
+
*
|
9
|
+
* Returns: The extracted content.
|
10
|
+
*/
|
11
|
+
create(body: ContentCreateParams, options?: Core.RequestOptions): Core.APIPromise<ExtractionResult>;
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* The result of an extraction job.
|
15
|
+
*/
|
16
|
+
export interface ExtractionResult {
|
17
|
+
data: unknown;
|
18
|
+
warnings: Array<string>;
|
19
|
+
}
|
20
|
+
export interface ContentCreateParams {
|
21
|
+
/**
|
22
|
+
* The content to extract from
|
23
|
+
*/
|
24
|
+
content: string;
|
25
|
+
/**
|
26
|
+
* The JSON schema to use for extraction
|
27
|
+
*/
|
28
|
+
json_schema: unknown;
|
29
|
+
}
|
30
|
+
export declare namespace Content {
|
31
|
+
export { type ExtractionResult as ExtractionResult, type ContentCreateParams as ContentCreateParams };
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=content.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/resources/extractions/content.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;CAGpG;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EAAE,KAAK,gBAAgB,IAAI,gBAAgB,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CACvG"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
exports.Content = void 0;
|
5
|
+
const resource_1 = require("../../resource.js");
|
6
|
+
class Content extends resource_1.APIResource {
|
7
|
+
/**
|
8
|
+
* Extract content from a string using the provided schema.
|
9
|
+
*
|
10
|
+
* Args: params: The parameters for extracting content from a string.
|
11
|
+
*
|
12
|
+
* Returns: The extracted content.
|
13
|
+
*/
|
14
|
+
create(body, options) {
|
15
|
+
return this._client.post('/v1/extractions/content', { body, ...options });
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.Content = Content;
|
19
|
+
//# sourceMappingURL=content.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/resources/extractions/content.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAG7C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;OAMG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAXD,0BAWC"}
|