@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,47 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
import { APIResource } from '../../resource';
|
4
|
+
import * as ContentAPI from './content';
|
5
|
+
import { Content, ContentCreateParams, ExtractionResult } from './content';
|
6
|
+
import * as JobsAPI from './jobs';
|
7
|
+
import { ExtractionJob, JobCreateParams, Jobs } from './jobs';
|
8
|
+
import * as SchemaAPI from './schema';
|
9
|
+
import {
|
10
|
+
CreatedJsonSchema,
|
11
|
+
EnhancedJsonSchema,
|
12
|
+
Schema,
|
13
|
+
SchemaCreateParams,
|
14
|
+
SchemaEnhanceParams,
|
15
|
+
SchemaValidateParams,
|
16
|
+
ValidatedJsonSchema,
|
17
|
+
} from './schema';
|
18
|
+
|
19
|
+
export class Extractions extends APIResource {
|
20
|
+
jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client);
|
21
|
+
schema: SchemaAPI.Schema = new SchemaAPI.Schema(this._client);
|
22
|
+
content: ContentAPI.Content = new ContentAPI.Content(this._client);
|
23
|
+
}
|
24
|
+
|
25
|
+
Extractions.Jobs = Jobs;
|
26
|
+
Extractions.Schema = Schema;
|
27
|
+
Extractions.Content = Content;
|
28
|
+
|
29
|
+
export declare namespace Extractions {
|
30
|
+
export { Jobs as Jobs, type ExtractionJob as ExtractionJob, type JobCreateParams as JobCreateParams };
|
31
|
+
|
32
|
+
export {
|
33
|
+
Schema as Schema,
|
34
|
+
type CreatedJsonSchema as CreatedJsonSchema,
|
35
|
+
type EnhancedJsonSchema as EnhancedJsonSchema,
|
36
|
+
type ValidatedJsonSchema as ValidatedJsonSchema,
|
37
|
+
type SchemaCreateParams as SchemaCreateParams,
|
38
|
+
type SchemaEnhanceParams as SchemaEnhanceParams,
|
39
|
+
type SchemaValidateParams as SchemaValidateParams,
|
40
|
+
};
|
41
|
+
|
42
|
+
export {
|
43
|
+
Content as Content,
|
44
|
+
type ExtractionResult as ExtractionResult,
|
45
|
+
type ContentCreateParams as ContentCreateParams,
|
46
|
+
};
|
47
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
export { Content, type ExtractionResult, type ContentCreateParams } from './content';
|
4
|
+
export { Extractions } from './extractions';
|
5
|
+
export { Jobs, type ExtractionJob, type JobCreateParams } from './jobs';
|
6
|
+
export {
|
7
|
+
Schema,
|
8
|
+
type CreatedJsonSchema,
|
9
|
+
type EnhancedJsonSchema,
|
10
|
+
type ValidatedJsonSchema,
|
11
|
+
type SchemaCreateParams,
|
12
|
+
type SchemaEnhanceParams,
|
13
|
+
type SchemaValidateParams,
|
14
|
+
} from './schema';
|
@@ -0,0 +1,55 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
import { APIResource } from '../../resource';
|
4
|
+
import * as Core from '../../core';
|
5
|
+
import * as ContentAPI from './content';
|
6
|
+
|
7
|
+
export class Jobs extends APIResource {
|
8
|
+
/**
|
9
|
+
* Start an extraction job for the provided file and schema.
|
10
|
+
*
|
11
|
+
* Args: params: The parameters for creating an extraction job.
|
12
|
+
*
|
13
|
+
* Returns: The created extraction job.
|
14
|
+
*/
|
15
|
+
create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise<ExtractionJob> {
|
16
|
+
return this._client.post('/v1/extractions/jobs', { body, ...options });
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Get detailed information about a specific extraction job.
|
21
|
+
*
|
22
|
+
* Args: job_id: The ID of the extraction job.
|
23
|
+
*
|
24
|
+
* Returns: Detailed information about the extraction job.
|
25
|
+
*/
|
26
|
+
retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise<ExtractionJob> {
|
27
|
+
return this._client.get(`/v1/extractions/jobs/${jobId}`, options);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* A job for extracting structured data from documents.
|
33
|
+
*/
|
34
|
+
export interface ExtractionJob {
|
35
|
+
/**
|
36
|
+
* Result of an extraction operation.
|
37
|
+
*/
|
38
|
+
result: ContentAPI.ExtractionResult | null;
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface JobCreateParams {
|
42
|
+
/**
|
43
|
+
* The ID of the file to extract from
|
44
|
+
*/
|
45
|
+
file_id: string;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* The JSON schema to use for extraction
|
49
|
+
*/
|
50
|
+
json_schema: unknown;
|
51
|
+
}
|
52
|
+
|
53
|
+
export declare namespace Jobs {
|
54
|
+
export { type ExtractionJob as ExtractionJob, type JobCreateParams as JobCreateParams };
|
55
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
import { APIResource } from '../../resource';
|
4
|
+
import * as Core from '../../core';
|
5
|
+
|
6
|
+
export class Schema extends APIResource {
|
7
|
+
/**
|
8
|
+
* Create a schema with the provided parameters.
|
9
|
+
*
|
10
|
+
* Args: params: The parameters for creating a schema.
|
11
|
+
*
|
12
|
+
* Returns: The created schema.
|
13
|
+
*/
|
14
|
+
create(body: SchemaCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreatedJsonSchema> {
|
15
|
+
return this._client.post('/v1/extractions/schema', { body, ...options });
|
16
|
+
}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Enhance a schema by enriching the descriptions to aid extraction.
|
20
|
+
*
|
21
|
+
* Args: params: The parameters for enhancing a schema.
|
22
|
+
*
|
23
|
+
* Returns: The enhanced schema.
|
24
|
+
*/
|
25
|
+
enhance(body: SchemaEnhanceParams, options?: Core.RequestOptions): Core.APIPromise<EnhancedJsonSchema> {
|
26
|
+
return this._client.post('/v1/extractions/schema/enhance', { body, ...options });
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Validate a schema.
|
31
|
+
*
|
32
|
+
* Args: params: The parameters for validating a schema.
|
33
|
+
*
|
34
|
+
* Returns: The validation result.
|
35
|
+
*/
|
36
|
+
validate(body: SchemaValidateParams, options?: Core.RequestOptions): Core.APIPromise<ValidatedJsonSchema> {
|
37
|
+
return this._client.post('/v1/extractions/schema/validate', { body, ...options });
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Result of creating a JSON schema.
|
43
|
+
*/
|
44
|
+
export interface CreatedJsonSchema {
|
45
|
+
/**
|
46
|
+
* The created JSON schema
|
47
|
+
*/
|
48
|
+
json_schema: unknown;
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Result of enhancing a JSON schema.
|
53
|
+
*/
|
54
|
+
export interface EnhancedJsonSchema {
|
55
|
+
/**
|
56
|
+
* The enhanced JSON schema
|
57
|
+
*/
|
58
|
+
json_schema: unknown;
|
59
|
+
}
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Result of validating a JSON schema.
|
63
|
+
*/
|
64
|
+
export interface ValidatedJsonSchema {
|
65
|
+
/**
|
66
|
+
* Whether the schema is valid
|
67
|
+
*/
|
68
|
+
is_valid: boolean;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* List of validation errors
|
72
|
+
*/
|
73
|
+
errors: Array<string>;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* The validated JSON schema
|
77
|
+
*/
|
78
|
+
json_schema: unknown;
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface SchemaCreateParams {
|
82
|
+
/**
|
83
|
+
* Description of the data to extract
|
84
|
+
*/
|
85
|
+
description: string;
|
86
|
+
}
|
87
|
+
|
88
|
+
export interface SchemaEnhanceParams {
|
89
|
+
/**
|
90
|
+
* The JSON schema to enhance
|
91
|
+
*/
|
92
|
+
json_schema: unknown;
|
93
|
+
}
|
94
|
+
|
95
|
+
export interface SchemaValidateParams {
|
96
|
+
/**
|
97
|
+
* The JSON schema to validate
|
98
|
+
*/
|
99
|
+
json_schema: unknown;
|
100
|
+
}
|
101
|
+
|
102
|
+
export declare namespace Schema {
|
103
|
+
export {
|
104
|
+
type CreatedJsonSchema as CreatedJsonSchema,
|
105
|
+
type EnhancedJsonSchema as EnhancedJsonSchema,
|
106
|
+
type ValidatedJsonSchema as ValidatedJsonSchema,
|
107
|
+
type SchemaCreateParams as SchemaCreateParams,
|
108
|
+
type SchemaEnhanceParams as SchemaEnhanceParams,
|
109
|
+
type SchemaValidateParams as SchemaValidateParams,
|
110
|
+
};
|
111
|
+
}
|
@@ -0,0 +1,181 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
import { APIResource } from '../resource';
|
4
|
+
import { isRequestOptions } from '../core';
|
5
|
+
import * as Core from '../core';
|
6
|
+
import { LimitOffset, type LimitOffsetParams } from '../pagination';
|
7
|
+
import { type Response } from '../_shims/index';
|
8
|
+
|
9
|
+
export class Files extends APIResource {
|
10
|
+
/**
|
11
|
+
* Upload a new file.
|
12
|
+
*
|
13
|
+
* Args: file: The file to upload.
|
14
|
+
*
|
15
|
+
* Returns: FileResponse: The response containing the details of the uploaded file.
|
16
|
+
*/
|
17
|
+
create(body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise<FileObject> {
|
18
|
+
return this._client.post('/v1/files', Core.multipartFormRequestOptions({ body, ...options }));
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Retrieve details of a specific file by its ID.
|
23
|
+
*
|
24
|
+
* Args: file_id: The ID of the file to retrieve.
|
25
|
+
*
|
26
|
+
* Returns: FileResponse: The response containing the file details.
|
27
|
+
*/
|
28
|
+
retrieve(fileId: string, options?: Core.RequestOptions): Core.APIPromise<FileObject> {
|
29
|
+
return this._client.get(`/v1/files/${fileId}`, options);
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Update the details of a specific file.
|
34
|
+
*
|
35
|
+
* Args: file_id: The ID of the file to update. file: The new details for the file.
|
36
|
+
*
|
37
|
+
* Returns: FileObject: The updated file details.
|
38
|
+
*/
|
39
|
+
update(fileId: string, body: FileUpdateParams, options?: Core.RequestOptions): Core.APIPromise<FileObject> {
|
40
|
+
return this._client.post(`/v1/files/${fileId}`, Core.multipartFormRequestOptions({ body, ...options }));
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* List all files for the authenticated user.
|
45
|
+
*
|
46
|
+
* Args: pagination: The pagination options
|
47
|
+
*
|
48
|
+
* Returns: A list of files belonging to the user.
|
49
|
+
*/
|
50
|
+
list(
|
51
|
+
query?: FileListParams,
|
52
|
+
options?: Core.RequestOptions,
|
53
|
+
): Core.PagePromise<FileObjectsLimitOffset, FileObject>;
|
54
|
+
list(options?: Core.RequestOptions): Core.PagePromise<FileObjectsLimitOffset, FileObject>;
|
55
|
+
list(
|
56
|
+
query: FileListParams | Core.RequestOptions = {},
|
57
|
+
options?: Core.RequestOptions,
|
58
|
+
): Core.PagePromise<FileObjectsLimitOffset, FileObject> {
|
59
|
+
if (isRequestOptions(query)) {
|
60
|
+
return this.list({}, query);
|
61
|
+
}
|
62
|
+
return this._client.getAPIList('/v1/files', FileObjectsLimitOffset, { query, ...options });
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Delete a specific file by its ID.
|
67
|
+
*
|
68
|
+
* Args: file_id: The ID of the file to delete.
|
69
|
+
*
|
70
|
+
* Returns: FileDeleted: The response containing the details of the deleted file.
|
71
|
+
*/
|
72
|
+
delete(fileId: string, options?: Core.RequestOptions): Core.APIPromise<FileDeleteResponse> {
|
73
|
+
return this._client.delete(`/v1/files/${fileId}`, options);
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Download a specific file by its ID.
|
78
|
+
*
|
79
|
+
* Args: file_id: The ID of the file to download.
|
80
|
+
*
|
81
|
+
* Returns: FileStreamResponse: The response containing the file to be downloaded.
|
82
|
+
*/
|
83
|
+
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<Response> {
|
84
|
+
return this._client.get(`/v1/files/${fileId}/content`, {
|
85
|
+
...options,
|
86
|
+
headers: { Accept: 'application/octet-stream', ...options?.headers },
|
87
|
+
__binaryResponse: true,
|
88
|
+
});
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
export class FileObjectsLimitOffset extends LimitOffset<FileObject> {}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* A model representing a file object in the system.
|
96
|
+
*
|
97
|
+
* This model contains metadata about files stored in the system, including
|
98
|
+
* identifiers, size information, and timestamps.
|
99
|
+
*/
|
100
|
+
export interface FileObject {
|
101
|
+
/**
|
102
|
+
* Unique identifier for the file
|
103
|
+
*/
|
104
|
+
id: string;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Name of the file including extension
|
108
|
+
*/
|
109
|
+
filename: string;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Size of the file in bytes
|
113
|
+
*/
|
114
|
+
bytes: number;
|
115
|
+
|
116
|
+
/**
|
117
|
+
* MIME type of the file
|
118
|
+
*/
|
119
|
+
mime_type: string;
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Version of the file
|
123
|
+
*/
|
124
|
+
version: number;
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Timestamp when the file was created
|
128
|
+
*/
|
129
|
+
created_at: string;
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Timestamp when the file was last updated
|
133
|
+
*/
|
134
|
+
updated_at: string;
|
135
|
+
}
|
136
|
+
|
137
|
+
export interface FileDeleteResponse {
|
138
|
+
/**
|
139
|
+
* The ID of the deleted file
|
140
|
+
*/
|
141
|
+
id: string;
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Whether the file was deleted
|
145
|
+
*/
|
146
|
+
deleted?: boolean;
|
147
|
+
|
148
|
+
/**
|
149
|
+
* The type of the deleted object
|
150
|
+
*/
|
151
|
+
object?: 'file';
|
152
|
+
}
|
153
|
+
|
154
|
+
export interface FileCreateParams {
|
155
|
+
/**
|
156
|
+
* The file to upload
|
157
|
+
*/
|
158
|
+
file: Core.Uploadable;
|
159
|
+
}
|
160
|
+
|
161
|
+
export interface FileUpdateParams {
|
162
|
+
/**
|
163
|
+
* The file to update
|
164
|
+
*/
|
165
|
+
file: Core.Uploadable;
|
166
|
+
}
|
167
|
+
|
168
|
+
export interface FileListParams extends LimitOffsetParams {}
|
169
|
+
|
170
|
+
Files.FileObjectsLimitOffset = FileObjectsLimitOffset;
|
171
|
+
|
172
|
+
export declare namespace Files {
|
173
|
+
export {
|
174
|
+
type FileObject as FileObject,
|
175
|
+
type FileDeleteResponse as FileDeleteResponse,
|
176
|
+
FileObjectsLimitOffset as FileObjectsLimitOffset,
|
177
|
+
type FileCreateParams as FileCreateParams,
|
178
|
+
type FileUpdateParams as FileUpdateParams,
|
179
|
+
type FileListParams as FileListParams,
|
180
|
+
};
|
181
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
export * from './shared';
|
4
|
+
export { Extractions } from './extractions/extractions';
|
5
|
+
export {
|
6
|
+
FileObjectsLimitOffset,
|
7
|
+
Files,
|
8
|
+
type FileObject,
|
9
|
+
type FileDeleteResponse,
|
10
|
+
type FileCreateParams,
|
11
|
+
type FileUpdateParams,
|
12
|
+
type FileListParams,
|
13
|
+
} from './files';
|
14
|
+
export { Parsing } from './parsing/parsing';
|
15
|
+
export {
|
16
|
+
VectorStoresLimitOffset,
|
17
|
+
VectorStores,
|
18
|
+
type ExpiresAfter,
|
19
|
+
type FileCounts,
|
20
|
+
type ScoredVectorStoreChunk,
|
21
|
+
type VectorStore,
|
22
|
+
type VectorStoreSearchOptions,
|
23
|
+
type VectorStoreDeleteResponse,
|
24
|
+
type VectorStoreQuestionAnsweringResponse,
|
25
|
+
type VectorStoreSearchResponse,
|
26
|
+
type VectorStoreCreateParams,
|
27
|
+
type VectorStoreUpdateParams,
|
28
|
+
type VectorStoreListParams,
|
29
|
+
type VectorStoreQuestionAnsweringParams,
|
30
|
+
type VectorStoreSearchParams,
|
31
|
+
} from './vector-stores/vector-stores';
|
32
|
+
export { type InfoResponse } from './top-level';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
export {
|
4
|
+
JobListResponsesLimitOffset,
|
5
|
+
Jobs,
|
6
|
+
type ParsingJob,
|
7
|
+
type JobListResponse,
|
8
|
+
type JobDeleteResponse,
|
9
|
+
type JobCreateParams,
|
10
|
+
type JobListParams,
|
11
|
+
} from './jobs';
|
12
|
+
export { Parsing } from './parsing';
|