Skip to content

Commit

Permalink
feat(wa-v2): new method params
Browse files Browse the repository at this point in the history
  • Loading branch information
apaparazzi0329 committed Feb 26, 2024
1 parent 78d93b7 commit 439ed47
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 77 deletions.
81 changes: 27 additions & 54 deletions assistant/src/main/java/com/ibm/watson/assistant/v2/Assistant.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2019, 2023.
* (C) Copyright IBM Corp. 2024.
*
* 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
Expand All @@ -12,7 +12,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.64.1-cee95189-20230124-211647
* IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220
*/

package com.ibm.watson.assistant.v2;
Expand Down Expand Up @@ -68,13 +68,15 @@
import java.util.Map.Entry;

/**
* The IBM Watson™ Assistant service combines machine learning, natural language
* The IBM® watsonx™ Assistant service combines machine learning, natural language
* understanding, and an integrated dialog editor to create conversation flows between your apps and
* your users.
*
* <p>The Assistant v2 API provides runtime methods your client application can use to send user
* input to an assistant and receive a response.
*
* <p>You need a paid Plus plan or higher to use the watsonx Assistant v2 API.
*
* <p>API Version: 2.0 See: https://cloud.ibm.com/docs/assistant
*/
public class Assistant extends BaseService {
Expand All @@ -93,7 +95,7 @@ public class Assistant extends BaseService {
* the client instance.
*
* @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD
* format. The current version is `2021-11-27`.
* format. The current version is `2023-06-15`.
*/
public Assistant(String version) {
this(
Expand All @@ -107,7 +109,7 @@ public Assistant(String version) {
* authenticator are used to configure the client instance.
*
* @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD
* format. The current version is `2021-11-27`.
* format. The current version is `2023-06-15`.
* @param authenticator the {@link Authenticator} instance to be configured for this client
*/
public Assistant(String version, Authenticator authenticator) {
Expand All @@ -119,7 +121,7 @@ public Assistant(String version, Authenticator authenticator) {
* configure the client instance.
*
* @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD
* format. The current version is `2021-11-27`.
* format. The current version is `2023-06-15`.
* @param serviceName the service name to be used when configuring the client instance
*/
public Assistant(String version, String serviceName) {
Expand All @@ -131,7 +133,7 @@ public Assistant(String version, String serviceName) {
* are used to configure the client instance.
*
* @param version Release date of the API version you want to use. Specify dates in YYYY-MM-DD
* format. The current version is `2021-11-27`.
* format. The current version is `2023-06-15`.
* @param serviceName the service name to be used when configuring the client instance
* @param authenticator the {@link Authenticator} instance to be configured for this client
*/
Expand All @@ -146,7 +148,7 @@ public Assistant(String version, String serviceName, Authenticator authenticator
* Gets the version.
*
* <p>Release date of the API version you want to use. Specify dates in YYYY-MM-DD format. The
* current version is `2021-11-27`.
* current version is `2023-06-15`.
*
* @return the version
*/
Expand All @@ -169,8 +171,6 @@ public void setVersion(final String version) {
*
* <p>Create a new assistant.
*
* <p>This method is available only with Enterprise plans.
*
* @param createAssistantOptions the {@link CreateAssistantOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a result of type {@link AssistantData}
Expand Down Expand Up @@ -214,8 +214,6 @@ public ServiceCall<AssistantData> createAssistant(CreateAssistantOptions createA
*
* <p>Create a new assistant.
*
* <p>This method is available only with Enterprise plans.
*
* @return a {@link ServiceCall} with a result of type {@link AssistantData}
*/
public ServiceCall<AssistantData> createAssistant() {
Expand All @@ -225,9 +223,7 @@ public ServiceCall<AssistantData> createAssistant() {
/**
* List assistants.
*
* <p>List the assistants associated with a Watson Assistant service instance.
*
* <p>This method is available only with Enterprise plans.
* <p>List the assistants associated with a watsonx Assistant service instance.
*
* @param listAssistantsOptions the {@link ListAssistantsOptions} containing the options for the
* call
Expand Down Expand Up @@ -271,9 +267,7 @@ public ServiceCall<AssistantCollection> listAssistants(
/**
* List assistants.
*
* <p>List the assistants associated with a Watson Assistant service instance.
*
* <p>This method is available only with Enterprise plans.
* <p>List the assistants associated with a watsonx Assistant service instance.
*
* @return a {@link ServiceCall} with a result of type {@link AssistantCollection}
*/
Expand All @@ -286,8 +280,6 @@ public ServiceCall<AssistantCollection> listAssistants() {
*
* <p>Delete an assistant.
*
* <p>This method is available only with Enterprise plans.
*
* @param deleteAssistantOptions the {@link DeleteAssistantOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a void result
Expand Down Expand Up @@ -318,7 +310,7 @@ public ServiceCall<Void> deleteAssistant(DeleteAssistantOptions deleteAssistantO
* <p>Create a new session. A session is used to send user input to a skill and receive responses.
* It also maintains the state of the conversation. A session persists until it is deleted, or
* until it times out because of inactivity. (For more information, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings).
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings).).
*
* @param createSessionOptions the {@link CreateSessionOptions} containing the options for the
* call
Expand Down Expand Up @@ -390,7 +382,7 @@ public ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions
* Send user input to assistant (stateful).
*
* <p>Send user input to an assistant and receive a response, with conversation state (including
* context data) stored by Watson Assistant for the duration of the session.
* context data) stored by watsonx Assistant for the duration of the session.
*
* @param messageOptions the {@link MessageOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link MessageResponse}
Expand Down Expand Up @@ -527,7 +519,7 @@ public ServiceCall<BulkClassifyResponse> bulkClassify(BulkClassifyOptions bulkCl
*
* <p>List the events from the log of an assistant.
*
* <p>This method requires Manager access, and is available only with Plus and Enterprise plans.
* <p>This method requires Manager access.
*
* <p>**Note:** If you use the **cursor** parameter to retrieve results one page at a time,
* subsequent requests must be no more than 5 minutes apart. Any returned value for the **cursor**
Expand Down Expand Up @@ -583,7 +575,7 @@ public ServiceCall<LogCollection> listLogs(ListLogsOptions listLogsOptions) {
*
* <p>**Note:** This operation is intended only for deleting data associated with a single
* specific customer, not for deleting data associated with multiple customers or for any other
* purpose. For more information, see [Labeling and deleting data in Watson
* purpose. For more information, see [Labeling and deleting data in watsonx
* Assistant](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security-gdpr-wa).
*
* @param deleteUserDataOptions the {@link DeleteUserDataOptions} containing the options for the
Expand Down Expand Up @@ -612,8 +604,6 @@ public ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOpti
*
* <p>List the environments associated with an assistant.
*
* <p>This method is available only with Enterprise plans.
*
* @param listEnvironmentsOptions the {@link ListEnvironmentsOptions} containing the options for
* the call
* @return a {@link ServiceCall} with a result of type {@link EnvironmentCollection}
Expand Down Expand Up @@ -662,8 +652,6 @@ public ServiceCall<EnvironmentCollection> listEnvironments(
* <p>Get information about an environment. For more information about environments, see
* [Environments](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish-overview#environments).
*
* <p>This method is available only with Enterprise plans.
*
* @param getEnvironmentOptions the {@link GetEnvironmentOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a result of type {@link Environment}
Expand Down Expand Up @@ -703,8 +691,6 @@ public ServiceCall<Environment> getEnvironment(GetEnvironmentOptions getEnvironm
* see
* [Environments](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish-overview#environments).
*
* <p>This method is available only with Enterprise plans.
*
* @param updateEnvironmentOptions the {@link UpdateEnvironmentOptions} containing the options for
* the call
* @return a {@link ServiceCall} with a result of type {@link Environment}
Expand Down Expand Up @@ -736,6 +722,12 @@ public ServiceCall<Environment> updateEnvironment(
if (updateEnvironmentOptions.description() != null) {
contentJson.addProperty("description", updateEnvironmentOptions.description());
}
if (updateEnvironmentOptions.orchestration() != null) {
contentJson.add(
"orchestration",
com.ibm.cloud.sdk.core.util.GsonSingleton.getGson()
.toJsonTree(updateEnvironmentOptions.orchestration()));
}
if (updateEnvironmentOptions.sessionTimeout() != null) {
contentJson.addProperty("session_timeout", updateEnvironmentOptions.sessionTimeout());
}
Expand All @@ -756,9 +748,7 @@ public ServiceCall<Environment> updateEnvironment(
* Create release.
*
* <p>Create a new release using the current content of the dialog and action skills in the draft
* environment. (In the Watson Assistant user interface, a release is called a *version*.)
*
* <p>This method is available only with Enterprise plans.
* environment. (In the watsonx Assistant user interface, a release is called a *version*.).
*
* @param createReleaseOptions the {@link CreateReleaseOptions} containing the options for the
* call
Expand Down Expand Up @@ -793,10 +783,8 @@ public ServiceCall<Release> createRelease(CreateReleaseOptions createReleaseOpti
/**
* List releases.
*
* <p>List the releases associated with an assistant. (In the Watson Assistant user interface, a
* release is called a *version*.)
*
* <p>This method is available only with Enterprise plans.
* <p>List the releases associated with an assistant. (In the watsonx Assistant user interface, a
* release is called a *version*.).
*
* @param listReleasesOptions the {@link ListReleasesOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link ReleaseCollection}
Expand Down Expand Up @@ -847,8 +835,6 @@ public ServiceCall<ReleaseCollection> listReleases(ListReleasesOptions listRelea
* value of the **status** property. When processing has completed, the request returns the
* release data.
*
* <p>This method is available only with Enterprise plans.
*
* @param getReleaseOptions the {@link GetReleaseOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Release}
*/
Expand Down Expand Up @@ -882,9 +868,8 @@ public ServiceCall<Release> getRelease(GetReleaseOptions getReleaseOptions) {
/**
* Delete release.
*
* <p>Delete a release. (In the Watson Assistant user interface, a release is called a *version*.)
*
* <p>This method is available only with Enterprise plans.
* <p>Delete a release. (In the watsonx Assistant user interface, a release is called a
* *version*.).
*
* @param deleteReleaseOptions the {@link DeleteReleaseOptions} containing the options for the
* call
Expand Down Expand Up @@ -918,8 +903,6 @@ public ServiceCall<Void> deleteRelease(DeleteReleaseOptions deleteReleaseOptions
* <p>Update the environment with the content of the release. All snapshots saved as part of the
* release become active in the environment.
*
* <p>This method is available only with Enterprise plans.
*
* @param deployReleaseOptions the {@link DeployReleaseOptions} containing the options for the
* call
* @return a {@link ServiceCall} with a result of type {@link Environment}
Expand Down Expand Up @@ -959,8 +942,6 @@ public ServiceCall<Environment> deployRelease(DeployReleaseOptions deployRelease
*
* <p>Get information about a skill.
*
* <p>This method is available only with Enterprise plans.
*
* @param getSkillOptions the {@link GetSkillOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Skill}
*/
Expand Down Expand Up @@ -994,8 +975,6 @@ public ServiceCall<Skill> getSkill(GetSkillOptions getSkillOptions) {
* <p>**Note:** The update is performed asynchronously; you can see the status of the update by
* calling the **Get skill** method and checking the value of the **status** property.
*
* <p>This method is available only with Enterprise plans.
*
* @param updateSkillOptions the {@link UpdateSkillOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link Skill}
*/
Expand Down Expand Up @@ -1066,8 +1045,6 @@ public ServiceCall<Skill> updateSkill(UpdateSkillOptions updateSkillOptions) {
* <p>When processing has completed, the request returns the exported JSON data. Remember that the
* usual rate limits apply.
*
* <p>This method is available only with Enterprise plans.
*
* @param exportSkillsOptions the {@link ExportSkillsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link SkillsExport}
*/
Expand Down Expand Up @@ -1107,8 +1084,6 @@ public ServiceCall<SkillsExport> exportSkills(ExportSkillsOptions exportSkillsOp
* belonging to the assistant are not available until processing completes. To check the status of
* the asynchronous import operation, use the **Get status of skills import** method.
*
* <p>This method is available only with Enterprise plans.
*
* @param importSkillsOptions the {@link ImportSkillsOptions} containing the options for the call
* @return a {@link ServiceCall} with a result of type {@link SkillsAsyncRequestStatus}
*/
Expand Down Expand Up @@ -1153,8 +1128,6 @@ public ServiceCall<SkillsAsyncRequestStatus> importSkills(
* <p>Retrieve the status of an asynchronous import operation previously initiated by using the
* **Import skills** method.
*
* <p>This method is available only with Enterprise plans.
*
* @param importSkillsStatusOptions the {@link ImportSkillsStatusOptions} containing the options
* for the call
* @return a {@link ServiceCall} with a result of type {@link SkillsAsyncRequestStatus}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2018, 2023.
* (C) Copyright IBM Corp. 2024.
*
* 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
Expand All @@ -23,6 +23,9 @@ public class MessageInputOptions extends GenericModel {
@SerializedName("alternate_intents")
protected Boolean alternateIntents;

@SerializedName("async_callout")
protected Boolean asyncCallout;

protected MessageInputOptionsSpelling spelling;
protected Boolean debug;

Expand All @@ -35,6 +38,7 @@ public class MessageInputOptions extends GenericModel {
public static class Builder {
private Boolean restart;
private Boolean alternateIntents;
private Boolean asyncCallout;
private MessageInputOptionsSpelling spelling;
private Boolean debug;
private Boolean returnContext;
Expand All @@ -48,6 +52,7 @@ public static class Builder {
private Builder(MessageInputOptions messageInputOptions) {
this.restart = messageInputOptions.restart;
this.alternateIntents = messageInputOptions.alternateIntents;
this.asyncCallout = messageInputOptions.asyncCallout;
this.spelling = messageInputOptions.spelling;
this.debug = messageInputOptions.debug;
this.returnContext = messageInputOptions.returnContext;
Expand Down Expand Up @@ -88,6 +93,17 @@ public Builder alternateIntents(Boolean alternateIntents) {
return this;
}

/**
* Set the asyncCallout.
*
* @param asyncCallout the asyncCallout
* @return the MessageInputOptions builder
*/
public Builder asyncCallout(Boolean asyncCallout) {
this.asyncCallout = asyncCallout;
return this;
}

/**
* Set the spelling.
*
Expand Down Expand Up @@ -138,6 +154,7 @@ protected MessageInputOptions() {}
protected MessageInputOptions(Builder builder) {
restart = builder.restart;
alternateIntents = builder.alternateIntents;
asyncCallout = builder.asyncCallout;
spelling = builder.spelling;
debug = builder.debug;
returnContext = builder.returnContext;
Expand Down Expand Up @@ -176,6 +193,22 @@ public Boolean alternateIntents() {
return alternateIntents;
}

/**
* Gets the asyncCallout.
*
* <p>Whether custom extension callouts are executed asynchronously. Asynchronous execution means
* the response to the extension callout will be processed on the subsequent message call, the
* initial message response signals to the client that the operation may be long running. With
* synchronous execution the custom extension is executed and returns the response in a single
* message turn. **Note:** **async_callout** defaults to true for API versions earlier than
* 2023-06-15.
*
* @return the asyncCallout
*/
public Boolean asyncCallout() {
return asyncCallout;
}

/**
* Gets the spelling.
*
Expand Down

0 comments on commit 439ed47

Please sign in to comment.