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.

Hierarchy (view full)

Constructors - Constructor

Properties

#apikey: string
files: Files

Files instance for managing batch inference files.

httpsAgentMap: WatsonXAI.HttpsAgentMap = ...
projectId?: string
serviceUrl: string

URL required for watsonx inference endpoints

spaceId?: string
version: string

The version date for the API of the form YYYY-MM-DD.

wxServiceUrl: string

URL required for dataplatform endpoints

PLATFORM_URLS_MAP: Record<string, string> = PLATFORM_URL_MAPPINGS

Methods

  • Protected

    Forms container ID headers based on project ID or space ID.

    This method creates the appropriate IBM-specific headers for identifying the container (project or space) that the API request should operate within. It prioritizes parameters passed in the request over instance-level defaults.

    Parameters

    • Optional params: ContextIdentifiers = {}

      Container identifiers (projectId or spaceId). Default is {}

    • requireContainerId: boolean = false

    Returns {} | {
        X-IBM-PROJECT-ID: string;
    } | {
        X-IBM-SPACE-ID: string;
    }

    An object containing either the project ID header, space ID header, or an empty object if neither is provided

  • Protected

    Appends additional data to request headers.

    This utility method merges override headers with existing headers in the parameters object, ensuring that custom headers are properly combined without losing existing header data.

    Type Parameters

    Parameters

    • params: T

      The request parameters containing existing headers

    • overrides: Record<string, any>

      Additional headers to merge into the request

    Returns T

    A new parameters object with merged headers

  • Private

    Resolves projectId and spaceId with fallback to instance values.

    This method implements a priority-based resolution strategy:

    1. If both instance values (this.projectId/this.spaceId) AND parameter values exist, parameter values take absolute precedence and instance values are ignored
    2. Otherwise, parameter values are used if provided, falling back to instance values

    This ensures that explicitly passed parameters always override instance configuration when both are present, preventing unintended mixing of project and space contexts.

    Parameters

    • params: {
          projectId?: string;
          spaceId?: string;
      }

      Object containing optional projectId and spaceId

      • Optional projectId?: string

        The project ID to use for the request

      • Optional spaceId?: string

        The space ID to use for the request

    Returns {
        projectId?: string;
        spaceId?: string;
    }

    Resolved projectId and spaceId values

    • Optional projectId?: string
    • Optional spaceId?: string