@ibm-cloud/watsonx-ai
Version:
IBM watsonx.ai Node.js SDK
849 lines • 360 kB
TypeScript
/**
* (C) Copyright IBM Corp. 2025.
*
* 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" />
/**
* IBM OpenAPI SDK Code Generator Version: 3.90.0-5aad763d-20240506-203857
*/
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
import { BaseService, UserOptions } from 'ibm-cloud-sdk-core';
import { BaseServiceOptions } from 'ibm-cloud-sdk-core/es/lib/base-service';
import { Stream } from '../lib/common';
import { RequestTokenResponse } from '../auth/utils/authenticators';
declare class WatsonxAiMlVml_v1 extends BaseService {
/** @hidden */
static DEFAULT_SERVICE_URL: string;
/** @hidden */
static DEFAULT_SERVICE_NAME: string;
/** @hidden */
static PARAMETERIZED_SERVICE_URL: string;
/** @hidden */
private static defaultUrlVariables;
static wxServiceUrl: string;
static serviceUrl: string;
/**
* 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 WatsonxAiMlVml_v1 with passed in options and external configuration.
*
* @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 {WatsonxAiMlVml_v1}
*
* @category constructor
*
*/
static newInstance(options: UserOptions & WatsonxAiMlVml_v1.TokenAuthenticationOptions): WatsonxAiMlVml_v1;
/** The version date for the API of the form `YYYY-MM-DD`. */
version: string;
wxServiceUrl: string;
serviceUrl: string;
/**
* Construct a WatsonxAiMlVml_v1 object.
*
* @param {Object} options - Options for the service.
* @param {string} options.version - The version date for the API of the form `YYYY-MM-DD`.
* @param {string} [options.serviceUrl] - The base URL for the service
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
* @param {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service
* @constructor
* @returns {WatsonxAiMlVml_v1}
*/
constructor(options: UserOptions);
/*************************
* 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.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResource>>}
*
* @category Deployments
*/
createDeployment(params: WatsonxAiMlVml_v1.CreateDeploymentParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResource>>;
/**
* Retrieve the deployments.
*
* Retrieve the list of deployments for the specified space or project.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResourceCollection>>}
*
* @category Deployments
*/
listDeployments(params?: WatsonxAiMlVml_v1.ListDeploymentsParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResourceCollection>>;
/**
* Retrieve the deployment details.
*
* Retrieve the deployment details with the specified identifier.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResource>>}
*
* @category Deployments
*/
getDeployment(params: WatsonxAiMlVml_v1.DeploymentsGetParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.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`.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResource>>}
*
* @category Deployments
*/
updateDeployment(params: WatsonxAiMlVml_v1.DeploymentsUpdateParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.DeploymentResource>>;
/**
* Delete the deployment.
*
* Delete the deployment with the specified identifier.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>}
*
* @category Deployments
*/
deleteDeployment(params: WatsonxAiMlVml_v1.DeploymentsDeleteParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.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.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextGenResponse>>}
*
* @category Deployments
*/
deploymentGenerateText(params: WatsonxAiMlVml_v1.DeploymentsTextGenerationParams, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.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.
*
* @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 | WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.TextGenResponse>> represents a source of streaming data. If request performed successfully Stream<string | WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.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 watsonxAiMlService.generateTextStream(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 | WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.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
*
* @category Deployments
*/
deploymentGenerateTextStream(params: WatsonxAiMlVml_v1.DeploymentsTextGenerationStreamParams & {
returnObject?: false;
}, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<Stream<string>>;
deploymentGenerateTextStream(params: WatsonxAiMlVml_v1.DeploymentsTextGenerationStreamParams & {
returnObject: true;
}, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<Stream<WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.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.
*
* @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
* @returns {Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>}
*
* @category Deployments
*/
deploymentsTextChat(params: WatsonxAiMlVml_v1.DeploymentsTextChatParams, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.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.
*
* @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
* @returns {Promise<Stream<string | WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.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
* @category Deployments
*/
deploymentsTextChatStream(params: WatsonxAiMlVml_v1.DeploymentsTextChatStreamParams & {
returnObject?: false;
}, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<Stream<string>>;
deploymentsTextChatStream(params: WatsonxAiMlVml_v1.DeploymentsTextChatStreamParams & {
returnObject: true;
}, callbacks?: WatsonxAiMlVml_v1.RequestCallbacks<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.TextChatResponse>>): Promise<Stream<WatsonxAiMlVml_v1.ObjectStreamed<WatsonxAiMlVml_v1.TextChatStreamResponse>>>;
/*************************
* foundationModelSpecs
************************/
/**
* List the available foundation models.
*
* Retrieve the list of deployed foundation models.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.FoundationModels>>}
*
* @category Foundation Model Specs
*/
listFoundationModelSpecs(params?: WatsonxAiMlVml_v1.ListFoundationModelSpecsParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.FoundationModels>>;
/**
* List the supported tasks.
*
* Retrieve the list of tasks that are supported by the foundation models.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.FoundationModelTasks>>}
*
* @category Foundation Model Specs
*/
listFoundationModelTasks(params?: WatsonxAiMlVml_v1.ListFoundationModelTasksParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.FoundationModelTasks>>;
/*************************
* prompts
************************/
/**
* Create a new prompt / prompt template.
*
* This creates a new prompt with the provided parameters.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>}
*
* @category Prompts / Prompt Templates
*/
createPrompt(params: WatsonxAiMlVml_v1.PostPromptParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>;
/**
* Get a prompt.
*
* This retrieves a prompt / prompt template with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>}
*
* @category Prompts / Prompt Templates
*/
getPrompt(params: WatsonxAiMlVml_v1.GetPromptParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>;
/**
* List all prompts.
*
* This retrieves all prompts within the given project/space.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.ListPromptsResponse>>}
*
* @category Prompts / Prompt Templates
*/
listPrompts(params: WatsonxAiMlVml_v1.PromptListParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.ListPromptsResponse>>;
/**
* Update a prompt.
*
* This updates a prompt / prompt template with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>}
*
* @category Prompts / Prompt Templates
*/
updatePrompt(params: WatsonxAiMlVml_v1.PatchPromptParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>;
/**
* Delete a prompt.
*
* This delets a prompt / prompt template with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>}
*
* @category Prompts / Prompt Templates
*/
deletePrompt(params: WatsonxAiMlVml_v1.DeletePromptParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>;
/**
* Prompt lock modifications.
*
* Modifies the current locked state of a prompt.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>}
*
* @category Prompts / Prompt Templates
*/
updatePromptLock(params: WatsonxAiMlVml_v1.PutPromptLockParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>;
/**
* Get current prompt lock status.
*
* Retrieves the current locked state of a prompt.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>}
*
* @category Prompts / Prompt Templates
*/
getPromptLock(params: WatsonxAiMlVml_v1.GetPromptLockParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.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.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.GetPromptInputResponse>>}
*
* @category Prompts / Prompt Templates
*/
getPromptInput(params: WatsonxAiMlVml_v1.GetPromptInputParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.GetPromptInputResponse>>;
/**
* Add a new chat item to a prompt.
*
* This adds new chat items to the given prompt.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>}
*
* @category Prompts / Prompt Templates
*/
createPromptChatItem(params: WatsonxAiMlVml_v1.PostPromptChatItemParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>;
/*************************
* promptSessions
************************/
/**
* Create a new prompt session.
*
* This creates a new prompt session.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>}
*
* @category Prompt Sessions
*/
createPromptSession(params: WatsonxAiMlVml_v1.PostPromptSessionParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptResponse>>;
/**
* Get a prompt session.
*
* This retrieves a prompt session with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSession>>}
*
* @category Prompt Sessions
*/
getPromptSession(params: WatsonxAiMlVml_v1.GetPromptSessionParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSession>>;
/**
* Update a prompt session.
*
* This updates a prompt session with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSession>>}
*
* @category Prompt Sessions
*/
updatePromptSession(params: WatsonxAiMlVml_v1.PatchPromptSessionParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSession>>;
/**
* Delete a prompt session.
*
* This deletes a prompt session with the given id.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>}
*
* @category Prompt Sessions
*/
deletePromptSession(params: WatsonxAiMlVml_v1.DeletePromptSessionParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>;
/**
* Add a new prompt to a prompt session.
*
* This creates a new prompt associated with the given session.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSessionEntry>>}
*
* @category Prompt Sessions
*/
createPromptSessionEntry(params: WatsonxAiMlVml_v1.PostPromptSessionEntryParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSessionEntry>>;
/**
* Get entries for a prompt session.
*
* List entries from a given session.
*
* @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 {string} [params.bookmark] - Bookmark from a previously limited get request.
* @param {string} [params.limit] - Limit for results to retrieve, default 20.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSessionEntryList>>}
*
* @category Prompt Sessions
*/
listPromptSessionEntries(params: WatsonxAiMlVml_v1.GetPromptSessionEntriesParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.WxPromptSessionEntryList>>;
/**
* Add a new chat item to a prompt session entry.
*
* This adds new chat items to the given entry.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} params.entryId - Prompt Session Entry ID.
* @param {ChatItem[]} params.chatItem -
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>}
*
* @category Prompt Sessions
*/
createPromptSessionEntryChatItem(params: WatsonxAiMlVml_v1.PostPromptSessionEntryChatItemParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.EmptyObject>>;
/**
* Prompt session lock modifications.
*
* Modifies the current locked state of a prompt session.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session 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 {boolean} [params.force] - Override a lock if it is currently taken.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>}
*
* @category Prompt Sessions
*/
updatePromptSessionLock(params: WatsonxAiMlVml_v1.PutPromptSessionLockParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>;
/**
* Get current prompt session lock status.
*
* Retrieves the current locked state of a prompt session.
*
* @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<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>}
*
* @category Prompt Sessions
*/
getPromptSessionLock(params: WatsonxAiMlVml_v1.GetPromptSessionLockParams): Promise<WatsonxAiMlVml_v1.Response<WatsonxAiMlVml_v1.PromptLock>>;
/**
* Get a prompt session entry.
*
* This retrieves a prompt session entry with the given id.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.sessionId - Prompt Session ID.
* @param {string} params.entryId - Prompt Session Entry 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<Wat