basant307/AI_Governance_Project
048
1import { APIResource } from "../core/resource.mjs";2import * as BatchesAPI from "./batches.mjs";3import * as Shared from "./shared.mjs";4import { APIPromise } from "../core/api-promise.mjs";5import { CursorPage, type CursorPageParams, PagePromise } from "../core/pagination.mjs";6import { RequestOptions } from "../internal/request-options.mjs";7export declare class Batches extends APIResource {8 /**9 * Creates and executes a batch from an uploaded file of requests10 */11 create(body: BatchCreateParams, options?: RequestOptions): APIPromise<Batch>;12 /**13 * Retrieves a batch.14 */15 retrieve(batchID: string, options?: RequestOptions): APIPromise<Batch>;16 /**17 * List your organization's batches.18 */19 list(query?: BatchListParams | null | undefined, options?: RequestOptions): PagePromise<BatchesPage, Batch>;20 /**21 * Cancels an in-progress batch. The batch will be in status `cancelling` for up to22 * 10 minutes, before changing to `cancelled`, where it will have partial results23 * (if any) available in the output file.24 */25 cancel(batchID: string, options?: RequestOptions): APIPromise<Batch>;26}27export type BatchesPage = CursorPage<Batch>;28export interface Batch {29 id: string;30 /**31 * The time frame within which the batch should be processed.32 */33 completion_window: string;34 /**35 * The Unix timestamp (in seconds) for when the batch was created.36 */37 created_at: number;38 /**39 * The OpenAI API endpoint used by the batch.40 */41 endpoint: string;42 /**43 * The ID of the input file for the batch.44 */45 input_file_id: string;46 /**47 * The object type, which is always `batch`.48 */49 object: 'batch';50 /**51 * The current status of the batch.52 */53 status: 'validating' | 'failed' | 'in_progress' | 'finalizing' | 'completed' | 'expired' | 'cancelling' | 'cancelled';54 /**55 * The Unix timestamp (in seconds) for when the batch was cancelled.56 */57 cancelled_at?: number;58 /**59 * The Unix timestamp (in seconds) for when the batch started cancelling.60 */61 cancelling_at?: number;62 /**63 * The Unix timestamp (in seconds) for when the batch was completed.64 */65 completed_at?: number;66 /**67 * The ID of the file containing the outputs of requests with errors.68 */69 error_file_id?: string;70 errors?: Batch.Errors;71 /**72 * The Unix timestamp (in seconds) for when the batch expired.73 */74 expired_at?: number;75 /**76 * The Unix timestamp (in seconds) for when the batch will expire.77 */78 expires_at?: number;79 /**80 * The Unix timestamp (in seconds) for when the batch failed.81 */82 failed_at?: number;83 /**84 * The Unix timestamp (in seconds) for when the batch started finalizing.85 */86 finalizing_at?: number;87 /**88 * The Unix timestamp (in seconds) for when the batch started processing.89 */90 in_progress_at?: number;91 /**92 * Set of 16 key-value pairs that can be attached to an object. This can be useful93 * for storing additional information about the object in a structured format, and94 * querying for objects via API or the dashboard.95 *96 * Keys are strings with a maximum length of 64 characters. Values are strings with97 * a maximum length of 512 characters.98 */99 metadata?: Shared.Metadata | null;100 /**101 * The ID of the file containing the outputs of successfully executed requests.102 */103 output_file_id?: string;104 /**105 * The request counts for different statuses within the batch.106 */107 request_counts?: BatchRequestCounts;108}109export declare namespace Batch {110 interface Errors {111 data?: Array<BatchesAPI.BatchError>;112 /**113 * The object type, which is always `list`.114 */115 object?: string;116 }117}118export interface BatchError {119 /**120 * An error code identifying the error type.121 */122 code?: string;123 /**124 * The line number of the input file where the error occurred, if applicable.125 */126 line?: number | null;127 /**128 * A human-readable message providing more details about the error.129 */130 message?: string;131 /**132 * The name of the parameter that caused the error, if applicable.133 */134 param?: string | null;135}136/**137 * The request counts for different statuses within the batch.138 */139export interface BatchRequestCounts {140 /**141 * Number of requests that have been completed successfully.142 */143 completed: number;144 /**145 * Number of requests that have failed.146 */147 failed: number;148 /**149 * Total number of requests in the batch.150 */151 total: number;152}153export interface BatchCreateParams {154 /**155 * The time frame within which the batch should be processed. Currently only `24h`156 * is supported.157 */158 completion_window: '24h';159 /**160 * The endpoint to be used for all requests in the batch. Currently161 * `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions`162 * are supported. Note that `/v1/embeddings` batches are also restricted to a163 * maximum of 50,000 embedding inputs across all requests in the batch.164 */165 endpoint: '/v1/responses' | '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions';166 /**167 * The ID of an uploaded file that contains requests for the new batch.168 *169 * See [upload file](https://platform.openai.com/docs/api-reference/files/create)170 * for how to upload a file.171 *172 * Your input file must be formatted as a173 * [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),174 * and must be uploaded with the purpose `batch`. The file can contain up to 50,000175 * requests, and can be up to 200 MB in size.176 */177 input_file_id: string;178 /**179 * Set of 16 key-value pairs that can be attached to an object. This can be useful180 * for storing additional information about the object in a structured format, and181 * querying for objects via API or the dashboard.182 *183 * Keys are strings with a maximum length of 64 characters. Values are strings with184 * a maximum length of 512 characters.185 */186 metadata?: Shared.Metadata | null;187}188export interface BatchListParams extends CursorPageParams {189}190export declare namespace Batches {191 export { type Batch as Batch, type BatchError as BatchError, type BatchRequestCounts as BatchRequestCounts, type BatchesPage as BatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, };192}193//# sourceMappingURL=batches.d.mts.map