Skip to content

Commit 5c6e9db

Browse files
committed
feat(assistantv1): assistant v1 generated with new spec
OutputData - removed required text property; RuntimeEntity - removed optional metadata property; WorkspaceID changed from required to optional; RuntimeResponseGeneric - 3 new response types added BREAKING CHANGE: Removed required text property on outputdata and removed optional metadata property from runtimeentity
1 parent fbd5be1 commit 5c6e9db

3 files changed

Lines changed: 173 additions & 95 deletions

File tree

assistant/v1.ts

Lines changed: 140 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright IBM Corp. 2018, 2021.
2+
* (C) Copyright IBM Corp. 2018, 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ class AssistantV1 extends BaseService {
4545
static DEFAULT_SERVICE_NAME: string = 'conversation';
4646

4747
/** Release date of the API version you want to use. Specify dates in YYYY-MM-DD format. The current version is
48-
* `2021-06-14`.
48+
* `2021-11-27`.
4949
*/
5050
version: string;
5151

@@ -54,7 +54,7 @@ class AssistantV1 extends BaseService {
5454
*
5555
* @param {Object} options - Options for the service.
5656
* @param {string} options.version - Release date of the API version you want to use. Specify dates in YYYY-MM-DD
57-
* format. The current version is `2021-06-14`.
57+
* format. The current version is `2021-11-27`.
5858
* @param {string} [options.serviceUrl] - The base url to use when contacting the service. The base url may differ between IBM Cloud regions.
5959
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
6060
* @param {string} [options.serviceName] - The name of the service to configure
@@ -3557,7 +3557,7 @@ namespace AssistantV1 {
35573557
/** Options for the `AssistantV1` constructor. */
35583558
export interface Options extends UserOptions {
35593559
/** Release date of the API version you want to use. Specify dates in YYYY-MM-DD format. The current version is
3560-
* `2021-06-14`.
3560+
* `2021-11-27`.
35613561
*/
35623562
version: string;
35633563
}
@@ -5437,8 +5437,6 @@ namespace AssistantV1 {
54375437
nodes_visited_details?: DialogNodeVisitedDetails[];
54385438
/** An array of up to 50 messages logged with the request. */
54395439
log_messages: LogMessage[];
5440-
/** An array of responses to the user. */
5441-
text: string[];
54425440
/** Output intended for any channel. It is the responsibility of the client application to implement the
54435441
* supported response types.
54445442
*/
@@ -5483,12 +5481,6 @@ namespace AssistantV1 {
54835481
value: string;
54845482
/** A decimal percentage that represents Watson's confidence in the recognized entity. */
54855483
confidence?: number;
5486-
/** **Deprecated.** Any metadata for the entity.
5487-
*
5488-
* Beginning with the `2021-06-14` API version, the `metadata` property is no longer returned. For information
5489-
* about system entities recognized in the user input, see the `interpretation` property.
5490-
*/
5491-
metadata?: JsonObject;
54925484
/** The recognized capture groups for the entity, as defined by the entity pattern. */
54935485
groups?: CaptureGroup[];
54945486
/** An object containing detailed information about the entity recognized in the user input.
@@ -5764,6 +5756,8 @@ namespace AssistantV1 {
57645756
system_entities?: WorkspaceSystemSettingsSystemEntities;
57655757
/** Workspace settings related to detection of irrelevant input. */
57665758
off_topic?: WorkspaceSystemSettingsOffTopic;
5759+
/** WorkspaceSystemSettings accepts additional properties. */
5760+
[propName: string]: any;
57675761
}
57685762

57695763
/** Workspace settings related to the disambiguation feature. */
@@ -5808,6 +5802,30 @@ namespace AssistantV1 {
58085802
store_generic_responses?: boolean;
58095803
}
58105804

5805+
/** DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio. */
5806+
export interface DialogNodeOutputGenericDialogNodeOutputResponseTypeAudio extends DialogNodeOutputGeneric {
5807+
/** The type of response returned by the dialog node. The specified response type must be supported by the
5808+
* client application or channel.
5809+
*/
5810+
response_type: string;
5811+
/** The `https:` URL of the audio clip. */
5812+
source: string;
5813+
/** An optional title to show before the response. */
5814+
title?: string;
5815+
/** An optional description to show with the response. */
5816+
description?: string;
5817+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
5818+
* response is intended for a built-in integration and should not be handled by an API client.
5819+
*/
5820+
channels?: ResponseGenericChannel[];
5821+
/** For internal use only. */
5822+
channel_options?: JsonObject;
5823+
/** Descriptive text that can be used for screen readers or other situations where the audio player cannot be
5824+
* seen.
5825+
*/
5826+
alt_text?: string;
5827+
}
5828+
58115829
/** DialogNodeOutputGenericDialogNodeOutputResponseTypeChannelTransfer. */
58125830
export interface DialogNodeOutputGenericDialogNodeOutputResponseTypeChannelTransfer extends DialogNodeOutputGeneric {
58135831
/** The type of response returned by the dialog node. The specified response type must be supported by the
@@ -5844,6 +5862,26 @@ namespace AssistantV1 {
58445862
channels?: ResponseGenericChannel[];
58455863
}
58465864

5865+
/** DialogNodeOutputGenericDialogNodeOutputResponseTypeIframe. */
5866+
export interface DialogNodeOutputGenericDialogNodeOutputResponseTypeIframe extends DialogNodeOutputGeneric {
5867+
/** The type of response returned by the dialog node. The specified response type must be supported by the
5868+
* client application or channel.
5869+
*/
5870+
response_type: string;
5871+
/** The `https:` URL of the embeddable content. */
5872+
source: string;
5873+
/** An optional title to show before the response. */
5874+
title?: string;
5875+
/** An optional description to show with the response. */
5876+
description?: string;
5877+
/** The URL of an image that shows a preview of the embedded content. */
5878+
image_url?: string;
5879+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
5880+
* response is intended for a built-in integration and should not be handled by an API client.
5881+
*/
5882+
channels?: ResponseGenericChannel[];
5883+
}
5884+
58475885
/** DialogNodeOutputGenericDialogNodeOutputResponseTypeImage. */
58485886
export interface DialogNodeOutputGenericDialogNodeOutputResponseTypeImage extends DialogNodeOutputGeneric {
58495887
/** The type of response returned by the dialog node. The specified response type must be supported by the
@@ -5953,6 +5991,52 @@ namespace AssistantV1 {
59535991
channels?: ResponseGenericChannel[];
59545992
}
59555993

5994+
/** DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo. */
5995+
export interface DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo extends DialogNodeOutputGeneric {
5996+
/** The type of response returned by the dialog node. The specified response type must be supported by the
5997+
* client application or channel.
5998+
*/
5999+
response_type: string;
6000+
/** The `https:` URL of the video. */
6001+
source: string;
6002+
/** An optional title to show before the response. */
6003+
title?: string;
6004+
/** An optional description to show with the response. */
6005+
description?: string;
6006+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
6007+
* response is intended for a built-in integration and should not be handled by an API client.
6008+
*/
6009+
channels?: ResponseGenericChannel[];
6010+
/** For internal use only. */
6011+
channel_options?: JsonObject;
6012+
/** Descriptive text that can be used for screen readers or other situations where the video cannot be seen. */
6013+
alt_text?: string;
6014+
}
6015+
6016+
/** RuntimeResponseGenericRuntimeResponseTypeAudio. */
6017+
export interface RuntimeResponseGenericRuntimeResponseTypeAudio extends RuntimeResponseGeneric {
6018+
/** The type of response returned by the dialog node. The specified response type must be supported by the
6019+
* client application or channel.
6020+
*/
6021+
response_type: string;
6022+
/** The `https:` URL of the audio clip. */
6023+
source: string;
6024+
/** The title or introductory text to show before the response. */
6025+
title?: string;
6026+
/** The description to show with the response. */
6027+
description?: string;
6028+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
6029+
* response is intended for a built-in integration and should not be handled by an API client.
6030+
*/
6031+
channels?: ResponseGenericChannel[];
6032+
/** For internal use only. */
6033+
channel_options?: JsonObject;
6034+
/** Descriptive text that can be used for screen readers or other situations where the audio player cannot be
6035+
* seen.
6036+
*/
6037+
alt_text?: string;
6038+
}
6039+
59566040
/** RuntimeResponseGenericRuntimeResponseTypeChannelTransfer. */
59576041
export interface RuntimeResponseGenericRuntimeResponseTypeChannelTransfer extends RuntimeResponseGeneric {
59586042
/** The type of response returned by the dialog node. The specified response type must be supported by the
@@ -6001,6 +6085,26 @@ namespace AssistantV1 {
60016085
channels?: ResponseGenericChannel[];
60026086
}
60036087

6088+
/** RuntimeResponseGenericRuntimeResponseTypeIframe. */
6089+
export interface RuntimeResponseGenericRuntimeResponseTypeIframe extends RuntimeResponseGeneric {
6090+
/** The type of response returned by the dialog node. The specified response type must be supported by the
6091+
* client application or channel.
6092+
*/
6093+
response_type: string;
6094+
/** The `https:` URL of the embeddable content. */
6095+
source: string;
6096+
/** The title or introductory text to show before the response. */
6097+
title?: string;
6098+
/** The description to show with the response. */
6099+
description?: string;
6100+
/** The URL of an image that shows a preview of the embedded content. */
6101+
image_url?: string;
6102+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
6103+
* response is intended for a built-in integration and should not be handled by an API client.
6104+
*/
6105+
channels?: ResponseGenericChannel[];
6106+
}
6107+
60046108
/** RuntimeResponseGenericRuntimeResponseTypeImage. */
60056109
export interface RuntimeResponseGenericRuntimeResponseTypeImage extends RuntimeResponseGeneric {
60066110
/** The type of response returned by the dialog node. The specified response type must be supported by the
@@ -6011,7 +6115,7 @@ namespace AssistantV1 {
60116115
source: string;
60126116
/** The title or introductory text to show before the response. */
60136117
title?: string;
6014-
/** The description to show with the the response. */
6118+
/** The description to show with the response. */
60156119
description?: string;
60166120
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
60176121
* response is intended for a built-in integration and should not be handled by an API client.
@@ -6029,7 +6133,7 @@ namespace AssistantV1 {
60296133
response_type: string;
60306134
/** The title or introductory text to show before the response. */
60316135
title: string;
6032-
/** The description to show with the the response. */
6136+
/** The description to show with the response. */
60336137
description?: string;
60346138
/** The preferred type of control to display. */
60356139
preference?: string;
@@ -6100,6 +6204,28 @@ namespace AssistantV1 {
61006204
*/
61016205
channels?: ResponseGenericChannel[];
61026206
}
6207+
6208+
/** RuntimeResponseGenericRuntimeResponseTypeVideo. */
6209+
export interface RuntimeResponseGenericRuntimeResponseTypeVideo extends RuntimeResponseGeneric {
6210+
/** The type of response returned by the dialog node. The specified response type must be supported by the
6211+
* client application or channel.
6212+
*/
6213+
response_type: string;
6214+
/** The `https:` URL of the video. */
6215+
source: string;
6216+
/** The title or introductory text to show before the response. */
6217+
title?: string;
6218+
/** The description to show with the response. */
6219+
description?: string;
6220+
/** An array of objects specifying channels for which the response is intended. If **channels** is present, the
6221+
* response is intended for a built-in integration and should not be handled by an API client.
6222+
*/
6223+
channels?: ResponseGenericChannel[];
6224+
/** For internal use only. */
6225+
channel_options?: JsonObject;
6226+
/** Descriptive text that can be used for screen readers or other situations where the video cannot be seen. */
6227+
alt_text?: string;
6228+
}
61036229
}
61046230

61056231
export = AssistantV1;

test/integration/assistant.v1.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('assistant v1 integration', () => {
168168
const res = await assistant.message(params);
169169
const { result } = res || {};
170170
expect(result).toBeDefined();
171-
expect(result.context.system.dialog_stack).toEqual([]);
171+
expect(result.context.system.dialog_stack).toEqual([{"dialog_node": "root"}]);
172172
});
173173

174174
it('dialog_stack with 2016-07-11 version', async () => {
@@ -187,7 +187,7 @@ describe('assistant v1 integration', () => {
187187
const res = await assistant.message(params);
188188
const { result } = res || {};
189189
expect(result).toBeDefined();
190-
expect(result.context.system.dialog_stack).toEqual([]);
190+
expect(result.context.system.dialog_stack).toEqual(["root"]);
191191
});
192192
});
193193

0 commit comments

Comments
 (0)