@ibm-cloud/watsonx-ai
Version:
IBM watsonx.ai Node.js SDK
878 lines • 201 kB
text/typescript
/**
* (C) Copyright IBM Corp. 2024-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.
*/
/// <reference types="node" />
import type { UserOptions } from 'ibm-cloud-sdk-core';
import type { Unzip } from 'zlib';
import type { Stream } from "./lib/common.mjs";
import { WatsonxBaseService } from "./base/index.mjs";
import * as Types from "./types/index.mjs";
import * as BaseTypes from "./base/types/index.mjs";
import type { AdditionalCreateRequestParams, CreateRequestParams } from "./types/request.mjs";
/**
* SDK entrypoint for IBM watsonx.ai product. Provides access to IBM watsonx.ai services including
* text generation, embeddings, deployments, and model management.
*
* @example
* ```typescript
* const service = new WatsonXAI({
* version: '2024-03-14',
* serviceUrl: 'https://us-south.ml.cloud.ibm.com',
* authenticator: new IamAuthenticator({ apikey: 'your-api-key' })
* });
* ```;
*
* @class WatsonXAI
* @extends WatsonxBaseService
*/
declare class WatsonXAI extends WatsonxBaseService {
/** @ignore */
static PARAMETERIZED_SERVICE_URL: string;
/** @ignore */
private static defaultUrlVariables;
/**
* Constructs a service URL by formatting the parameterized service URL.
*
* The parameterized service URL is: 'https://{region}.ml.cloud.ibm.com'
*
* The default variable values are:
*
* - 'region': 'us-south'
*
* @param {Map<string, string> | Null} [providedUrlVariables] Map from variable names to desired
* values. If a variable is not provided in this map, the default variable value will be used
* instead.
* @returns {string} The formatted URL with all variable placeholders replaced by values.
*/
static constructServiceUrl(providedUrlVariables: Map<string, string> | null): string;
/** Factory method */
/**
* Constructs an instance of WatsonXAI with passed in options and external configuration.
*
* Ensuring backwards compatibility from v1.7.1. You can now use:
*
* ```typescript
* const service = new WatsonXAI(options);
* ```
*
* @category Constructor
* @param {UserOptions} [options] - The parameters to send to the service.
* @param {string} [options.serviceName] - The name of the service to configure
* @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate
* requests to the service
* @param {string} [options.serviceUrl] - The base URL for the service
* @returns {WatsonXAI} - An instance of the WatsonXAI service
*/
static newInstance(options: UserOptions & WatsonXAI.TokenAuthenticationOptions & WatsonXAI.Certificates): WatsonXAI;
/**
* Creates and executes an HTTP request to the watsonx.ai API. Handles HTTPS agent configuration,
* encryption parameters, and callback hooks.
*
* @template T - The expected response type
* @param {CreateRequestParams} parameters - Request parameters including URL, method, headers,
* and body
* @param {AdditionalCreateRequestParams} [additionalParameters] - Optional additional parameters
* @param {object} [additionalParameters.crypto] - Encryption configuration for the request body
* @param {object} [additionalParameters.callbacks] - Callback handlers for request/response
* lifecycle
* @returns {Promise<T>} Promise resolving to the API response
* @protected
*/
protected createRequest<T>(parameters: CreateRequestParams, additionalParameters?: AdditionalCreateRequestParams): Promise<T>;
/** Deployments */
/**
* Create a new watsonx.ai deployment.
*
* Create a new deployment, currently the only supported type is `online`.
*
* If this is a deployment for a prompt tune then the `asset` object must exist and the `id` must
* be the `id` of the `model` that was created after the prompt training.
*
* If this is a deployment for a prompt template then the `prompt_template` object should exist
* and the `id` must be the `id` of the prompt template to be deployed.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - The name of the resource.
* @param {OnlineDeployment} params.online - Indicates that this is an online deployment. An
* object has to be specified but can be empty. The `serving_name` can be provided in the
* `online.parameters`.
* @param {string} [params.projectId] - The project that contains the resource. Either `space_id`
* or `project_id` has to be given.
* @param {string} [params.spaceId] - The space that contains the resource. Either `space_id` or
* `project_id` has to be given.
* @param {string} [params.description] - A description of the resource.
* @param {string[]} [params.tags] - A list of tags for this resource.
* @param {JsonObject} [params.custom] - User defined properties specified as key-value pairs.
* @param {SimpleRel} [params.promptTemplate] - A reference to a resource.
* @param {HardwareSpec} [params.hardwareSpec] - A hardware specification.
* @param {HardwareRequest} [params.hardwareRequest] - The requested hardware for deployment.
* @param {Rel} [params.asset] - A reference to a resource.
* @param {string} [params.baseModelId] - The base model that is required for this deployment if
* this is for a prompt template or a prompt tune for an IBM foundation model.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>} A promise that resolves to
* the response with deployment's data
*/
createDeployment(params: WatsonXAI.CreateDeploymentParams): Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>;
/**
* Retrieve the deployments.
*
* Retrieve the list of deployments for the specified space or project.
*
* @category Deployments
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.spaceId] - The space that contains the resource. Either `space_id` or
* `project_id` query parameter has to be given.
* @param {string} [params.projectId] - The project that contains the resource. Either `space_id`
* or `project_id` query parameter has to be given.
* @param {string} [params.servingName] - Retrieves the deployment, if any, that contains this
* `serving_name`.
* @param {string} [params.tagValue] - Retrieves only the resources with the given tag value.
* @param {string} [params.assetId] - Retrieves only the resources with the given asset_id,
* asset_id would be the model id.
* @param {string} [params.promptTemplateId] - Retrieves only the resources with the given
* prompt_template_id.
* @param {string} [params.name] - Retrieves only the resources with the given name.
* @param {string} [params.type] - Retrieves the resources filtered with the given type. There are
* the deployment types as well as an additional `prompt_template` if the deployment type
* includes a prompt template.
*
* The supported deployment types are (see the description for `deployed_asset_type` in the
* deployment entity):
*
* 1. `prompt_tune` - when a prompt tuned model is deployed. 2. `foundation_model` - when a prompt
* template is used on a pre-deployed IBM provided model. 3. `custom_foundation_model` -
* when a custom foundation model is deployed.
*
* These can be combined with the flag `prompt_template` like this:
*
* 1. `type=prompt_tune` - return all prompt tuned model deployments. 2. `type=prompt_tune and
* prompt_template` - return all prompt tuned model deployments with a prompt template. 3.
* `type=foundation_model`
*
* - Return all prompt template deployments. 4. `type=foundation_model and prompt_template` - return
* all prompt template deployments - this is the same as the previous query
* because a `foundation_model` can only exist with a prompt template. 5.
* `type=prompt_template` - return all deployments with a prompt template.
*
* @param {string} [params.state] - Retrieves the resources filtered by state. Allowed values are
* `initializing`, `updating`, `ready` and `failed`.
* @param {boolean} [params.conflict] - Returns whether `serving_name` is available for use or
* not. This query parameter cannot be combined with any other parameter except for
* `serving_name`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.DeploymentResourceCollection>>} A Promise that
* resolves to a collection of deployment resources
*/
listDeployments(params?: WatsonXAI.ListDeploymentsParams): Promise<WatsonXAI.Response<WatsonXAI.DeploymentResourceCollection>>;
/**
* Retrieve the deployment details.
*
* Retrieve the deployment details with the specified identifier.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.deploymentId - The deployment id.
* @param {string} [params.spaceId] - The space that contains the resource. Either `space_id` or
* `project_id` query parameter has to be given.
* @param {string} [params.projectId] - The project that contains the resource. Either `space_id`
* or `project_id` query parameter has to be given.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>} A Promise that resolves to
* a deployment resource
*/
getDeployment(params: WatsonXAI.DeploymentsGetParams): Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>;
/**
* Update the deployment metadata.
*
* Update the deployment metadata. The following parameters of deployment metadata are supported
* for the patch operation.
*
* - `/name`
* - `/description`
* - `/tags`
* - `/custom`
* - `/online/parameters`
* - `/asset` - `replace` only
* - `/prompt_template` - `replace` only
* - `/hardware_spec`
* - `/hardware_request`
* - `/base_model_id` - `replace` only (applicable only to prompt template deployments referring to
* IBM base foundation models)
*
* The PATCH operation with path specified as `/online/parameters` can be used to update the
* `serving_name`.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.deploymentId - The deployment id.
* @param {JsonPatchOperation[]} params.jsonPatch - The json patch.
* @param {string} [params.spaceId] - The space that contains the resource. Either `space_id` or
* `project_id` query parameter has to be given.
* @param {string} [params.projectId] - The project that contains the resource. Either `space_id`
* or `project_id` query parameter has to be given.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>} A Promise that resolves to
* a deployment resource
*/
updateDeployment(params: WatsonXAI.DeploymentsUpdateParams): Promise<WatsonXAI.Response<WatsonXAI.DeploymentResource>>;
/**
* Delete the deployment.
*
* Delete the deployment with the specified identifier.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.deploymentId - The deployment id.
* @param {string} [params.spaceId] - The space that contains the resource. Either `space_id` or
* `project_id` query parameter has to be given.
* @param {string} [params.projectId] - The project that contains the resource. Either `space_id`
* or `project_id` query parameter has to be given.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>} A Promise that resolves to an
* empty response object
*/
deleteDeployment(params: WatsonXAI.DeploymentsDeleteParams): Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>;
/**
* Infer text.
*
* Infer the next tokens for a given deployed model with a set of parameters. If a `serving_name`
* is used then it must match the `serving_name` that is returned in the `inference` section when
* the deployment was created.
*
* ### Return options
*
* Note that there is currently a limitation in this operation when using `return_options`, for
* input only `input_text` will be returned if requested, for output the `input_tokens` and
* `generated_tokens` will not be returned.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.idOrName - The `id_or_name` can be either the `deployment_id` that
* identifies the deployment or a `serving_name` that allows a predefined URL to be used to post
* a prediction.
*
* The `project` or `space` for the deployment must have a WML instance that will be used for
* limits and billing (if a paid plan).
* @param {string} [params.input] - The prompt to generate completions. Note: The method tokenizes
* the input internally. It is recommended not to leave any trailing spaces.
*
* This field is ignored if there is a prompt template.
* @param {DeploymentTextGenProperties} [params.parameters]
*
* - The template properties if this request refers to a prompt template.
*
* @param {Moderations} [params.moderations] - Properties that control the moderations, for usages
* such as `Hate and profanity` (HAP) and `Personal identifiable information` (PII) filtering.
* This list can be extended with new types of moderations.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @param {Object} callbacks - The parameters to send to the service.
* @param {InvokeRequestCallback} [callbacks.requestCallback] - Callback invoked with paramteres
* payload for API call
* @param {ReceiveResponseCallback} [callbacks.responseCallback] - Callback invoked with
* paramteres response from API call
* @returns {Promise<WatsonXAI.Response<WatsonXAI.TextGenResponse>>} A Promise that resolves to a
* text generation response
*/
deploymentGenerateText(params: WatsonXAI.DeploymentsTextGenerationParams, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<WatsonXAI.TextGenResponse>>): Promise<WatsonXAI.Response<WatsonXAI.TextGenResponse>>;
/**
* Infer text event stream.
*
* Infer the next tokens for a given deployed model with a set of parameters. This operation will
* return the output tokens as a stream of events. If a `serving_name` is used then it must match
* the `serving_name` that is returned in the `inference` when the deployment was created.
*
* ### Return options
*
* Note that there is currently a limitation in this operation when using `return_options`, for
* input only `input_text` will be returned if requested, for output the `input_tokens` and
* `generated_tokens` will not be returned, also the `rank` and `top_tokens` will not be
* returned.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.idOrName - The `id_or_name` can be either the `deployment_id` that
* identifies the deployment or a `serving_name` that allows a predefined URL to be used to post
* a prediction.
*
* The `project` or `space` for the deployment must have a WML instance that will be used for
* limits and billing (if a paid plan).
* @param {string} [params.input] - The prompt to generate completions. Note: The method tokenizes
* the input internally. It is recommended not to leave any trailing spaces.
*
* ### Response
*
* Stream<string | WatsonXAI.ObjectStreamed<WatsonXAI.TextGenResponse>> represents a source of
* streaming data. If request performed successfully Stream<string |
* WatsonXAI.ObjectStreamed<WatsonXAI.TextGenResponse>> returns either stream line by line.
* Output will stream as follow:
*
* - Id: 1
* - Event: message
* - Data: {data}
* - Empty line which separates the next Event Message
*
* Or stream of objects. Output will stream as follow: { id: 2, event: 'message', data: {data} }
* Here is one of the possibilities to read streaming output:
*
* Const stream = await watsonxAIServiceenerateTextStream(parameters); for await (const line of
* stream) { console.log(line); }
*
* This field is ignored if there is a prompt template.
* @param {DeploymentTextGenProperties} [params.parameters]
*
* - The template properties if this request refers to a prompt template.
*
* @param {Moderations} [params.moderations] - Properties that control the moderations, for usages
* such as `Hate and profanity` (HAP) and `Personal identifiable information` (PII) filtering.
* This list can be extended with new types of moderations.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @param {boolean} [params.returnObject] - Flag that indicates return type. Set 'true' to return
* objects.
* @param {Object} callbacks - The parameters to send to the service.
* @param {InvokeRequestCallback} [callbacks.requestCallback] - Callback invoked with paramteres
* payload for API call
* @param {ReceiveResponseCallback} [callbacks.responseCallback] - Callback invoked with
* paramteres response from API call
* @returns {Promise<Stream<string | WatsonXAI.ObjectStreamed<WatsonXAI.TextChatResponse[]>>>} -
* Promise resolving to Stream object. Stream object is AsyncIterable based class. Stream object
* contains an additional property holding an AbortController, read more below.
* @returns {AbortController} - Abort controller. Allows user to abort when reading from stream
* without transition to Readable
*/
deploymentGenerateTextStream(params: WatsonXAI.DeploymentsTextGenerationStreamParams & {
returnObject?: false;
}, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<Unzip>>): Promise<Stream<string>>;
deploymentGenerateTextStream(params: WatsonXAI.DeploymentsTextGenerationStreamParams & {
returnObject: true;
}, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<Unzip>>): Promise<Stream<WatsonXAI.ObjectStreamed<WatsonXAI.TextGenResponse>>>;
/**
* Infer text chat.
*
* Infer the next chat message for a given deployment. The deployment must reference a prompt
* template which has `input_mode` set to `chat`. The model to the chat request will be from the
* deployment `base_model_id`. Parameters to the chat request will be from the prompt template
* `model_parameters`. Related guides:
* [Deployment](https://cloud.ibm.com/apidocs/watsonx-ai#create-deployment), [Prompt
* template](https://cloud.ibm.com/apidocs/watsonx-ai#post-prompt), [Text
* chat](https://cloud.ibm.com/apidocs/watsonx-ai#text-chat).
*
* If a `serving_name` is used then it must match the `serving_name` that is returned in the
* `inference` section when the deployment was created.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.idOrName - The `id_or_name` can be either the `deployment_id` that
* identifies the deployment or a `serving_name` that allows a predefined URL to be used to post
* a prediction. The deployment must reference a prompt template with `input_mode` `chat`.
*
* The WML instance that is associated with the deployment will be used for limits and billing (if
* a paid plan).
* @param {DeploymentTextChatMessages[]} params.messages
*
* - The messages for this chat session. You cannot specify `system` `role` in the messages.
* Depending on the model, the `content` of `system` `role` may be from `system_prompt` of
* the prompt template, and will be automatically inserted into `messages`.
*
* As an example, depending on the model, if `system_prompt` of a prompt template is "You are
* Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You
* carefully follow instructions. You are helpful and harmless and you follow ethical guidelines
* and promote positive behavior.", a message with `system` `role` having `content` the same as
* `system_prompt` is inserted.
* @param {string} [params.context] - If specified, `context` will be inserted into `messages`.
* Depending on the model, `context` may be inserted into the `content` with `system` `role`; or
* into the `content` of the last message of `user` `role`.
*
* In the example, `context` "Today is Wednesday" is inserted as such `content` of `user` becomes
* "Today is Wednesday. Who are you and which day is tomorrow?".
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @param {WatsonXAI.RequestCallbacks<WatsonXAI.Response<WatsonXAI.TextChatResponse>>} callbacks
* - The object containing callbacks for requests and response
*
* @param {InvokeRequestCallback} [callbacks.requestCallback] - Callback invoked with paramteres
* payload for API call
* @param {ReceiveResponseCallback} [callbacks.responseCallback] - Callback invoked with
* paramteres response from API call
* @returns {Promise<WatsonXAI.Response<WatsonXAI.TextChatResponse>>} A Promise that resolves to a
* text chat response
*/
deploymentsTextChat(params: WatsonXAI.DeploymentsTextChatParams, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<WatsonXAI.TextChatResponse>>): Promise<WatsonXAI.Response<WatsonXAI.TextChatResponse>>;
/**
* Infer text chat event stream.
*
* Infer the next chat message for a given deployment. This operation will return the output
* tokens as a stream of events. The deployment must reference a prompt template which has
* `input_mode` set to `chat`. The model to the chat request will be from the deployment
* `base_model_id`. Parameters to the chat request will be from the prompt template
* `model_parameters`. Related guides:
* [Deployment](https://cloud.ibm.com/apidocs/watsonx-ai#create-deployment), [Prompt
* template](https://cloud.ibm.com/apidocs/watsonx-ai#post-prompt), [Text
* chat](https://cloud.ibm.com/apidocs/watsonx-ai#text-chat).
*
* If a `serving_name` is used then it must match the `serving_name` that is returned in the
* `inference` section when the deployment was created.
*
* @category Deployments
* @param {Object} params - The parameters to send to the service.
* @param {string} params.idOrName - The `id_or_name` can be either the `deployment_id` that
* identifies the deployment or a `serving_name` that allows a predefined URL to be used to post
* a prediction. The deployment must reference a prompt template with `input_mode` `chat`.
*
* The WML instance that is associated with the deployment will be used for limits and billing (if
* a paid plan).
* @param {DeploymentTextChatMessages[]} params.messages
*
* - The messages for this chat session. You cannot specify `system` `role` in the messages.
* Depending on the model, the `content` of `system` `role` may be from `system_prompt` of
* the prompt template, and will be automatically inserted into `messages`.
*
* As an example, depending on the model, if `system_prompt` of a prompt template is "You are
* Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You
* carefully follow instructions. You are helpful and harmless and you follow ethical guidelines
* and promote positive behavior.", a message with `system` `role` having `content` the same as
* `system_prompt` is inserted.
* @param {string} [params.context] - If specified, `context` will be inserted into `messages`.
* Depending on the model, `context` may be inserted into the `content` with `system` `role`; or
* into the `content` of the last message of `user` `role`.
*
* In the example, `context` "Today is Wednesday" is inserted as such `content` of `user` becomes
* "Today is Wednesday. Who are you and which day is tomorrow?".
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @param {WatsonXAI.RequestCallbacks<WatsonXAI.Response<WatsonXAI.TextChatResponse>>} callbacks
* - The object containing callbacks for requests and response
*
* @param {InvokeRequestCallback} [callbacks.requestCallback] - Callback invoked with paramteres
* payload for API call
* @param {ReceiveResponseCallback} [callbacks.responseCallback] - Callback invoked with
* paramteres response from API call
* @returns {Promise<Stream<string | WatsonXAI.ObjectStreamed<WatsonXAI.TextChatResponse[]>>>}
* Return
*
* - Promise resolving to Stream object. Stream object is AsyncIterable based class. Stream object
* contains an additional property holding an AbortController, read more below.
*
* @returns {AbortController} Return.controller - Abort controller. Allows user to abort when
* reading from stream without transition to Readable
*/
deploymentsTextChatStream(params: WatsonXAI.DeploymentsTextChatStreamParams & {
returnObject?: false;
}, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<Unzip>>): Promise<Stream<string>>;
deploymentsTextChatStream(params: WatsonXAI.DeploymentsTextChatStreamParams & {
returnObject: true;
}, callbacks?: WatsonXAI.RequestCallbacks<WatsonXAI.Response<Unzip>>): Promise<Stream<WatsonXAI.ObjectStreamed<WatsonXAI.TextChatStreamResponse>>>;
/**
* Time series forecast.
*
* Generate forecasts, or predictions for future time points, given historical time series data.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.idOrName - The `id_or_name` can be either the `deployment_id` that
* identifies the deployment or a `serving_name` that allows a predefined URL to be used to post
* a prediction.
*
* The WML instance that is associated with the deployment will be used for limits and billing (if
* a paid plan).
* @param {JsonObject} params.data - A payload of data matching `schema`. We assume the following
* about your data: All timeseries are of equal length and are uniform in nature (the time
* difference between two successive rows is constant). This implies that there are no missing
* rows of data; The data meet the minimum model-dependent historical context length which can
* be any number of rows per timeseries;
*
* Note that the example payloads shown are for illustration purposes only. An actual payload
* would necessary be much larger to meet minimum model-specific context lengths.
* @param {TSForecastInputSchema} params.schema - Contains metadata about your timeseries data
* input.
* @param {DeploymentTSForecastParameters} [params.parameters]
*
* - The parameters for the forecast request.
*
* @param {JsonObject} [params.futureData] - Exogenous or supporting features that extend into the
* forecasting horizon (e.g., a weather forecast or calendar of special promotions) which are
* known in advance. `future_data` would be in the same format as `data` except that all
* timestamps would be in the forecast horizon and it would not include previously specified
* `target_columns`.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.TSForecastResponse>>} A Promise that resolves to
* a time series forecast response
*/
deploymentsTimeSeriesForecast(params: WatsonXAI.DeploymentsTimeSeriesForecastParams): Promise<WatsonXAI.Response<WatsonXAI.TSForecastResponse>>;
/** FoundationModelSpecs */
/**
* List the available foundation models.
*
* Retrieve the list of deployed foundation models.
*
* @category Foundation Model Specs
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.start] - Token required for token-based pagination. This token cannot
* be determined by end user. It is generated by the service and it is set in the href available
* in the `next` field.
* @param {number} [params.limit] - How many resources should be returned. By default limit is
* 100. Max limit allowed is 200.
* @param {string} [params.filters] - A set of filters to specify the list of models, filters are
* described as the `pattern` shown below.
*
* ```text
* pattern: tfilter[,tfilter][:(or|and)]
* tfilter: filter | !filter
* filter: Requires existence of the filter.
* !filter: Requires absence of the filter.
* filter: one of
* modelid_*: Filters by model id.
* Namely, select a model with a specific model id.
* provider_*: Filters by provider.
* Namely, select all models with a specific provider.
* source_*: Filters by source.
* Namely, select all models with a specific source.
* input_tier_*: Filters by input tier.
* Namely, select all models with a specific input tier.
* output_tier_*: Filters by output tier.
* Namely, select all models with a specific output tier.
* tier_*: Filters by tier.
* Namely, select all models with a specific input or output tier.
* task_*: Filters by task id.
* Namely, select all models that support a specific task id.
* lifecycle_*: Filters by lifecycle state.
* Namely, select all models that are currently in the specified lifecycle state.
* function_*: Filters by function.
* Namely, select all models that support a specific function.
* ```.
* ```
*
* @param {boolean} [params.techPreview] - See all the `Tech Preview` models if entitled. @param
* {OutgoingHttpHeaders} [params.headers] - Custom request headers @returns
* {Promise<WatsonXAI.Response<WatsonXAI.FoundationModels>>} A Promise that resolves to a list
* of foundation models
*/
listFoundationModelSpecs(params?: WatsonXAI.ListFoundationModelSpecsParams): Promise<WatsonXAI.Response<WatsonXAI.FoundationModels>>;
/**
* List the supported tasks.
*
* Retrieve the list of tasks that are supported by the foundation models.
*
* @category Foundation Model Specs
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.start] - Token required for token-based pagination. This token cannot
* be determined by end user. It is generated by the service and it is set in the href available
* in the `next` field.
* @param {number} [params.limit] - How many resources should be returned. By default limit is
* 100. Max limit allowed is 200.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.FoundationModelTasks>>} A Promise that resolves
* to a list of foundation model tasks
*/
listFoundationModelTasks(params?: WatsonXAI.ListFoundationModelTasksParams): Promise<WatsonXAI.Response<WatsonXAI.FoundationModelTasks>>;
/** Prompts */
/**
* Create a new prompt / prompt template.
*
* This creates a new prompt with the provided parameters.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - Name used to display the prompt.
* @param {PromptWithExternal} params.prompt -
* @param {string} [params.description] - An optional description for the prompt.
* @param {number} [params.createdAt] - Time the prompt was created.
* @param {string[]} [params.taskIds] -
* @param {PromptLock} [params.lock] -
* @param {WxPromptPostModelVersion} [params.modelVersion] -
* @param {JsonObject} [params.promptVariables] -
* @param {string} [params.inputMode] - Input mode in use for the prompt.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>} A Promise that resolves to a
* prompt response
*/
createPrompt(params: WatsonXAI.PostPromptParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>;
/**
* Get a prompt.
*
* This retrieves a prompt / prompt template with the given id.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {string} [params.restrictModelParameters] - Only return a set of model parameters
* compatiable with inferencing.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>} A Promise that resolves to a
* prompt response
*/
getPrompt(params: WatsonXAI.GetPromptParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>;
/**
* List all prompts.
*
* This retrieves all prompts within the given project/space.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {string} [params.limit] - The limit request body field can be specified to limit the
* number of assets in the search results. The default limit is 200. The maximum limit value is
* 200, and any greater value is ignored.
* @param {string} [params.counts] - Returns the number of query results for each unique value of
* each named field.
* @param {string} [params.drilldown] - Restrict results to documents with a dimension equal to
* the specified label. Note that, multiple values for a single key in a drilldown means an OR
* relation between them and there is an AND relation between multiple keys.
* @param {string} [params.bookmark] - Bookmark of the query result
* @param {string} [params.sort] - Sort order for the query
* @param {string} [params.include] - Entity
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.ListPromptsResponse>>} A Promise that resolves
* to a list of prompts
*/
listPrompts(params: WatsonXAI.PromptListParams): Promise<WatsonXAI.Response<WatsonXAI.ListPromptsResponse>>;
/**
* Update a prompt.
*
* This updates a prompt / prompt template with the given id.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {string} params.name - Name used to display the prompt.
* @param {Prompt} params.prompt -
* @param {string} [params.id] - The prompt's id. This value cannot be set. It is returned in
* responses only.
* @param {string} [params.description] - An optional description for the prompt.
* @param {string[]} [params.taskIds] -
* @param {boolean} [params.governanceTracked] -
* @param {WxPromptPatchModelVersion} [params.modelVersion] -
* @param {JsonObject} [params.promptVariables] -
* @param {string} [params.inputMode] - Input mode in use for the prompt.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>} A Promise that resolves to a
* prompt response
*/
updatePrompt(params: WatsonXAI.PatchPromptParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>;
/**
* Delete a prompt.
*
* This delets a prompt / prompt template with the given id.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>} A Promise that resolves to an
* empty response object
*/
deletePrompt(params: WatsonXAI.DeletePromptParams): Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>;
/**
* Prompt lock modifications.
*
* Modifies the current locked state of a prompt.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {boolean} params.locked - True if the prompt is currently locked.
* @param {string} [params.lockType] - Lock type: 'edit' for working on prompts/templates or
* 'governance'. Can only be supplied in PUT /lock requests.
* @param {string} [params.lockedBy] - Locked by is computed by the server and shouldn't be
* passed.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {boolean} [params.force] - Override a lock if it is currently taken.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.PromptLock>>} A Promise that resolves to a
* prompt lock
*/
updatePromptLock(params: WatsonXAI.PutPromptLockParams): Promise<WatsonXAI.Response<WatsonXAI.PromptLock>>;
/**
* Get current prompt lock status.
*
* Retrieves the current locked state of a prompt.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.PromptLock>>} A Promise that resolves to a
* prompt lock
*/
getPromptLock(params: WatsonXAI.GetPromptLockParams): Promise<WatsonXAI.Response<WatsonXAI.PromptLock>>;
/**
* Get the inference input string for a given prompt.
*
* Computes the inference input string based on state of a prompt. Optionally replaces template
* params.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {string} [params.input] - Override input string that will be used to generate the
* response. The string can contain template parameters.
* @param {JsonObject} [params.promptVariables] - Supply only to replace placeholders. Object
* content must be key:value pairs where the 'key' is the parameter to replace and 'value' is
* the value to use.
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.GetPromptInputResponse>>} A Promise that
* resolves to prompt input data
*/
getPromptInput(params: WatsonXAI.GetPromptInputParams): Promise<WatsonXAI.Response<WatsonXAI.GetPromptInputResponse>>;
/**
* Add a new chat item to a prompt.
*
* This adds new chat items to the given prompt.
*
* @category Prompts / Prompt Templates
* @param {Object} params - The parameters to send to the service.
* @param {string} params.promptId - Prompt ID.
* @param {ChatItem[]} params.chatItem -
* @param {string} [params.spaceId] - [REQUIRED] Specifies the space ID as the target. One target
* must be supplied per request.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>} A Promise that resolves to an
* empty response object
*/
createPromptChatItem(params: WatsonXAI.PostPromptChatItemParams): Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>;
/** PromptSessions */
/**
* Create a new prompt session.
*
* This creates a new prompt session.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - Name used to display the prompt session.
* @param {string} [params.id] - The prompt session's id. This value cannot be set. It is returned
* in responses only.
* @param {string} [params.description] - An optional description for the prompt session.
* @param {number} [params.createdAt] - Time the session was created.
* @param {string} [params.createdBy] - The ID of the original session creator.
* @param {number} [params.lastUpdatedAt] - Time the session was updated.
* @param {string} [params.lastUpdatedBy] - The ID of the last user that modifed the session.
* @param {PromptLock} [params.lock] -
* @param {WxPromptSessionEntry[]} [params.prompts] -
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>} A Promise that resolves to a
* prompt response
*/
createPromptSession(params: WatsonXAI.PostPromptSessionParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptResponse>>;
/**
* Get a prompt session.
*
* This retrieves a prompt session with the given id.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {boolean} [params.prefetch] - Include the most recent entry.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptSession>>} A Promise that resolves to a
* prompt session
*/
getPromptSession(params: WatsonXAI.GetPromptSessionParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptSession>>;
/**
* Update a prompt session.
*
* This updates a prompt session with the given id.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} [params.name] -
* @param {string} [params.description] - An optional description for the prompt.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptSession>>} A Promise that resolves to a
* prompt session
*/
updatePromptSession(params: WatsonXAI.PatchPromptSessionParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptSession>>;
/**
* Delete a prompt session.
*
* This deletes a prompt session with the given id.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>} A Promise that resolves to an
* empty response object
*/
deletePromptSession(params: WatsonXAI.DeletePromptSessionParams): Promise<WatsonXAI.Response<WatsonXAI.EmptyObject>>;
/**
* Add a new prompt to a prompt session.
*
* This creates a new prompt associated with the given session.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} params.name - Name used to display the prompt.
* @param {number} params.createdAt - Time the prompt was created.
* @param {Prompt} params.prompt -
* @param {string} [params.id] - The prompt's id. This value cannot be set. It is returned in
* responses only.
* @param {string} [params.description] - An optional description for the prompt.
* @param {JsonObject} [params.promptVariables] -
* @param {boolean} [params.isTemplate] -
* @param {string} [params.inputMode] - Input mode in use for the prompt.
* @param {string} [params.projectId] - [REQUIRED] Specifies the project ID as the target. One
* target must be supplied per request.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonXAI.Response<WatsonXAI.WxPromptSessionEntry>>} A Promise that resolves
* to a prompt session entry
*/
createPromptSessionEntry(params: WatsonXAI.PostPromptSessionEntryParams): Promise<WatsonXAI.Response<WatsonXAI.WxPromptSessionEntry>>;
/**
* Get entries for a prompt session.
*
* List entries from a given session.
*
* @category Prompt Sessions
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @para