UNPKG

@ibm-cloud/watsonx-ai

Version:
112 lines 6.11 kB
/** * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ import type { UserOptions } from 'ibm-cloud-sdk-core'; import { APIBaseService } from "../base/index.mjs"; import type { Batch, BatchCollection, CancelBatchParams, CreateBatchParams, GetBatchParams, ListAllBatchesParams } from "./types/index.mjs"; import type { GetParameters, PostParameters, Response } from "../base/index.mjs"; import { Files } from "./files.mjs"; import type { ContextIdentifiers } from "../types/common.mjs"; /** * Service for managing batch inference operations in watsonx.ai. * * Provides methods to create, retrieve, list, and cancel batch inference jobs, as well as manage * associated files through the Files instance. */ export declare class BatchInference extends APIBaseService { #private; /** Files instance for managing batch inference files. */ files: Files; /** * Constructs an instance of BatchInference with passed in options and external configuration. * * @category Constructor * @param {UserOptions} options - The parameters to send to the service. * @param {string} [options.apikey] - API key for authentication * @param {string} [options.serviceName] - The name of the service to configure * @param {string} [options.serviceUrl] - The base URL for the service */ constructor(options: UserOptions); _get<T>(params: GetParameters & ContextIdentifiers): Promise<Response<T>>; _post<T>(params: PostParameters & ContextIdentifiers): Promise<Response<T>>; /** * Create a new batch inference job. * * Creates a batch inference job with the specified input file, endpoint, and completion window. * The batch job will process requests from the input file and generate results. * * @param {Object} params - The parameters to send to the service. * @param {string} params.inputFileId - ID of the uploaded input file for the batch job. * @param {string} params.endpoint - API endpoint to use for processing each batch item. * @param {string} params.completionWindow - Time window for completion of the batch job. * @param {string} [params.projectId] - The project that contains the resource. Either `projectId` * or `spaceId` has to be given. * @param {string} [params.spaceId] - The space that contains the resource. Either `spaceId` or * `projectId` has to be given. * @param {Record<string, string>} [params.metadata] - Additional metadata for the batch job. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<Response<Batch>>} A promise that resolves to the response with batch job data */ create(params: CreateBatchParams): Promise<Response<Batch>>; /** * Retrieve batch job details or list all batch jobs. * * When called with `batchId`, retrieves details of a specific batch job. When called without * `batchId`, retrieves a list of all batch jobs. * * @param {Object} params - The parameters to send to the service. * @param {string} [params.batchId] - The ID of the batch job to retrieve. * @param {string} [params.projectId] - The project that contains the resource. Either `projectId` * or `spaceId` has to be given. * @param {string} [params.spaceId] - The space that contains the resource. Either `spaceId` or * `projectId` has to be given. * @param {number} [params.limit] - Maximum number of batch jobs to return. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<Response<Batch | BatchCollection>>} A promise that resolves to either a * single batch job or a collection of batch jobs */ getDetails(params: ListAllBatchesParams): Promise<Response<BatchCollection>>; getDetails(params: GetBatchParams): Promise<Response<Batch>>; /** * List all batch jobs. * * Retrieves a list of all batch jobs for the specified space or project. * * @param {Object} params - The parameters to send to the service. * @param {string} [params.projectId] - The project that contains the resource. Either `projectId` * or `spaceId` has to be given. * @param {string} [params.spaceId] - The space that contains the resource. Either `spaceId` or * `projectId` has to be given. * @param {number} [params.limit] - Maximum number of batch jobs to return. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<Batch[]>} A promise that resolves to an array of batch jobs */ list(params: ListAllBatchesParams): Promise<Batch[]>; /** * Cancel a batch inference job. * * Cancels a batch inference job that is in progress. Once cancelled, the job cannot be resumed. * * @param {Object} params - The parameters to send to the service. * @param {string} params.batchId - The ID of the batch job to cancel. * @param {string} [params.projectId] - The project that contains the resource. Either `projectId` * or `spaceId` has to be given. * @param {string} [params.spaceId] - The space that contains the resource. Either `spaceId` or * `projectId` has to be given. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<Response<Batch>>} A promise that resolves to the response with cancelled * batch job data */ cancel(params: CancelBatchParams): Promise<Response<Batch>>; } //# sourceMappingURL=batch_inference.d.mts.map