Constructs an instance of WatsonxBaseService with passed in options and external configuration.
Optional options: UserOptions & WatsonXAI.Certificates & WatsonXAI.TokenAuthenticationOptions = {}The parameters to send to the service.
Optional projectURL required for watsonx inference endpoints
Optional spaceThe version date for the API of the form YYYY-MM-DD.
URL required for dataplatform endpoints
Static PLATFORM_Protected _formProtected 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.
Optional params: ContextIdentifiers = {}Container identifiers (projectId or spaceId). Default
is {}
An object containing either the project ID header, space ID header, or an empty object if neither is provided
Performs a POST request to the specified URL and returns a stream.
The parameters for the POST request.
Protected appendProtected 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.
The type of parameters, constrained to request parameter types with container identifiers
The request parameters containing existing headers
Additional headers to merge into the request
A new parameters object with merged headers
Private resolvePrivate Resolves projectId and spaceId with fallback to instance values.
This method implements a priority-based resolution strategy:
This ensures that explicitly passed parameters always override instance configuration when both are present, preventing unintended mixing of project and space contexts.
Object containing optional projectId and spaceId
Optional projectThe project ID to use for the request
Optional spaceThe space ID to use for the request
Resolved projectId and spaceId values
Optional projectOptional space
APIBaseService class extends WatsonxBaseService and provides common API request functionalities.