Skip to content

Commit 7b9a5cd

Browse files
feat(wa-v2): update required params for createSession
BREAKING CHANGE: `environmentId` now required for `createSession` function
1 parent 28e634e commit 7b9a5cd

File tree

3 files changed

+3715
-1609
lines changed

3 files changed

+3715
-1609
lines changed

assistant/v2.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ class AssistantV2 extends BaseService {
516516
* **Note:** If you are using the classic Watson Assistant experience, always use the assistant ID.
517517
*
518518
* To find the **assistant ID** in the user interface, open the **Assistant settings** and click **API Details**.
519+
* @param {string} params.environmentId - Unique identifier of the environment. To find the environment ID in the
520+
* watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the
521+
* API does not support creating environments.
519522
* @param {RequestAnalytics} [params.analytics] - An optional object containing analytics data. Currently, this data
520523
* is used only for events sent to the Segment extension.
521524
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
@@ -525,8 +528,8 @@ class AssistantV2 extends BaseService {
525528
params: AssistantV2.CreateSessionParams
526529
): Promise<AssistantV2.Response<AssistantV2.SessionResponse>> {
527530
const _params = { ...params };
528-
const _requiredParams = ['assistantId'];
529-
const _validParams = ['assistantId', 'analytics', 'signal', 'headers'];
531+
const _requiredParams = ['assistantId', 'environmentId'];
532+
const _validParams = ['assistantId', 'environmentId', 'analytics', 'signal', 'headers'];
530533
const _validationErrors = validateParams(_params, _requiredParams, _validParams);
531534
if (_validationErrors) {
532535
return Promise.reject(_validationErrors);
@@ -542,13 +545,14 @@ class AssistantV2 extends BaseService {
542545

543546
const path = {
544547
'assistant_id': _params.assistantId,
548+
'environment_id': _params.environmentId,
545549
};
546550

547551
const sdkHeaders = getSdkHeaders(AssistantV2.DEFAULT_SERVICE_NAME, 'v2', 'createSession');
548552

549553
const parameters = {
550554
options: {
551-
url: '/v2/assistants/{assistant_id}/sessions',
555+
url: '/v2/assistants/{assistant_id}/environments/{environment_id}/sessions',
552556
method: 'POST',
553557
body,
554558
qs: query,
@@ -2963,6 +2967,11 @@ namespace AssistantV2 {
29632967
* To find the **assistant ID** in the user interface, open the **Assistant settings** and click **API Details**.
29642968
*/
29652969
assistantId: string;
2970+
/** Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface,
2971+
* open the environment settings and click **API Details**. **Note:** Currently, the API does not support creating
2972+
* environments.
2973+
*/
2974+
environmentId: string;
29662975
/** An optional object containing analytics data. Currently, this data is used only for events sent to the
29672976
* Segment extension.
29682977
*/

0 commit comments

Comments
 (0)