Skip to content

Commit

Permalink
feat(assistant): auto-generate code
Browse files Browse the repository at this point in the history
squash me
  • Loading branch information
germanattanasio committed Apr 23, 2020
1 parent f3bfdd9 commit 515fb60
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ public ServiceCall<ExampleCollection> listExamples(ListExamplesOptions listExamp
*
* <p>Add a new user input example to an intent.
*
* <p>If you want to add multiple exaples with a single API call, consider using the **[Update
* <p>If you want to add multiple examples with a single API call, consider using the **[Update
* intent](#update-intent)** method instead.
*
* <p>This operation is limited to 1000 requests per 30 minutes. For more information, see **Rate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ public String userLabel() {
/**
* Gets the disambiguationOptOut.
*
* <p>Whether the dialog node should be excluded from disambiguation suggestions.
* <p>Whether the dialog node should be excluded from disambiguation suggestions. Valid only when
* **type**=`standard` or `frame`.
*
* @return the disambiguationOptOut
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ public String userLabel() {
/**
* Gets the disambiguationOptOut.
*
* <p>Whether the dialog node should be excluded from disambiguation suggestions.
* <p>Whether the dialog node should be excluded from disambiguation suggestions. Valid only when
* **type**=`standard` or `frame`.
*
* @return the disambiguationOptOut
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ public String messageToHumanAgent() {
/**
* Gets the topic.
*
* <p>A label identifying the topic of the conversation, derived from the **user_label** property
* of the relevant node.
* <p>A label identifying the topic of the conversation, derived from the **title** property of
* the relevant node.
*
* @return the topic
*/
Expand All @@ -427,7 +427,7 @@ public String topic() {
* Gets the dialogNode.
*
* <p>The ID of the dialog node that the **topic** property is taken from. The **topic** property
* is populated using the value of the dialog node's **user_label** property.
* is populated using the value of the dialog node's **title** property.
*
* @return the dialogNode
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class RuntimeEntity extends GenericModel {
protected Map<String, Object> metadata;
protected List<CaptureGroup> groups;
protected RuntimeEntityInterpretation interpretation;
protected List<RuntimeEntityAlternative> alternatives;
protected RuntimeEntityRole role;

/** Builder. */
Expand All @@ -38,6 +39,7 @@ public static class Builder {
private Map<String, Object> metadata;
private List<CaptureGroup> groups;
private RuntimeEntityInterpretation interpretation;
private List<RuntimeEntityAlternative> alternatives;
private RuntimeEntityRole role;

private Builder(RuntimeEntity runtimeEntity) {
Expand All @@ -48,6 +50,7 @@ private Builder(RuntimeEntity runtimeEntity) {
this.metadata = runtimeEntity.metadata;
this.groups = runtimeEntity.groups;
this.interpretation = runtimeEntity.interpretation;
this.alternatives = runtimeEntity.alternatives;
this.role = runtimeEntity.role;
}

Expand Down Expand Up @@ -106,6 +109,21 @@ public Builder addGroups(CaptureGroup groups) {
return this;
}

/**
* Adds an alternatives to alternatives.
*
* @param alternatives the new alternatives
* @return the RuntimeEntity builder
*/
public Builder addAlternatives(RuntimeEntityAlternative alternatives) {
com.ibm.cloud.sdk.core.util.Validator.notNull(alternatives, "alternatives cannot be null");
if (this.alternatives == null) {
this.alternatives = new ArrayList<RuntimeEntityAlternative>();
}
this.alternatives.add(alternatives);
return this;
}

/**
* Set the entity.
*
Expand Down Expand Up @@ -183,6 +201,17 @@ public Builder interpretation(RuntimeEntityInterpretation interpretation) {
return this;
}

/**
* Set the alternatives. Existing alternatives will be replaced.
*
* @param alternatives the alternatives
* @return the RuntimeEntity builder
*/
public Builder alternatives(List<RuntimeEntityAlternative> alternatives) {
this.alternatives = alternatives;
return this;
}

/**
* Set the role.
*
Expand All @@ -206,6 +235,7 @@ protected RuntimeEntity(Builder builder) {
metadata = builder.metadata;
groups = builder.groups;
interpretation = builder.interpretation;
alternatives = builder.alternatives;
role = builder.role;
}

Expand Down Expand Up @@ -300,6 +330,21 @@ public RuntimeEntityInterpretation interpretation() {
return interpretation;
}

/**
* Gets the alternatives.
*
* <p>An array of possible alternative values that the user might have intended instead of the
* value returned in the **value** property. This property is returned only for `@sys-time` and
* `@sys-date` entities when the user's input is ambiguous.
*
* <p>This property is included only if the new system entities are enabled for the workspace.
*
* @return the alternatives
*/
public List<RuntimeEntityAlternative> alternatives() {
return alternatives;
}

/**
* Gets the role.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* (C) Copyright IBM Corp. 2020.
*
* 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.
*/
package com.ibm.watson.assistant.v1.model;

import com.ibm.cloud.sdk.core.service.model.GenericModel;

/** An alternative value for the recognized entity. */
public class RuntimeEntityAlternative extends GenericModel {

protected String value;
protected Double confidence;

/** Builder. */
public static class Builder {
private String value;
private Double confidence;

private Builder(RuntimeEntityAlternative runtimeEntityAlternative) {
this.value = runtimeEntityAlternative.value;
this.confidence = runtimeEntityAlternative.confidence;
}

/** Instantiates a new builder. */
public Builder() {}

/**
* Builds a RuntimeEntityAlternative.
*
* @return the runtimeEntityAlternative
*/
public RuntimeEntityAlternative build() {
return new RuntimeEntityAlternative(this);
}

/**
* Set the value.
*
* @param value the value
* @return the RuntimeEntityAlternative builder
*/
public Builder value(String value) {
this.value = value;
return this;
}

/**
* Set the confidence.
*
* @param confidence the confidence
* @return the RuntimeEntityAlternative builder
*/
public Builder confidence(Double confidence) {
this.confidence = confidence;
return this;
}
}

protected RuntimeEntityAlternative(Builder builder) {
value = builder.value;
confidence = builder.confidence;
}

/**
* New builder.
*
* @return a RuntimeEntityAlternative builder
*/
public Builder newBuilder() {
return new Builder(this);
}

/**
* Gets the value.
*
* <p>The entity value that was recognized in the user input.
*
* @return the value
*/
public String value() {
return value;
}

/**
* Gets the confidence.
*
* <p>A decimal percentage that represents Watson's confidence in the recognized entity.
*
* @return the confidence
*/
public Double confidence() {
return confidence;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,8 @@ public String newUserLabel() {
/**
* Gets the newDisambiguationOptOut.
*
* <p>Whether the dialog node should be excluded from disambiguation suggestions.
* <p>Whether the dialog node should be excluded from disambiguation suggestions. Valid only when
* **type**=`standard` or `frame`.
*
* @return the newDisambiguationOptOut
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Map<String, Object> userDefined() {
/**
* Gets the system.
*
* <p>For internal use only.
* <p>System context data used by the skill.
*
* @return the system
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ public class MessageInputOptions extends GenericModel {
@SerializedName("return_context")
protected Boolean returnContext;

protected Boolean export;

/** Builder. */
public static class Builder {
private Boolean debug;
private Boolean restart;
private Boolean alternateIntents;
private Boolean returnContext;
private Boolean export;

private Builder(MessageInputOptions messageInputOptions) {
this.debug = messageInputOptions.debug;
this.restart = messageInputOptions.restart;
this.alternateIntents = messageInputOptions.alternateIntents;
this.returnContext = messageInputOptions.returnContext;
this.export = messageInputOptions.export;
}

/** Instantiates a new builder. */
Expand Down Expand Up @@ -96,13 +100,25 @@ public Builder returnContext(Boolean returnContext) {
this.returnContext = returnContext;
return this;
}

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

protected MessageInputOptions(Builder builder) {
debug = builder.debug;
restart = builder.restart;
alternateIntents = builder.alternateIntents;
returnContext = builder.returnContext;
export = builder.export;
}

/**
Expand All @@ -118,7 +134,8 @@ public Builder newBuilder() {
* Gets the debug.
*
* <p>Whether to return additional diagnostic information. Set to `true` to return additional
* information under the `output.debug` key.
* information in the `output.debug` property. If you also specify **return_context**=`true`, the
* returned skill context includes the `system.state` property.
*
* @return the debug
*/
Expand Down Expand Up @@ -153,11 +170,28 @@ public Boolean alternateIntents() {
* Gets the returnContext.
*
* <p>Whether to return session context with the response. If you specify `true`, the response
* will include the `context` property.
* includes the `context` property. If you also specify **debug**=`true`, the returned skill
* context includes the `system.state` property.
*
* @return the returnContext
*/
public Boolean returnContext() {
return returnContext;
}

/**
* Gets the export.
*
* <p>Whether to return session context, including full conversation state. If you specify `true`,
* the response includes the `context` property, and the skill context includes the `system.state`
* property.
*
* <p>**Note:** If **export**=`true`, the context is returned regardless of the value of
* **return_context**.
*
* @return the export
*/
public Boolean export() {
return export;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public MessageOutput getOutput() {
/**
* Gets the context.
*
* <p>State information for the conversation. The context is stored by the assistant on a
* per-session basis. You can use this property to access context variables.
* <p>Context data for the conversation. The context is stored by the assistant on a per-session
* basis. You can use this property to access context variables.
*
* <p>**Note:** The context is included in message responses only if **return_context**=`true` in
* the message request.
Expand Down

0 comments on commit 515fb60

Please sign in to comment.