feat: Passwordless cross-device authentication

- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
This commit is contained in:
Bernt
2026-07-07 07:11:50 +00:00
parent 4aa984ad74
commit 6989a98d75
61843 changed files with 5491611 additions and 872231 deletions
+211
View File
@@ -0,0 +1,211 @@
import { APIResource } from "../../core/resource.mjs";
import * as FilesAPI from "./files.mjs";
import { VectorStoreFilesPage } from "./files.mjs";
import * as VectorStoresAPI from "./vector-stores.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { type CursorPageParams, PagePromise } from "../../core/pagination.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
import { type Uploadable } from "../../uploads.mjs";
export declare class FileBatches extends APIResource {
/**
* Create a vector store file batch.
*/
create(vectorStoreID: string, body: FileBatchCreateParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Retrieves a vector store file batch.
*/
retrieve(batchID: string, params: FileBatchRetrieveParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Cancel a vector store file batch. This attempts to cancel the processing of
* files in this batch as soon as possible.
*/
cancel(batchID: string, params: FileBatchCancelParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Create a vector store batch and poll until all files have been processed.
*/
createAndPoll(vectorStoreId: string, body: FileBatchCreateParams, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFileBatch>;
/**
* Returns a list of vector store files in a batch.
*/
listFiles(batchID: string, params: FileBatchListFilesParams, options?: RequestOptions): PagePromise<VectorStoreFilesPage, FilesAPI.VectorStoreFile>;
/**
* Wait for the given file batch to be processed.
*
* Note: this will return even if one of the files failed to process, you need to
* check batch.file_counts.failed_count to handle this case.
*/
poll(vectorStoreID: string, batchID: string, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFileBatch>;
/**
* Uploads the given files concurrently and then creates a vector store file batch.
*
* The concurrency limit is configurable using the `maxConcurrency` parameter.
*/
uploadAndPoll(vectorStoreId: string, { files, fileIds }: {
files: Uploadable[];
fileIds?: string[];
}, options?: RequestOptions & {
pollIntervalMs?: number;
maxConcurrency?: number;
}): Promise<VectorStoreFileBatch>;
}
/**
* A batch of files attached to a vector store.
*/
export interface VectorStoreFileBatch {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store files batch was
* created.
*/
created_at: number;
file_counts: VectorStoreFileBatch.FileCounts;
/**
* The object type, which is always `vector_store.file_batch`.
*/
object: 'vector_store.files_batch';
/**
* The status of the vector store files batch, which can be either `in_progress`,
* `completed`, `cancelled` or `failed`.
*/
status: 'in_progress' | 'completed' | 'cancelled' | 'failed';
/**
* The ID of the
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
* that the [File](https://platform.openai.com/docs/api-reference/files) is
* attached to.
*/
vector_store_id: string;
}
export declare namespace VectorStoreFileBatch {
interface FileCounts {
/**
* The number of files that where cancelled.
*/
cancelled: number;
/**
* The number of files that have been processed.
*/
completed: number;
/**
* The number of files that have failed to process.
*/
failed: number;
/**
* The number of files that are currently being processed.
*/
in_progress: number;
/**
* The total number of files.
*/
total: number;
}
}
export interface FileBatchCreateParams {
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the vector store should use. Useful for tools like `file_search` that can access
* files. If `attributes` or `chunking_strategy` are provided, they will be applied
* to all files in the batch. The maximum batch size is 2000 files. This endpoint
* is recommended for multi-file ingestion and helps reduce per-vector-store write
* request pressure. Mutually exclusive with `files`.
*/
file_ids?: Array<string>;
/**
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific
* files. The global `attributes` or `chunking_strategy` will be ignored and must
* be specified for each file. The maximum batch size is 2000 files. This endpoint
* is recommended for multi-file ingestion and helps reduce per-vector-store write
* request pressure. Mutually exclusive with `file_ids`.
*/
files?: Array<FileBatchCreateParams.File>;
}
export declare namespace FileBatchCreateParams {
interface File {
/**
* A [File](https://platform.openai.com/docs/api-reference/files) ID that the
* vector store should use. Useful for tools like `file_search` that can access
* files. For multi-file ingestion, we recommend
* [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
* to minimize per-vector-store write requests.
*/
file_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
}
}
export interface FileBatchRetrieveParams {
/**
* The ID of the vector store that the file batch belongs to.
*/
vector_store_id: string;
}
export interface FileBatchCancelParams {
/**
* The ID of the vector store that the file batch belongs to.
*/
vector_store_id: string;
}
export interface FileBatchListFilesParams extends CursorPageParams {
/**
* Path param: The ID of the vector store that the files belong to.
*/
vector_store_id: string;
/**
* Query param: A cursor for use in pagination. `before` is an object ID that
* defines your place in the list. For instance, if you make a list request and
* receive 100 objects, starting with obj_foo, your subsequent call can include
* before=obj_foo in order to fetch the previous page of the list.
*/
before?: string;
/**
* Query param: Filter by file status. One of `in_progress`, `completed`, `failed`,
* `cancelled`.
*/
filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled';
/**
* Query param: Sort order by the `created_at` timestamp of the objects. `asc` for
* ascending order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export declare namespace FileBatches {
export { type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchRetrieveParams as FileBatchRetrieveParams, type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
}
export { type VectorStoreFilesPage };
//# sourceMappingURL=file-batches.d.mts.map
@@ -0,0 +1 @@
{"version":3,"file":"file-batches.d.mts","sourceRoot":"","sources":["../../src/resources/vector-stores/file-batches.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EAAE,oBAAoB,EAAE,oBAAgB;AAC/C,OAAO,KAAK,eAAe,4BAAwB;AACnD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAc,KAAK,gBAAgB,EAAE,WAAW,EAAE,kCAA8B;AAEvF,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE,OAAO,EAAE,KAAK,UAAU,EAAE,0BAAsB;AAIhD,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IASnC;;OAEG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IASnC;;;OAGG;IACH,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,qBAAqB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IASnC;;OAEG;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;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAE9D;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH;AAED,OAAO,EAAE,KAAK,oBAAoB,EAAE,CAAC"}
+211
View File
@@ -0,0 +1,211 @@
import { APIResource } from "../../core/resource.js";
import * as FilesAPI from "./files.js";
import { VectorStoreFilesPage } from "./files.js";
import * as VectorStoresAPI from "./vector-stores.js";
import { APIPromise } from "../../core/api-promise.js";
import { type CursorPageParams, PagePromise } from "../../core/pagination.js";
import { RequestOptions } from "../../internal/request-options.js";
import { type Uploadable } from "../../uploads.js";
export declare class FileBatches extends APIResource {
/**
* Create a vector store file batch.
*/
create(vectorStoreID: string, body: FileBatchCreateParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Retrieves a vector store file batch.
*/
retrieve(batchID: string, params: FileBatchRetrieveParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Cancel a vector store file batch. This attempts to cancel the processing of
* files in this batch as soon as possible.
*/
cancel(batchID: string, params: FileBatchCancelParams, options?: RequestOptions): APIPromise<VectorStoreFileBatch>;
/**
* Create a vector store batch and poll until all files have been processed.
*/
createAndPoll(vectorStoreId: string, body: FileBatchCreateParams, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFileBatch>;
/**
* Returns a list of vector store files in a batch.
*/
listFiles(batchID: string, params: FileBatchListFilesParams, options?: RequestOptions): PagePromise<VectorStoreFilesPage, FilesAPI.VectorStoreFile>;
/**
* Wait for the given file batch to be processed.
*
* Note: this will return even if one of the files failed to process, you need to
* check batch.file_counts.failed_count to handle this case.
*/
poll(vectorStoreID: string, batchID: string, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFileBatch>;
/**
* Uploads the given files concurrently and then creates a vector store file batch.
*
* The concurrency limit is configurable using the `maxConcurrency` parameter.
*/
uploadAndPoll(vectorStoreId: string, { files, fileIds }: {
files: Uploadable[];
fileIds?: string[];
}, options?: RequestOptions & {
pollIntervalMs?: number;
maxConcurrency?: number;
}): Promise<VectorStoreFileBatch>;
}
/**
* A batch of files attached to a vector store.
*/
export interface VectorStoreFileBatch {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store files batch was
* created.
*/
created_at: number;
file_counts: VectorStoreFileBatch.FileCounts;
/**
* The object type, which is always `vector_store.file_batch`.
*/
object: 'vector_store.files_batch';
/**
* The status of the vector store files batch, which can be either `in_progress`,
* `completed`, `cancelled` or `failed`.
*/
status: 'in_progress' | 'completed' | 'cancelled' | 'failed';
/**
* The ID of the
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
* that the [File](https://platform.openai.com/docs/api-reference/files) is
* attached to.
*/
vector_store_id: string;
}
export declare namespace VectorStoreFileBatch {
interface FileCounts {
/**
* The number of files that where cancelled.
*/
cancelled: number;
/**
* The number of files that have been processed.
*/
completed: number;
/**
* The number of files that have failed to process.
*/
failed: number;
/**
* The number of files that are currently being processed.
*/
in_progress: number;
/**
* The total number of files.
*/
total: number;
}
}
export interface FileBatchCreateParams {
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the vector store should use. Useful for tools like `file_search` that can access
* files. If `attributes` or `chunking_strategy` are provided, they will be applied
* to all files in the batch. The maximum batch size is 2000 files. This endpoint
* is recommended for multi-file ingestion and helps reduce per-vector-store write
* request pressure. Mutually exclusive with `files`.
*/
file_ids?: Array<string>;
/**
* A list of objects that each include a `file_id` plus optional `attributes` or
* `chunking_strategy`. Use this when you need to override metadata for specific
* files. The global `attributes` or `chunking_strategy` will be ignored and must
* be specified for each file. The maximum batch size is 2000 files. This endpoint
* is recommended for multi-file ingestion and helps reduce per-vector-store write
* request pressure. Mutually exclusive with `file_ids`.
*/
files?: Array<FileBatchCreateParams.File>;
}
export declare namespace FileBatchCreateParams {
interface File {
/**
* A [File](https://platform.openai.com/docs/api-reference/files) ID that the
* vector store should use. Useful for tools like `file_search` that can access
* files. For multi-file ingestion, we recommend
* [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
* to minimize per-vector-store write requests.
*/
file_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
}
}
export interface FileBatchRetrieveParams {
/**
* The ID of the vector store that the file batch belongs to.
*/
vector_store_id: string;
}
export interface FileBatchCancelParams {
/**
* The ID of the vector store that the file batch belongs to.
*/
vector_store_id: string;
}
export interface FileBatchListFilesParams extends CursorPageParams {
/**
* Path param: The ID of the vector store that the files belong to.
*/
vector_store_id: string;
/**
* Query param: A cursor for use in pagination. `before` is an object ID that
* defines your place in the list. For instance, if you make a list request and
* receive 100 objects, starting with obj_foo, your subsequent call can include
* before=obj_foo in order to fetch the previous page of the list.
*/
before?: string;
/**
* Query param: Filter by file status. One of `in_progress`, `completed`, `failed`,
* `cancelled`.
*/
filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled';
/**
* Query param: Sort order by the `created_at` timestamp of the objects. `asc` for
* ascending order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export declare namespace FileBatches {
export { type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchRetrieveParams as FileBatchRetrieveParams, type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
}
export { type VectorStoreFilesPage };
//# sourceMappingURL=file-batches.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"file-batches.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/file-batches.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,QAAQ,mBAAgB;AACpC,OAAO,EAAE,oBAAoB,EAAE,mBAAgB;AAC/C,OAAO,KAAK,eAAe,2BAAwB;AACnD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAc,KAAK,gBAAgB,EAAE,WAAW,EAAE,iCAA8B;AAEvF,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,OAAO,EAAE,KAAK,UAAU,EAAE,yBAAsB;AAIhD,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IASnC;;OAEG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IASnC;;;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AC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAE9D;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH;AAED,OAAO,EAAE,KAAK,oBAAoB,EAAE,CAAC"}
+141
View File
@@ -0,0 +1,141 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileBatches = void 0;
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const headers_1 = require("../../internal/headers.js");
const sleep_1 = require("../../internal/utils/sleep.js");
const Util_1 = require("../../lib/Util.js");
const path_1 = require("../../internal/utils/path.js");
class FileBatches extends resource_1.APIResource {
/**
* Create a vector store file batch.
*/
create(vectorStoreID, body, options) {
return this._client.post((0, path_1.path) `/vector_stores/${vectorStoreID}/file_batches`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store file batch.
*/
retrieve(batchID, params, options) {
const { vector_store_id } = params;
return this._client.get((0, path_1.path) `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Cancel a vector store file batch. This attempts to cancel the processing of
* files in this batch as soon as possible.
*/
cancel(batchID, params, options) {
const { vector_store_id } = params;
return this._client.post((0, path_1.path) `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Create a vector store batch and poll until all files have been processed.
*/
async createAndPoll(vectorStoreId, body, options) {
const batch = await this.create(vectorStoreId, body);
return await this.poll(vectorStoreId, batch.id, options);
}
/**
* Returns a list of vector store files in a batch.
*/
listFiles(batchID, params, options) {
const { vector_store_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (pagination_1.CursorPage), {
query,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Wait for the given file batch to be processed.
*
* Note: this will return even if one of the files failed to process, you need to
* check batch.file_counts.failed_count to handle this case.
*/
async poll(vectorStoreID, batchID, options) {
const headers = (0, headers_1.buildHeaders)([
options?.headers,
{
'X-Stainless-Poll-Helper': 'true',
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
},
]);
while (true) {
const { data: batch, response } = await this.retrieve(batchID, { vector_store_id: vectorStoreID }, {
...options,
headers,
}).withResponse();
switch (batch.status) {
case 'in_progress':
let sleepInterval = 5000;
if (options?.pollIntervalMs) {
sleepInterval = options.pollIntervalMs;
}
else {
const headerInterval = response.headers.get('openai-poll-after-ms');
if (headerInterval) {
const headerIntervalMs = parseInt(headerInterval);
if (!isNaN(headerIntervalMs)) {
sleepInterval = headerIntervalMs;
}
}
}
await (0, sleep_1.sleep)(sleepInterval);
break;
case 'failed':
case 'cancelled':
case 'completed':
return batch;
}
}
}
/**
* Uploads the given files concurrently and then creates a vector store file batch.
*
* The concurrency limit is configurable using the `maxConcurrency` parameter.
*/
async uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options) {
if (files == null || files.length == 0) {
throw new Error(`No \`files\` provided to process. If you've already uploaded files you should use \`.createAndPoll()\` instead`);
}
const configuredConcurrency = options?.maxConcurrency ?? 5;
// We cap the number of workers at the number of files (so we don't start any unnecessary workers)
const concurrencyLimit = Math.min(configuredConcurrency, files.length);
const client = this._client;
const fileIterator = files.values();
const allFileIds = [...fileIds];
// This code is based on this design. The libraries don't accommodate our environment limits.
// https://stackoverflow.com/questions/40639432/what-is-the-best-way-to-limit-concurrency-when-using-es6s-promise-all
async function processFiles(iterator) {
for (let item of iterator) {
const fileObj = await client.files.create({ file: item, purpose: 'assistants' }, options);
allFileIds.push(fileObj.id);
}
}
// Start workers to process results
const workers = Array(concurrencyLimit).fill(fileIterator).map(processFiles);
// Wait for all processing to complete.
await (0, Util_1.allSettledWithThrow)(workers);
return await this.createAndPoll(vectorStoreId, {
file_ids: allFileIds,
});
}
}
exports.FileBatches = FileBatches;
//# sourceMappingURL=file-batches.js.map
@@ -0,0 +1 @@
{"version":3,"file":"file-batches.js","sourceRoot":"","sources":["../../src/resources/vector-stores/file-batches.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,yDAAuF;AACvF,uDAAsD;AAEtD,yDAAmD;AAEnD,4CAAqD;AACrD,uDAAiD;AAEjD,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,aAAqB,EACrB,IAA2B,EAC3B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,kBAAkB,aAAa,eAAe,EAAE;YAC3E,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU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AAE,OAAO,CAAC,CAAC;gBAC1F,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,mCAAmC;QACnC,MAAM,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE7E,uCAAuC;QACvC,MAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YAC7C,QAAQ,EAAE,UAAU;SACrB,CAAC,CAAC;IACL,CAAC;CACF;AArLD,kCAqLC"}
+137
View File
@@ -0,0 +1,137 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { CursorPage } from "../../core/pagination.mjs";
import { buildHeaders } from "../../internal/headers.mjs";
import { sleep } from "../../internal/utils/sleep.mjs";
import { allSettledWithThrow } from "../../lib/Util.mjs";
import { path } from "../../internal/utils/path.mjs";
export class FileBatches extends APIResource {
/**
* Create a vector store file batch.
*/
create(vectorStoreID, body, options) {
return this._client.post(path `/vector_stores/${vectorStoreID}/file_batches`, {
body,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store file batch.
*/
retrieve(batchID, params, options) {
const { vector_store_id } = params;
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Cancel a vector store file batch. This attempts to cancel the processing of
* files in this batch as soon as possible.
*/
cancel(batchID, params, options) {
const { vector_store_id } = params;
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Create a vector store batch and poll until all files have been processed.
*/
async createAndPoll(vectorStoreId, body, options) {
const batch = await this.create(vectorStoreId, body);
return await this.poll(vectorStoreId, batch.id, options);
}
/**
* Returns a list of vector store files in a batch.
*/
listFiles(batchID, params, options) {
const { vector_store_id, ...query } = params;
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
query,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Wait for the given file batch to be processed.
*
* Note: this will return even if one of the files failed to process, you need to
* check batch.file_counts.failed_count to handle this case.
*/
async poll(vectorStoreID, batchID, options) {
const headers = buildHeaders([
options?.headers,
{
'X-Stainless-Poll-Helper': 'true',
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
},
]);
while (true) {
const { data: batch, response } = await this.retrieve(batchID, { vector_store_id: vectorStoreID }, {
...options,
headers,
}).withResponse();
switch (batch.status) {
case 'in_progress':
let sleepInterval = 5000;
if (options?.pollIntervalMs) {
sleepInterval = options.pollIntervalMs;
}
else {
const headerInterval = response.headers.get('openai-poll-after-ms');
if (headerInterval) {
const headerIntervalMs = parseInt(headerInterval);
if (!isNaN(headerIntervalMs)) {
sleepInterval = headerIntervalMs;
}
}
}
await sleep(sleepInterval);
break;
case 'failed':
case 'cancelled':
case 'completed':
return batch;
}
}
}
/**
* Uploads the given files concurrently and then creates a vector store file batch.
*
* The concurrency limit is configurable using the `maxConcurrency` parameter.
*/
async uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options) {
if (files == null || files.length == 0) {
throw new Error(`No \`files\` provided to process. If you've already uploaded files you should use \`.createAndPoll()\` instead`);
}
const configuredConcurrency = options?.maxConcurrency ?? 5;
// We cap the number of workers at the number of files (so we don't start any unnecessary workers)
const concurrencyLimit = Math.min(configuredConcurrency, files.length);
const client = this._client;
const fileIterator = files.values();
const allFileIds = [...fileIds];
// This code is based on this design. The libraries don't accommodate our environment limits.
// https://stackoverflow.com/questions/40639432/what-is-the-best-way-to-limit-concurrency-when-using-es6s-promise-all
async function processFiles(iterator) {
for (let item of iterator) {
const fileObj = await client.files.create({ file: item, purpose: 'assistants' }, options);
allFileIds.push(fileObj.id);
}
}
// Start workers to process results
const workers = Array(concurrencyLimit).fill(fileIterator).map(processFiles);
// Wait for all processing to complete.
await allSettledWithThrow(workers);
return await this.createAndPoll(vectorStoreId, {
file_ids: allFileIds,
});
}
}
//# sourceMappingURL=file-batches.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"file-batches.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/file-batches.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAKlD,OAAO,EAAE,UAAU,EAAsC,kCAA8B;AACvF,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,KAAK,EAAE,uCAAmC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,2BAAuB;AACrD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,aAAqB,EACrB,IAA2B,EAC3B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,aAAa,eAAe,EAAE;YAC3E,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,OAAe,EACf,MAA+B,EAC/B,OAAwB;QAExB,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;QACnC,OAAO,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E7E,uCAAuC;QACvC,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE;YAC7C,QAAQ,EAAE,UAAU;SACrB,CAAC,CAAC;IACL,CAAC;CACF"}
+233
View File
@@ -0,0 +1,233 @@
import { APIResource } from "../../core/resource.mjs";
import * as VectorStoresAPI from "./vector-stores.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { CursorPage, type CursorPageParams, PagePromise, Page } from "../../core/pagination.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
import { Uploadable } from "../../uploads.mjs";
export declare class Files extends APIResource {
/**
* Create a vector store file by attaching a
* [File](https://platform.openai.com/docs/api-reference/files) to a
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
*/
create(vectorStoreID: string, body: FileCreateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Retrieves a vector store file.
*/
retrieve(fileID: string, params: FileRetrieveParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Update attributes on a vector store file.
*/
update(fileID: string, params: FileUpdateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Returns a list of vector store files.
*/
list(vectorStoreID: string, query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoreFilesPage, VectorStoreFile>;
/**
* Delete a vector store file. This will remove the file from the vector store but
* the file itself will not be deleted. To delete the file, use the
* [delete file](https://platform.openai.com/docs/api-reference/files/delete)
* endpoint.
*/
delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<VectorStoreFileDeleted>;
/**
* Attach a file to the given vector store and wait for it to be processed.
*/
createAndPoll(vectorStoreId: string, body: FileCreateParams, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Wait for the vector store file to finish processing.
*
* Note: this will return even if the file failed to process, you need to check
* file.last_error and file.status to handle these cases
*/
poll(vectorStoreID: string, fileID: string, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Upload a file to the `files` API and then attach it to the given vector store.
*
* Note the file will be asynchronously processed (you can use the alternative
* polling helper method to wait for processing to complete).
*/
upload(vectorStoreId: string, file: Uploadable, options?: RequestOptions): Promise<VectorStoreFile>;
/**
* Add a file to a vector store and poll until processing is complete.
*/
uploadAndPoll(vectorStoreId: string, file: Uploadable, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Retrieve the parsed contents of a vector store file.
*/
content(fileID: string, params: FileContentParams, options?: RequestOptions): PagePromise<FileContentResponsesPage, FileContentResponse>;
}
export type VectorStoreFilesPage = CursorPage<VectorStoreFile>;
export type FileContentResponsesPage = Page<FileContentResponse>;
/**
* A list of files attached to a vector store.
*/
export interface VectorStoreFile {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store file was created.
*/
created_at: number;
/**
* The last error associated with this vector store file. Will be `null` if there
* are no errors.
*/
last_error: VectorStoreFile.LastError | null;
/**
* The object type, which is always `vector_store.file`.
*/
object: 'vector_store.file';
/**
* The status of the vector store file, which can be either `in_progress`,
* `completed`, `cancelled`, or `failed`. The status `completed` indicates that the
* vector store file is ready for use.
*/
status: 'in_progress' | 'completed' | 'cancelled' | 'failed';
/**
* The total vector store usage in bytes. Note that this may be different from the
* original file size.
*/
usage_bytes: number;
/**
* The ID of the
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
* that the [File](https://platform.openai.com/docs/api-reference/files) is
* attached to.
*/
vector_store_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The strategy used to chunk the file.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategy;
}
export declare namespace VectorStoreFile {
/**
* The last error associated with this vector store file. Will be `null` if there
* are no errors.
*/
interface LastError {
/**
* One of `server_error`, `unsupported_file`, or `invalid_file`.
*/
code: 'server_error' | 'unsupported_file' | 'invalid_file';
/**
* A human-readable description of the error.
*/
message: string;
}
}
export interface VectorStoreFileDeleted {
id: string;
deleted: boolean;
object: 'vector_store.file.deleted';
}
export interface FileContentResponse {
/**
* The text content
*/
text?: string;
/**
* The content type (currently only `"text"`)
*/
type?: string;
}
export interface FileCreateParams {
/**
* A [File](https://platform.openai.com/docs/api-reference/files) ID that the
* vector store should use. Useful for tools like `file_search` that can access
* files. For multi-file ingestion, we recommend
* [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
* to minimize per-vector-store write requests.
*/
file_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
}
export interface FileRetrieveParams {
/**
* The ID of the vector store that the file belongs to.
*/
vector_store_id: string;
}
export interface FileUpdateParams {
/**
* Path param: The ID of the vector store the file belongs to.
*/
vector_store_id: string;
/**
* Body param: Set of 16 key-value pairs that can be attached to an object. This
* can be useful for storing additional information about the object in a
* structured format, and querying for objects via API or the dashboard. Keys are
* strings with a maximum length of 64 characters. Values are strings with a
* maximum length of 512 characters, booleans, or numbers.
*/
attributes: {
[key: string]: string | number | boolean;
} | null;
}
export interface FileListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;
/**
* Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
*/
filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled';
/**
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
* order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export interface FileDeleteParams {
/**
* The ID of the vector store that the file belongs to.
*/
vector_store_id: string;
}
export interface FileContentParams {
/**
* The ID of the vector store.
*/
vector_store_id: string;
}
export declare namespace Files {
export { type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileContentParams as FileContentParams, };
}
//# sourceMappingURL=files.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"files.d.mts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,KAAK,eAAe,4BAAwB;AACnD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,kCAA8B;AAE7F,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE,OAAO,EAAE,UAAU,EAAE,0BAAsB;AAG3C,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAS9B;;OAEG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAS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AK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
+233
View File
@@ -0,0 +1,233 @@
import { APIResource } from "../../core/resource.js";
import * as VectorStoresAPI from "./vector-stores.js";
import { APIPromise } from "../../core/api-promise.js";
import { CursorPage, type CursorPageParams, PagePromise, Page } from "../../core/pagination.js";
import { RequestOptions } from "../../internal/request-options.js";
import { Uploadable } from "../../uploads.js";
export declare class Files extends APIResource {
/**
* Create a vector store file by attaching a
* [File](https://platform.openai.com/docs/api-reference/files) to a
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
*/
create(vectorStoreID: string, body: FileCreateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Retrieves a vector store file.
*/
retrieve(fileID: string, params: FileRetrieveParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Update attributes on a vector store file.
*/
update(fileID: string, params: FileUpdateParams, options?: RequestOptions): APIPromise<VectorStoreFile>;
/**
* Returns a list of vector store files.
*/
list(vectorStoreID: string, query?: FileListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoreFilesPage, VectorStoreFile>;
/**
* Delete a vector store file. This will remove the file from the vector store but
* the file itself will not be deleted. To delete the file, use the
* [delete file](https://platform.openai.com/docs/api-reference/files/delete)
* endpoint.
*/
delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise<VectorStoreFileDeleted>;
/**
* Attach a file to the given vector store and wait for it to be processed.
*/
createAndPoll(vectorStoreId: string, body: FileCreateParams, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Wait for the vector store file to finish processing.
*
* Note: this will return even if the file failed to process, you need to check
* file.last_error and file.status to handle these cases
*/
poll(vectorStoreID: string, fileID: string, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Upload a file to the `files` API and then attach it to the given vector store.
*
* Note the file will be asynchronously processed (you can use the alternative
* polling helper method to wait for processing to complete).
*/
upload(vectorStoreId: string, file: Uploadable, options?: RequestOptions): Promise<VectorStoreFile>;
/**
* Add a file to a vector store and poll until processing is complete.
*/
uploadAndPoll(vectorStoreId: string, file: Uploadable, options?: RequestOptions & {
pollIntervalMs?: number;
}): Promise<VectorStoreFile>;
/**
* Retrieve the parsed contents of a vector store file.
*/
content(fileID: string, params: FileContentParams, options?: RequestOptions): PagePromise<FileContentResponsesPage, FileContentResponse>;
}
export type VectorStoreFilesPage = CursorPage<VectorStoreFile>;
export type FileContentResponsesPage = Page<FileContentResponse>;
/**
* A list of files attached to a vector store.
*/
export interface VectorStoreFile {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store file was created.
*/
created_at: number;
/**
* The last error associated with this vector store file. Will be `null` if there
* are no errors.
*/
last_error: VectorStoreFile.LastError | null;
/**
* The object type, which is always `vector_store.file`.
*/
object: 'vector_store.file';
/**
* The status of the vector store file, which can be either `in_progress`,
* `completed`, `cancelled`, or `failed`. The status `completed` indicates that the
* vector store file is ready for use.
*/
status: 'in_progress' | 'completed' | 'cancelled' | 'failed';
/**
* The total vector store usage in bytes. Note that this may be different from the
* original file size.
*/
usage_bytes: number;
/**
* The ID of the
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object)
* that the [File](https://platform.openai.com/docs/api-reference/files) is
* attached to.
*/
vector_store_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The strategy used to chunk the file.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategy;
}
export declare namespace VectorStoreFile {
/**
* The last error associated with this vector store file. Will be `null` if there
* are no errors.
*/
interface LastError {
/**
* One of `server_error`, `unsupported_file`, or `invalid_file`.
*/
code: 'server_error' | 'unsupported_file' | 'invalid_file';
/**
* A human-readable description of the error.
*/
message: string;
}
}
export interface VectorStoreFileDeleted {
id: string;
deleted: boolean;
object: 'vector_store.file.deleted';
}
export interface FileContentResponse {
/**
* The text content
*/
text?: string;
/**
* The content type (currently only `"text"`)
*/
type?: string;
}
export interface FileCreateParams {
/**
* A [File](https://platform.openai.com/docs/api-reference/files) ID that the
* vector store should use. Useful for tools like `file_search` that can access
* files. For multi-file ingestion, we recommend
* [`file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
* to minimize per-vector-store write requests.
*/
file_id: string;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes?: {
[key: string]: string | number | boolean;
} | null;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam;
}
export interface FileRetrieveParams {
/**
* The ID of the vector store that the file belongs to.
*/
vector_store_id: string;
}
export interface FileUpdateParams {
/**
* Path param: The ID of the vector store the file belongs to.
*/
vector_store_id: string;
/**
* Body param: Set of 16 key-value pairs that can be attached to an object. This
* can be useful for storing additional information about the object in a
* structured format, and querying for objects via API or the dashboard. Keys are
* strings with a maximum length of 64 characters. Values are strings with a
* maximum length of 512 characters, booleans, or numbers.
*/
attributes: {
[key: string]: string | number | boolean;
} | null;
}
export interface FileListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;
/**
* Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.
*/
filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled';
/**
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
* order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export interface FileDeleteParams {
/**
* The ID of the vector store that the file belongs to.
*/
vector_store_id: string;
}
export interface FileContentParams {
/**
* The ID of the vector store.
*/
vector_store_id: string;
}
export declare namespace Files {
export { type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileContentParams as FileContentParams, };
}
//# sourceMappingURL=files.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,eAAe,2BAAwB;AACnD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,WAAW,EAAE,IAAI,EAAE,iCAA8B;AAE7F,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,OAAO,EAAE,UAAU,EAAE,yBAAsB;AAG3C,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAS9B;;OAEG;IACH,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,eAAe,CAAC;IAS9B;;OA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AkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
+151
View File
@@ -0,0 +1,151 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Files = void 0;
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const headers_1 = require("../../internal/headers.js");
const utils_1 = require("../../internal/utils.js");
const path_1 = require("../../internal/utils/path.js");
class Files extends resource_1.APIResource {
/**
* Create a vector store file by attaching a
* [File](https://platform.openai.com/docs/api-reference/files) to a
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
*/
create(vectorStoreID, body, options) {
return this._client.post((0, path_1.path) `/vector_stores/${vectorStoreID}/files`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store file.
*/
retrieve(fileID, params, options) {
const { vector_store_id } = params;
return this._client.get((0, path_1.path) `/vector_stores/${vector_store_id}/files/${fileID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Update attributes on a vector store file.
*/
update(fileID, params, options) {
const { vector_store_id, ...body } = params;
return this._client.post((0, path_1.path) `/vector_stores/${vector_store_id}/files/${fileID}`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Returns a list of vector store files.
*/
list(vectorStoreID, query = {}, options) {
return this._client.getAPIList((0, path_1.path) `/vector_stores/${vectorStoreID}/files`, (pagination_1.CursorPage), {
query,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Delete a vector store file. This will remove the file from the vector store but
* the file itself will not be deleted. To delete the file, use the
* [delete file](https://platform.openai.com/docs/api-reference/files/delete)
* endpoint.
*/
delete(fileID, params, options) {
const { vector_store_id } = params;
return this._client.delete((0, path_1.path) `/vector_stores/${vector_store_id}/files/${fileID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Attach a file to the given vector store and wait for it to be processed.
*/
async createAndPoll(vectorStoreId, body, options) {
const file = await this.create(vectorStoreId, body, options);
return await this.poll(vectorStoreId, file.id, options);
}
/**
* Wait for the vector store file to finish processing.
*
* Note: this will return even if the file failed to process, you need to check
* file.last_error and file.status to handle these cases
*/
async poll(vectorStoreID, fileID, options) {
const headers = (0, headers_1.buildHeaders)([
options?.headers,
{
'X-Stainless-Poll-Helper': 'true',
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
},
]);
while (true) {
const fileResponse = await this.retrieve(fileID, {
vector_store_id: vectorStoreID,
}, { ...options, headers }).withResponse();
const file = fileResponse.data;
switch (file.status) {
case 'in_progress':
let sleepInterval = 5000;
if (options?.pollIntervalMs) {
sleepInterval = options.pollIntervalMs;
}
else {
const headerInterval = fileResponse.response.headers.get('openai-poll-after-ms');
if (headerInterval) {
const headerIntervalMs = parseInt(headerInterval);
if (!isNaN(headerIntervalMs)) {
sleepInterval = headerIntervalMs;
}
}
}
await (0, utils_1.sleep)(sleepInterval);
break;
case 'failed':
case 'completed':
return file;
}
}
}
/**
* Upload a file to the `files` API and then attach it to the given vector store.
*
* Note the file will be asynchronously processed (you can use the alternative
* polling helper method to wait for processing to complete).
*/
async upload(vectorStoreId, file, options) {
const fileInfo = await this._client.files.create({ file: file, purpose: 'assistants' }, options);
return this.create(vectorStoreId, { file_id: fileInfo.id }, options);
}
/**
* Add a file to a vector store and poll until processing is complete.
*/
async uploadAndPoll(vectorStoreId, file, options) {
const fileInfo = await this.upload(vectorStoreId, file, options);
return await this.poll(vectorStoreId, fileInfo.id, options);
}
/**
* Retrieve the parsed contents of a vector store file.
*/
content(fileID, params, options) {
const { vector_store_id } = params;
return this._client.getAPIList((0, path_1.path) `/vector_stores/${vector_store_id}/files/${fileID}/content`, (pagination_1.Page), {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
}
exports.Files = Files;
//# sourceMappingURL=files.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,yDAA6F;AAC7F,uDAAsD;AAEtD,mDAA6C;AAE7C,uDAAiD;AAEjD,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAqB,EACrB,IAAsB,EACtB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,kBAAkB,aAAa,QAAQ,EAAE;YACpE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,MAAc,EACd,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,kBAAkB,eAAe,UAAU,MAAM,EAAE,EAAE;YAC/E,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,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OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,IAAA,WAAI,EAAA,kBAAkB,eAAe,UAAU,MAAM,UAAU,EAC/D,CAAA,iBAAyB,CAAA,EACzB;YACE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CACF,CAAC;IACJ,CAAC;CACF;AA5LD,sBA4LC"}
+147
View File
@@ -0,0 +1,147 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { CursorPage, Page } from "../../core/pagination.mjs";
import { buildHeaders } from "../../internal/headers.mjs";
import { sleep } from "../../internal/utils.mjs";
import { path } from "../../internal/utils/path.mjs";
export class Files extends APIResource {
/**
* Create a vector store file by attaching a
* [File](https://platform.openai.com/docs/api-reference/files) to a
* [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).
*/
create(vectorStoreID, body, options) {
return this._client.post(path `/vector_stores/${vectorStoreID}/files`, {
body,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store file.
*/
retrieve(fileID, params, options) {
const { vector_store_id } = params;
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Update attributes on a vector store file.
*/
update(fileID, params, options) {
const { vector_store_id, ...body } = params;
return this._client.post(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
body,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Returns a list of vector store files.
*/
list(vectorStoreID, query = {}, options) {
return this._client.getAPIList(path `/vector_stores/${vectorStoreID}/files`, (CursorPage), {
query,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Delete a vector store file. This will remove the file from the vector store but
* the file itself will not be deleted. To delete the file, use the
* [delete file](https://platform.openai.com/docs/api-reference/files/delete)
* endpoint.
*/
delete(fileID, params, options) {
const { vector_store_id } = params;
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Attach a file to the given vector store and wait for it to be processed.
*/
async createAndPoll(vectorStoreId, body, options) {
const file = await this.create(vectorStoreId, body, options);
return await this.poll(vectorStoreId, file.id, options);
}
/**
* Wait for the vector store file to finish processing.
*
* Note: this will return even if the file failed to process, you need to check
* file.last_error and file.status to handle these cases
*/
async poll(vectorStoreID, fileID, options) {
const headers = buildHeaders([
options?.headers,
{
'X-Stainless-Poll-Helper': 'true',
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
},
]);
while (true) {
const fileResponse = await this.retrieve(fileID, {
vector_store_id: vectorStoreID,
}, { ...options, headers }).withResponse();
const file = fileResponse.data;
switch (file.status) {
case 'in_progress':
let sleepInterval = 5000;
if (options?.pollIntervalMs) {
sleepInterval = options.pollIntervalMs;
}
else {
const headerInterval = fileResponse.response.headers.get('openai-poll-after-ms');
if (headerInterval) {
const headerIntervalMs = parseInt(headerInterval);
if (!isNaN(headerIntervalMs)) {
sleepInterval = headerIntervalMs;
}
}
}
await sleep(sleepInterval);
break;
case 'failed':
case 'completed':
return file;
}
}
}
/**
* Upload a file to the `files` API and then attach it to the given vector store.
*
* Note the file will be asynchronously processed (you can use the alternative
* polling helper method to wait for processing to complete).
*/
async upload(vectorStoreId, file, options) {
const fileInfo = await this._client.files.create({ file: file, purpose: 'assistants' }, options);
return this.create(vectorStoreId, { file_id: fileInfo.id }, options);
}
/**
* Add a file to a vector store and poll until processing is complete.
*/
async uploadAndPoll(vectorStoreId, file, options) {
const fileInfo = await this.upload(vectorStoreId, file, options);
return await this.poll(vectorStoreId, fileInfo.id, options);
}
/**
* Retrieve the parsed contents of a vector store file.
*/
content(fileID, params, options) {
const { vector_store_id } = params;
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
}
//# sourceMappingURL=files.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"files.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/files.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,OAAO,EAAE,UAAU,EAAsC,IAAI,EAAE,kCAA8B;AAC7F,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,KAAK,EAAE,iCAA6B;AAE7C,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;OAIG;IACH,MAAM,CACJ,aAAqB,EACrB,IAAsB,EACtB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,kBAAkB,aAAa,QAAQ,EAAE;YACpE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,MAAc,EACd,MAA0B,EAC1B,OAAwB;QAExB,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CA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AAe,EAAE,GAAG,MAAM,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,IAAI,CAAA,kBAAkB,eAAe,UAAU,MAAM,UAAU,EAC/D,CAAA,IAAyB,CAAA,EACzB;YACE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CACF,CAAC;IACJ,CAAC;CACF"}
+4
View File
@@ -0,0 +1,4 @@
export { FileBatches, type VectorStoreFileBatch, type FileBatchCreateParams, type FileBatchRetrieveParams, type FileBatchCancelParams, type FileBatchListFilesParams, } from "./file-batches.mjs";
export { Files, type VectorStoreFile, type VectorStoreFileDeleted, type FileContentResponse, type FileCreateParams, type FileRetrieveParams, type FileUpdateParams, type FileListParams, type FileDeleteParams, type FileContentParams, type VectorStoreFilesPage, type FileContentResponsesPage, } from "./files.mjs";
export { VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, type VectorStoreSearchParams, type VectorStoresPage, type VectorStoreSearchResponsesPage, } from "./vector-stores.mjs";
//# sourceMappingURL=index.d.mts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,2BAAuB;AACxB,OAAO,EACL,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,oBAAgB;AACjB,OAAO,EACL,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,GACpC,4BAAwB"}
+4
View File
@@ -0,0 +1,4 @@
export { FileBatches, type VectorStoreFileBatch, type FileBatchCreateParams, type FileBatchRetrieveParams, type FileBatchCancelParams, type FileBatchListFilesParams, } from "./file-batches.js";
export { Files, type VectorStoreFile, type VectorStoreFileDeleted, type FileContentResponse, type FileCreateParams, type FileRetrieveParams, type FileUpdateParams, type FileListParams, type FileDeleteParams, type FileContentParams, type VectorStoreFilesPage, type FileContentResponsesPage, } from "./files.js";
export { VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, type FileChunkingStrategyParam, type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, type VectorStoreSearchParams, type VectorStoresPage, type VectorStoreSearchResponsesPage, } from "./vector-stores.js";
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,GAC9B,0BAAuB;AACxB,OAAO,EACL,KAAK,EACL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,mBAAgB;AACjB,OAAO,EACL,YAAY,EACZ,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,qCAAqC,EAC1C,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,GACpC,2BAAwB"}
+11
View File
@@ -0,0 +1,11 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.VectorStores = exports.Files = exports.FileBatches = void 0;
var file_batches_1 = require("./file-batches.js");
Object.defineProperty(exports, "FileBatches", { enumerable: true, get: function () { return file_batches_1.FileBatches; } });
var files_1 = require("./files.js");
Object.defineProperty(exports, "Files", { enumerable: true, get: function () { return files_1.Files; } });
var vector_stores_1 = require("./vector-stores.js");
Object.defineProperty(exports, "VectorStores", { enumerable: true, get: function () { return vector_stores_1.VectorStores; } });
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAOwB;AANtB,2GAAA,WAAW,OAAA;AAOb,oCAaiB;AAZf,8FAAA,KAAK,OAAA;AAaP,oDAkByB;AAjBvB,6GAAA,YAAY,OAAA"}
+5
View File
@@ -0,0 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
export { FileBatches, } from "./file-batches.mjs";
export { Files, } from "./files.mjs";
export { VectorStores, } from "./vector-stores.mjs";
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,WAAW,GAMZ,2BAAuB;AACxB,OAAO,EACL,KAAK,GAYN,oBAAgB;AACjB,OAAO,EACL,YAAY,GAiBb,4BAAwB"}
+378
View File
@@ -0,0 +1,378 @@
import { APIResource } from "../../core/resource.mjs";
import * as Shared from "../shared.mjs";
import * as FileBatchesAPI from "./file-batches.mjs";
import { FileBatchCancelParams, FileBatchCreateParams, FileBatchListFilesParams, FileBatchRetrieveParams, FileBatches, VectorStoreFileBatch } from "./file-batches.mjs";
import * as FilesAPI from "./files.mjs";
import { FileContentParams, FileContentResponse, FileContentResponsesPage, FileCreateParams, FileDeleteParams, FileListParams, FileRetrieveParams, FileUpdateParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage } from "./files.mjs";
import { APIPromise } from "../../core/api-promise.mjs";
import { CursorPage, type CursorPageParams, Page, PagePromise } from "../../core/pagination.mjs";
import { RequestOptions } from "../../internal/request-options.mjs";
export declare class VectorStores extends APIResource {
files: FilesAPI.Files;
fileBatches: FileBatchesAPI.FileBatches;
/**
* Create a vector store.
*/
create(body: VectorStoreCreateParams, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Retrieves a vector store.
*/
retrieve(vectorStoreID: string, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Modifies a vector store.
*/
update(vectorStoreID: string, body: VectorStoreUpdateParams, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Returns a list of vector stores.
*/
list(query?: VectorStoreListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoresPage, VectorStore>;
/**
* Delete a vector store.
*/
delete(vectorStoreID: string, options?: RequestOptions): APIPromise<VectorStoreDeleted>;
/**
* Search a vector store for relevant chunks based on a query and file attributes
* filter.
*/
search(vectorStoreID: string, body: VectorStoreSearchParams, options?: RequestOptions): PagePromise<VectorStoreSearchResponsesPage, VectorStoreSearchResponse>;
}
export type VectorStoresPage = CursorPage<VectorStore>;
export type VectorStoreSearchResponsesPage = Page<VectorStoreSearchResponse>;
/**
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
* `800` and `chunk_overlap_tokens` of `400`.
*/
export interface AutoFileChunkingStrategyParam {
/**
* Always `auto`.
*/
type: 'auto';
}
/**
* The strategy used to chunk the file.
*/
export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileChunkingStrategyObject;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam;
/**
* This is returned when the chunking strategy is unknown. Typically, this is
* because the file was indexed before the `chunking_strategy` concept was
* introduced in the API.
*/
export interface OtherFileChunkingStrategyObject {
/**
* Always `other`.
*/
type: 'other';
}
export interface StaticFileChunkingStrategy {
/**
* The number of tokens that overlap between chunks. The default value is `400`.
*
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
*/
chunk_overlap_tokens: number;
/**
* The maximum number of tokens in each chunk. The default value is `800`. The
* minimum value is `100` and the maximum value is `4096`.
*/
max_chunk_size_tokens: number;
}
export interface StaticFileChunkingStrategyObject {
static: StaticFileChunkingStrategy;
/**
* Always `static`.
*/
type: 'static';
}
/**
* Customize your own chunking strategy by setting chunk size and chunk overlap.
*/
export interface StaticFileChunkingStrategyObjectParam {
static: StaticFileChunkingStrategy;
/**
* Always `static`.
*/
type: 'static';
}
/**
* A vector store is a collection of processed files can be used by the
* `file_search` tool.
*/
export interface VectorStore {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store was created.
*/
created_at: number;
file_counts: VectorStore.FileCounts;
/**
* The Unix timestamp (in seconds) for when the vector store was last active.
*/
last_active_at: number | null;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name: string;
/**
* The object type, which is always `vector_store`.
*/
object: 'vector_store';
/**
* The status of the vector store, which can be either `expired`, `in_progress`, or
* `completed`. A status of `completed` indicates that the vector store is ready
* for use.
*/
status: 'expired' | 'in_progress' | 'completed';
/**
* The total number of bytes used by the files in the vector store.
*/
usage_bytes: number;
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStore.ExpiresAfter;
/**
* The Unix timestamp (in seconds) for when the vector store will expire.
*/
expires_at?: number | null;
}
export declare namespace VectorStore {
interface FileCounts {
/**
* The number of files that were cancelled.
*/
cancelled: number;
/**
* The number of files that have been successfully processed.
*/
completed: number;
/**
* The number of files that have failed to process.
*/
failed: number;
/**
* The number of files that are currently being processed.
*/
in_progress: number;
/**
* The total number of files.
*/
total: number;
}
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreDeleted {
id: string;
deleted: boolean;
object: 'vector_store.deleted';
}
export interface VectorStoreSearchResponse {
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes: {
[key: string]: string | number | boolean;
} | null;
/**
* Content chunks from the file.
*/
content: Array<VectorStoreSearchResponse.Content>;
/**
* The ID of the vector store file.
*/
file_id: string;
/**
* The name of the vector store file.
*/
filename: string;
/**
* The similarity score for the result.
*/
score: number;
}
export declare namespace VectorStoreSearchResponse {
interface Content {
/**
* The text content returned from search.
*/
text: string;
/**
* The type of content.
*/
type: 'text';
}
}
export interface VectorStoreCreateParams {
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: FileChunkingStrategyParam;
/**
* A description for the vector store. Can be used to describe the vector store's
* purpose.
*/
description?: string;
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStoreCreateParams.ExpiresAfter;
/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the vector store should use. Useful for tools like `file_search` that can access
* files.
*/
file_ids?: Array<string>;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata?: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name?: string;
}
export declare namespace VectorStoreCreateParams {
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreUpdateParams {
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStoreUpdateParams.ExpiresAfter | null;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata?: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name?: string | null;
}
export declare namespace VectorStoreUpdateParams {
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;
/**
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
* order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export interface VectorStoreSearchParams {
/**
* A query string for a search
*/
query: string | Array<string>;
/**
* A filter to apply based on file attributes.
*/
filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
/**
* The maximum number of results to return. This number should be between 1 and 50
* inclusive.
*/
max_num_results?: number;
/**
* Ranking options for search.
*/
ranking_options?: VectorStoreSearchParams.RankingOptions;
/**
* Whether to rewrite the natural language query for vector search.
*/
rewrite_query?: boolean;
}
export declare namespace VectorStoreSearchParams {
/**
* Ranking options for search.
*/
interface RankingOptions {
/**
* Enable re-ranking; set to `none` to disable, which can help reduce latency.
*/
ranker?: 'none' | 'auto' | 'default-2024-11-15';
score_threshold?: number;
}
}
export declare namespace VectorStores {
export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, type VectorStoreSearchParams as VectorStoreSearchParams, };
export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileContentParams as FileContentParams, };
export { FileBatches as FileBatches, type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchRetrieveParams as FileBatchRetrieveParams, type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
}
//# sourceMappingURL=vector-stores.d.mts.map
File diff suppressed because one or more lines are too long
+378
View File
@@ -0,0 +1,378 @@
import { APIResource } from "../../core/resource.js";
import * as Shared from "../shared.js";
import * as FileBatchesAPI from "./file-batches.js";
import { FileBatchCancelParams, FileBatchCreateParams, FileBatchListFilesParams, FileBatchRetrieveParams, FileBatches, VectorStoreFileBatch } from "./file-batches.js";
import * as FilesAPI from "./files.js";
import { FileContentParams, FileContentResponse, FileContentResponsesPage, FileCreateParams, FileDeleteParams, FileListParams, FileRetrieveParams, FileUpdateParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage } from "./files.js";
import { APIPromise } from "../../core/api-promise.js";
import { CursorPage, type CursorPageParams, Page, PagePromise } from "../../core/pagination.js";
import { RequestOptions } from "../../internal/request-options.js";
export declare class VectorStores extends APIResource {
files: FilesAPI.Files;
fileBatches: FileBatchesAPI.FileBatches;
/**
* Create a vector store.
*/
create(body: VectorStoreCreateParams, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Retrieves a vector store.
*/
retrieve(vectorStoreID: string, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Modifies a vector store.
*/
update(vectorStoreID: string, body: VectorStoreUpdateParams, options?: RequestOptions): APIPromise<VectorStore>;
/**
* Returns a list of vector stores.
*/
list(query?: VectorStoreListParams | null | undefined, options?: RequestOptions): PagePromise<VectorStoresPage, VectorStore>;
/**
* Delete a vector store.
*/
delete(vectorStoreID: string, options?: RequestOptions): APIPromise<VectorStoreDeleted>;
/**
* Search a vector store for relevant chunks based on a query and file attributes
* filter.
*/
search(vectorStoreID: string, body: VectorStoreSearchParams, options?: RequestOptions): PagePromise<VectorStoreSearchResponsesPage, VectorStoreSearchResponse>;
}
export type VectorStoresPage = CursorPage<VectorStore>;
export type VectorStoreSearchResponsesPage = Page<VectorStoreSearchResponse>;
/**
* The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
* `800` and `chunk_overlap_tokens` of `400`.
*/
export interface AutoFileChunkingStrategyParam {
/**
* Always `auto`.
*/
type: 'auto';
}
/**
* The strategy used to chunk the file.
*/
export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileChunkingStrategyObject;
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam;
/**
* This is returned when the chunking strategy is unknown. Typically, this is
* because the file was indexed before the `chunking_strategy` concept was
* introduced in the API.
*/
export interface OtherFileChunkingStrategyObject {
/**
* Always `other`.
*/
type: 'other';
}
export interface StaticFileChunkingStrategy {
/**
* The number of tokens that overlap between chunks. The default value is `400`.
*
* Note that the overlap must not exceed half of `max_chunk_size_tokens`.
*/
chunk_overlap_tokens: number;
/**
* The maximum number of tokens in each chunk. The default value is `800`. The
* minimum value is `100` and the maximum value is `4096`.
*/
max_chunk_size_tokens: number;
}
export interface StaticFileChunkingStrategyObject {
static: StaticFileChunkingStrategy;
/**
* Always `static`.
*/
type: 'static';
}
/**
* Customize your own chunking strategy by setting chunk size and chunk overlap.
*/
export interface StaticFileChunkingStrategyObjectParam {
static: StaticFileChunkingStrategy;
/**
* Always `static`.
*/
type: 'static';
}
/**
* A vector store is a collection of processed files can be used by the
* `file_search` tool.
*/
export interface VectorStore {
/**
* The identifier, which can be referenced in API endpoints.
*/
id: string;
/**
* The Unix timestamp (in seconds) for when the vector store was created.
*/
created_at: number;
file_counts: VectorStore.FileCounts;
/**
* The Unix timestamp (in seconds) for when the vector store was last active.
*/
last_active_at: number | null;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name: string;
/**
* The object type, which is always `vector_store`.
*/
object: 'vector_store';
/**
* The status of the vector store, which can be either `expired`, `in_progress`, or
* `completed`. A status of `completed` indicates that the vector store is ready
* for use.
*/
status: 'expired' | 'in_progress' | 'completed';
/**
* The total number of bytes used by the files in the vector store.
*/
usage_bytes: number;
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStore.ExpiresAfter;
/**
* The Unix timestamp (in seconds) for when the vector store will expire.
*/
expires_at?: number | null;
}
export declare namespace VectorStore {
interface FileCounts {
/**
* The number of files that were cancelled.
*/
cancelled: number;
/**
* The number of files that have been successfully processed.
*/
completed: number;
/**
* The number of files that have failed to process.
*/
failed: number;
/**
* The number of files that are currently being processed.
*/
in_progress: number;
/**
* The total number of files.
*/
total: number;
}
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreDeleted {
id: string;
deleted: boolean;
object: 'vector_store.deleted';
}
export interface VectorStoreSearchResponse {
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard. Keys are strings with a maximum
* length of 64 characters. Values are strings with a maximum length of 512
* characters, booleans, or numbers.
*/
attributes: {
[key: string]: string | number | boolean;
} | null;
/**
* Content chunks from the file.
*/
content: Array<VectorStoreSearchResponse.Content>;
/**
* The ID of the vector store file.
*/
file_id: string;
/**
* The name of the vector store file.
*/
filename: string;
/**
* The similarity score for the result.
*/
score: number;
}
export declare namespace VectorStoreSearchResponse {
interface Content {
/**
* The text content returned from search.
*/
text: string;
/**
* The type of content.
*/
type: 'text';
}
}
export interface VectorStoreCreateParams {
/**
* The chunking strategy used to chunk the file(s). If not set, will use the `auto`
* strategy. Only applicable if `file_ids` is non-empty.
*/
chunking_strategy?: FileChunkingStrategyParam;
/**
* A description for the vector store. Can be used to describe the vector store's
* purpose.
*/
description?: string;
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStoreCreateParams.ExpiresAfter;
/**
* A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that
* the vector store should use. Useful for tools like `file_search` that can access
* files.
*/
file_ids?: Array<string>;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata?: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name?: string;
}
export declare namespace VectorStoreCreateParams {
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreUpdateParams {
/**
* The expiration policy for a vector store.
*/
expires_after?: VectorStoreUpdateParams.ExpiresAfter | null;
/**
* Set of 16 key-value pairs that can be attached to an object. This can be useful
* for storing additional information about the object in a structured format, and
* querying for objects via API or the dashboard.
*
* Keys are strings with a maximum length of 64 characters. Values are strings with
* a maximum length of 512 characters.
*/
metadata?: Shared.Metadata | null;
/**
* The name of the vector store.
*/
name?: string | null;
}
export declare namespace VectorStoreUpdateParams {
/**
* The expiration policy for a vector store.
*/
interface ExpiresAfter {
/**
* Anchor timestamp after which the expiration policy applies. Supported anchors:
* `last_active_at`.
*/
anchor: 'last_active_at';
/**
* The number of days after the anchor time that the vector store will expire.
*/
days: number;
}
}
export interface VectorStoreListParams extends CursorPageParams {
/**
* A cursor for use in pagination. `before` is an object ID that defines your place
* in the list. For instance, if you make a list request and receive 100 objects,
* starting with obj_foo, your subsequent call can include before=obj_foo in order
* to fetch the previous page of the list.
*/
before?: string;
/**
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
* order and `desc` for descending order.
*/
order?: 'asc' | 'desc';
}
export interface VectorStoreSearchParams {
/**
* A query string for a search
*/
query: string | Array<string>;
/**
* A filter to apply based on file attributes.
*/
filters?: Shared.ComparisonFilter | Shared.CompoundFilter;
/**
* The maximum number of results to return. This number should be between 1 and 50
* inclusive.
*/
max_num_results?: number;
/**
* Ranking options for search.
*/
ranking_options?: VectorStoreSearchParams.RankingOptions;
/**
* Whether to rewrite the natural language query for vector search.
*/
rewrite_query?: boolean;
}
export declare namespace VectorStoreSearchParams {
/**
* Ranking options for search.
*/
interface RankingOptions {
/**
* Enable re-ranking; set to `none` to disable, which can help reduce latency.
*/
ranker?: 'none' | 'auto' | 'default-2024-11-15';
score_threshold?: number;
}
}
export declare namespace VectorStores {
export { type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, type FileChunkingStrategy as FileChunkingStrategy, type FileChunkingStrategyParam as FileChunkingStrategyParam, type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, type VectorStoreSearchParams as VectorStoreSearchParams, };
export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileContentParams as FileContentParams, };
export { FileBatches as FileBatches, type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, type FileBatchRetrieveParams as FileBatchRetrieveParams, type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, };
}
//# sourceMappingURL=vector-stores.d.ts.map
File diff suppressed because one or more lines are too long
+90
View File
@@ -0,0 +1,90 @@
"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.VectorStores = void 0;
const tslib_1 = require("../../internal/tslib.js");
const resource_1 = require("../../core/resource.js");
const FileBatchesAPI = tslib_1.__importStar(require("./file-batches.js"));
const file_batches_1 = require("./file-batches.js");
const FilesAPI = tslib_1.__importStar(require("./files.js"));
const files_1 = require("./files.js");
const pagination_1 = require("../../core/pagination.js");
const headers_1 = require("../../internal/headers.js");
const path_1 = require("../../internal/utils/path.js");
class VectorStores extends resource_1.APIResource {
constructor() {
super(...arguments);
this.files = new FilesAPI.Files(this._client);
this.fileBatches = new FileBatchesAPI.FileBatches(this._client);
}
/**
* Create a vector store.
*/
create(body, options) {
return this._client.post('/vector_stores', {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store.
*/
retrieve(vectorStoreID, options) {
return this._client.get((0, path_1.path) `/vector_stores/${vectorStoreID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Modifies a vector store.
*/
update(vectorStoreID, body, options) {
return this._client.post((0, path_1.path) `/vector_stores/${vectorStoreID}`, {
body,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Returns a list of vector stores.
*/
list(query = {}, options) {
return this._client.getAPIList('/vector_stores', (pagination_1.CursorPage), {
query,
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Delete a vector store.
*/
delete(vectorStoreID, options) {
return this._client.delete((0, path_1.path) `/vector_stores/${vectorStoreID}`, {
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Search a vector store for relevant chunks based on a query and file attributes
* filter.
*/
search(vectorStoreID, body, options) {
return this._client.getAPIList((0, path_1.path) `/vector_stores/${vectorStoreID}/search`, (pagination_1.Page), {
body,
method: 'post',
...options,
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
}
exports.VectorStores = VectorStores;
VectorStores.Files = files_1.Files;
VectorStores.FileBatches = file_batches_1.FileBatches;
//# sourceMappingURL=vector-stores.js.map
@@ -0,0 +1 @@
{"version":3,"file":"vector-stores.js","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.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AO,CAAC,CAAC;YAC7E,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;SACjC,CACF,CAAC;IACJ,CAAC;CACF;AA1FD,oCA0FC;AA6YD,YAAY,CAAC,KAAK,GAAG,aAAK,CAAC;AAC3B,YAAY,CAAC,WAAW,GAAG,0BAAW,CAAC"}
+85
View File
@@ -0,0 +1,85 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import * as FileBatchesAPI from "./file-batches.mjs";
import { FileBatches, } from "./file-batches.mjs";
import * as FilesAPI from "./files.mjs";
import { Files, } from "./files.mjs";
import { CursorPage, Page } from "../../core/pagination.mjs";
import { buildHeaders } from "../../internal/headers.mjs";
import { path } from "../../internal/utils/path.mjs";
export class VectorStores extends APIResource {
constructor() {
super(...arguments);
this.files = new FilesAPI.Files(this._client);
this.fileBatches = new FileBatchesAPI.FileBatches(this._client);
}
/**
* Create a vector store.
*/
create(body, options) {
return this._client.post('/vector_stores', {
body,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Retrieves a vector store.
*/
retrieve(vectorStoreID, options) {
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Modifies a vector store.
*/
update(vectorStoreID, body, options) {
return this._client.post(path `/vector_stores/${vectorStoreID}`, {
body,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Returns a list of vector stores.
*/
list(query = {}, options) {
return this._client.getAPIList('/vector_stores', (CursorPage), {
query,
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Delete a vector store.
*/
delete(vectorStoreID, options) {
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
/**
* Search a vector store for relevant chunks based on a query and file attributes
* filter.
*/
search(vectorStoreID, body, options) {
return this._client.getAPIList(path `/vector_stores/${vectorStoreID}/search`, (Page), {
body,
method: 'post',
...options,
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
__security: { bearerAuth: true },
});
}
}
VectorStores.Files = Files;
VectorStores.FileBatches = FileBatches;
//# sourceMappingURL=vector-stores.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"vector-stores.mjs","sourceRoot":"","sources":["../../src/resources/vector-stores/vector-stores.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,KAAK,cAAc,2BAAuB;AACjD,OAAO,EAKL,WAAW,GAEZ,2BAAuB;AACxB,OAAO,KAAK,QAAQ,oBAAgB;AACpC,OAAO,EASL,KAAK,GAIN,oBAAgB;AAEjB,OAAO,EAAE,UAAU,EAAyB,IAAI,EAAe,kCAA8B;AAC7F,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD,MAAM,OAAO,YAAa,SAAQ,WAAW;IAA7C;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAwFzF,CAAC;IAtFC;;OAEG;IACH,MAAM,CAAC,IAA6B,EAAE,OAAwB;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACzC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EA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