From 721ad979aaf3bdd2b73588ae6f20d07c7cc52656 Mon Sep 17 00:00:00 2001 From: Angelo Paparazzi Date: Wed, 8 Oct 2025 13:02:50 -0500 Subject: [PATCH 1/3] feat(wa-v2): add environmentId param to sessions functions BREAKING CHANGE: `assistantId` and `environmentId` are now required parameters for the `createSession` and `deleteSession` functions --- ibm_watson/assistant_v2.py | 402 +++++++++------------------------ test/unit/test_assistant_v2.py | 44 ++-- 2 files changed, 137 insertions(+), 309 deletions(-) diff --git a/ibm_watson/assistant_v2.py b/ibm_watson/assistant_v2.py index 23d9b197..0e546f82 100644 --- a/ibm_watson/assistant_v2.py +++ b/ibm_watson/assistant_v2.py @@ -427,19 +427,10 @@ def delete_assistant( Delete an assistant. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse @@ -485,6 +476,7 @@ def delete_assistant( def create_session( self, assistant_id: str, + environment_id: str, *, analytics: Optional['RequestAnalytics'] = None, **kwargs, @@ -498,19 +490,14 @@ def create_session( information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings).). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. + :param str environment_id: Unique identifier of the environment. To find + the environment ID in the watsonx Assistant user interface, open the + environment settings and click **API Details**. **Note:** Currently, the + API does not support creating environments. :param RequestAnalytics analytics: (optional) An optional object containing analytics data. Currently, this data is used only for events sent to the Segment extension. @@ -521,6 +508,8 @@ def create_session( if not assistant_id: raise ValueError('assistant_id must be provided') + if not environment_id: + raise ValueError('environment_id must be provided') if analytics is not None: analytics = convert_model(analytics) headers = {} @@ -547,10 +536,11 @@ def create_session( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['assistant_id'] - path_param_values = self.encode_path_vars(assistant_id) + path_param_keys = ['assistant_id', 'environment_id'] + path_param_values = self.encode_path_vars(assistant_id, environment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/v2/assistants/{assistant_id}/sessions'.format(**path_param_dict) + url = '/v2/assistants/{assistant_id}/environments/{environment_id}/sessions'.format( + **path_param_dict) request = self.prepare_request( method='POST', url=url, @@ -565,6 +555,7 @@ def create_session( def delete_session( self, assistant_id: str, + environment_id: str, session_id: str, **kwargs, ) -> DetailedResponse: @@ -575,19 +566,14 @@ def delete_session( session inactivity timeout, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-assistant-settings)). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. + :param str environment_id: Unique identifier of the environment. To find + the environment ID in the watsonx Assistant user interface, open the + environment settings and click **API Details**. **Note:** Currently, the + API does not support creating environments. :param str session_id: Unique identifier of the session. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. @@ -596,6 +582,8 @@ def delete_session( if not assistant_id: raise ValueError('assistant_id must be provided') + if not environment_id: + raise ValueError('environment_id must be provided') if not session_id: raise ValueError('session_id must be provided') headers = {} @@ -615,10 +603,11 @@ def delete_session( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['assistant_id', 'session_id'] - path_param_values = self.encode_path_vars(assistant_id, session_id) + path_param_keys = ['assistant_id', 'environment_id', 'session_id'] + path_param_values = self.encode_path_vars(assistant_id, environment_id, + session_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/v2/assistants/{assistant_id}/sessions/{session_id}'.format( + url = '/v2/assistants/{assistant_id}/environments/{environment_id}/sessions/{session_id}'.format( **path_param_dict) request = self.prepare_request( method='DELETE', @@ -874,19 +863,10 @@ def message_stream( state (including context data) stored by watsonx Assistant for the duration of the session. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -984,19 +964,10 @@ def message_stream_stateless( Send user input to an assistant and receive a response, with conversation state (including context data) managed by your application. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -1323,19 +1294,10 @@ def list_environments( List the environments associated with an assistant. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param int page_limit: (optional) The number of records to return in each page of results. :param bool include_count: (optional) Whether to include information about @@ -1407,19 +1369,10 @@ def get_environment( 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). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -1487,19 +1440,10 @@ def update_environment( environments, see [Environments](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-publish-overview#environments). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -1588,19 +1532,10 @@ def create_release( the draft environment. (In the watsonx Assistant user interface, a release is called a *version*.). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str description: (optional) The description of the release. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. @@ -1665,19 +1600,10 @@ def list_releases( List the releases associated with an assistant. (In the watsonx Assistant user interface, a release is called a *version*.). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param int page_limit: (optional) The number of records to return in each page of results. :param bool include_count: (optional) Whether to include information about @@ -1751,19 +1677,10 @@ def get_release( request again and checking the value of the **status** property. When processing has completed, the request returns the release data. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str release: Unique identifier of the release. :param bool include_audit: (optional) Whether to include the audit properties (`created` and `updated` timestamps) in the response. @@ -1821,19 +1738,10 @@ def delete_release( Delete a release. (In the watsonx Assistant user interface, a release is called a *version*.). - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str release: Unique identifier of the release. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. @@ -1891,19 +1799,10 @@ def deploy_release( Update the environment with the content of the release. All snapshots saved as part of the release become active in the environment. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str release: Unique identifier of the release. :param str environment_id: The environment ID of the environment where the release is to be deployed. @@ -1981,19 +1880,10 @@ def create_release_export( the artifact. Once the artifact has been created, it will last for the duration (/scope) of the release. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str release: Unique identifier of the release. :param bool include_audit: (optional) Whether to include the audit properties (`created` and `updated` timestamps) in the response. @@ -2067,19 +1957,10 @@ def download_release_export( the contents of the Zip file artifact and individually import the skill JSONs via skill update endpoints.. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str release: Unique identifier of the release. :param str accept: (optional) The type of the response: application/json or application/octet-stream. @@ -2157,19 +2038,10 @@ def create_release_import( created, you may poll the completion of the import via the "Get release import Status" endpoint. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param BinaryIO body: Request body is an Octet-stream of the artifact Zip file that is being imported. :param bool include_audit: (optional) Whether to include the audit @@ -2232,19 +2104,10 @@ def get_release_import_status( Monitor the status of an assistant release import. You may poll this endpoint until the status of the import has either succeeded or failed. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param bool include_audit: (optional) Whether to include the audit properties (`created` and `updated` timestamps) in the response. :param dict headers: A `dict` containing the request headers @@ -2301,19 +2164,10 @@ def get_skill( Get information about a skill. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str skill_id: Unique identifier of the skill. To find the action or dialog skill ID in the watsonx Assistant user interface, open the skill settings and click **API Details**. To find the search skill ID, use the @@ -2380,19 +2234,10 @@ def update_skill( update by calling the **Get skill** method and checking the value of the **status** property. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str skill_id: Unique identifier of the skill. To find the action or dialog skill ID in the watsonx Assistant user interface, open the skill settings and click **API Details**. To find the search skill ID, use the @@ -2489,19 +2334,10 @@ def export_skills( When processing has completed, the request returns the exported JSON data. Remember that the usual rate limits apply. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param bool include_audit: (optional) Whether to include the audit properties (`created` and `updated` timestamps) in the response. :param dict headers: A `dict` containing the request headers @@ -2567,19 +2403,10 @@ def import_skills( check the status of the asynchronous import operation, use the **Get status of skills import** method. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param List[SkillImport] assistant_skills: An array of objects describing the skills for the assistant. Included in responses only if **status**=`Available`. @@ -2653,19 +2480,10 @@ def import_skills_status( Retrieve the status of an asynchronous import operation previously initiated by using the **Import skills** method. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `SkillsAsyncRequestStatus` object diff --git a/test/unit/test_assistant_v2.py b/test/unit/test_assistant_v2.py index a59ad0d8..21613a15 100644 --- a/test/unit/test_assistant_v2.py +++ b/test/unit/test_assistant_v2.py @@ -949,7 +949,7 @@ def test_create_session_all_params(self): create_session() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions') mock_response = '{"session_id": "session_id"}' responses.add( responses.POST, @@ -967,11 +967,13 @@ def test_create_session_all_params(self): # Set up parameter values assistant_id = 'testString' + environment_id = 'testString' analytics = request_analytics_model # Invoke method response = _service.create_session( assistant_id, + environment_id, analytics=analytics, headers={}, ) @@ -998,7 +1000,7 @@ def test_create_session_required_params(self): test_create_session_required_params() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions') mock_response = '{"session_id": "session_id"}' responses.add( responses.POST, @@ -1010,10 +1012,12 @@ def test_create_session_required_params(self): # Set up parameter values assistant_id = 'testString' + environment_id = 'testString' # Invoke method response = _service.create_session( assistant_id, + environment_id, headers={}, ) @@ -1036,7 +1040,7 @@ def test_create_session_value_error(self): test_create_session_value_error() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions') mock_response = '{"session_id": "session_id"}' responses.add( responses.POST, @@ -1048,10 +1052,12 @@ def test_create_session_value_error(self): # Set up parameter values assistant_id = 'testString' + environment_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { "assistant_id": assistant_id, + "environment_id": environment_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} @@ -1079,7 +1085,7 @@ def test_delete_session_all_params(self): delete_session() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions/testString') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions/testString') responses.add( responses.DELETE, url, @@ -1088,11 +1094,13 @@ def test_delete_session_all_params(self): # Set up parameter values assistant_id = 'testString' + environment_id = 'testString' session_id = 'testString' # Invoke method response = _service.delete_session( assistant_id, + environment_id, session_id, headers={}, ) @@ -1116,7 +1124,7 @@ def test_delete_session_value_error(self): test_delete_session_value_error() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions/testString') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions/testString') responses.add( responses.DELETE, url, @@ -1125,11 +1133,13 @@ def test_delete_session_value_error(self): # Set up parameter values assistant_id = 'testString' + environment_id = 'testString' session_id = 'testString' # Pass in all but one required param and check for a ValueError req_param_dict = { "assistant_id": assistant_id, + "environment_id": environment_id, "session_id": session_id, } for param in req_param_dict.keys(): @@ -1169,7 +1179,7 @@ def test_message_all_params(self): message() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "user_id": "user_id", "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}}' responses.add( responses.POST, @@ -1363,7 +1373,7 @@ def test_message_required_params(self): test_message_required_params() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "user_id": "user_id", "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}}' responses.add( responses.POST, @@ -1405,7 +1415,7 @@ def test_message_value_error(self): test_message_value_error() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/sessions/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/sessions/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "user_id": "user_id", "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}}' responses.add( responses.POST, @@ -1452,7 +1462,7 @@ def test_message_stateless_all_params(self): message_stateless() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}, "private_action_variables": {"anyKey": "anyValue"}, "private_skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}, "user_id": "user_id"}' responses.add( responses.POST, @@ -1645,7 +1655,7 @@ def test_message_stateless_required_params(self): test_message_stateless_required_params() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}, "private_action_variables": {"anyKey": "anyValue"}, "private_skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}, "user_id": "user_id"}' responses.add( responses.POST, @@ -1685,7 +1695,7 @@ def test_message_stateless_value_error(self): test_message_stateless_value_error() """ # Set up mock - url = preprocess_url('/v2/assistants/testString/message') + url = preprocess_url('/v2/assistants/testString/environments/testString/message') mock_response = '{"output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "context": {"global": {"system": {"timezone": "timezone", "user_id": "user_id", "turn_count": 10, "locale": "en-us", "reference_time": "reference_time", "session_start_time": "session_start_time", "state": "state", "skip_user_input": false}, "session_id": "session_id"}, "skills": {"main skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}}, "actions skill": {"user_defined": {"anyKey": "anyValue"}, "system": {"state": "state"}, "action_variables": {"anyKey": "anyValue"}, "skill_variables": {"anyKey": "anyValue"}, "private_action_variables": {"anyKey": "anyValue"}, "private_skill_variables": {"anyKey": "anyValue"}}}, "integrations": {"anyKey": "anyValue"}}, "masked_output": {"generic": [{"response_type": "conversation_search", "text": "text", "citations_title": "citations_title", "citations": [{"title": "title", "text": "text", "body": "body", "search_result_index": 19, "ranges": [{"start": 5, "end": 3}]}], "confidence_scores": {"threshold": 9, "pre_gen": 7, "post_gen": 8, "extractiveness": 14}, "response_length_option": "response_length_option", "search_results": [{"result_metadata": {"document_retrieval_source": "document_retrieval_source", "score": 5}, "id": "id", "title": "title", "body": "body"}], "disclaimer": "disclaimer"}], "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "actions": [{"name": "name", "type": "client", "parameters": {"anyKey": "anyValue"}, "result_variable": "result_variable", "credentials": "credentials"}], "debug": {"nodes_visited": [{"dialog_node": "dialog_node", "title": "title", "conditions": "conditions"}], "log_messages": [{"level": "info", "message": "message", "code": "code", "source": {"type": "dialog_node", "dialog_node": "dialog_node"}}], "branch_exited": false, "branch_exited_reason": "completed", "turn_events": [{"event": "action_visited", "source": {"type": "action", "action": "action", "action_title": "action_title", "condition": "condition"}, "action_start_time": "action_start_time", "condition_type": "user_defined", "reason": "intent", "result_variable": "result_variable"}]}, "user_defined": {"anyKey": "anyValue"}, "spelling": {"text": "text", "original_text": "original_text", "suggested_text": "suggested_text"}, "llm_metadata": [{"task": "task", "model_id": "model_id"}]}, "masked_input": {"message_type": "text", "text": "text", "intents": [{"intent": "intent", "confidence": 10, "skill": "skill"}], "entities": [{"entity": "entity", "location": [8], "value": "value", "confidence": 10, "groups": [{"group": "group", "location": [8]}], "interpretation": {"calendar_type": "calendar_type", "datetime_link": "datetime_link", "festival": "festival", "granularity": "day", "range_link": "range_link", "range_modifier": "range_modifier", "relative_day": 12, "relative_month": 14, "relative_week": 13, "relative_weekend": 16, "relative_year": 13, "specific_day": 12, "specific_day_of_week": "specific_day_of_week", "specific_month": 14, "specific_quarter": 16, "specific_year": 13, "numeric_value": 13, "subtype": "subtype", "part_of_day": "part_of_day", "relative_hour": 13, "relative_minute": 15, "relative_second": 15, "specific_hour": 13, "specific_minute": 15, "specific_second": 15, "timezone": "timezone"}, "alternatives": [{"value": "value", "confidence": 10}], "role": {"type": "date_from"}, "skill": "skill"}], "suggestion_id": "suggestion_id", "attachments": [{"url": "url", "media_type": "media_type"}], "analytics": {"browser": "browser", "device": "device", "pageUrl": "page_url"}, "options": {"restart": false, "alternate_intents": false, "async_callout": false, "spelling": {"suggestions": false, "auto_correct": true}, "debug": false, "return_context": false, "export": false}}, "user_id": "user_id"}' responses.add( responses.POST, @@ -13788,9 +13798,9 @@ def test_turn_event_generative_ai_called_metrics_serialization(self): # Construct a json representation of a TurnEventGenerativeAICalledMetrics model turn_event_generative_ai_called_metrics_model_json = {} - turn_event_generative_ai_called_metrics_model_json['search_time_ms'] = 'unknown type: float' - turn_event_generative_ai_called_metrics_model_json['answer_generation_time_ms'] = 'unknown type: float' - turn_event_generative_ai_called_metrics_model_json['total_time_ms'] = 'unknown type: float' + turn_event_generative_ai_called_metrics_model_json['search_time_ms'] = 72.5 + turn_event_generative_ai_called_metrics_model_json['answer_generation_time_ms'] = 72.5 + turn_event_generative_ai_called_metrics_model_json['total_time_ms'] = 72.5 # Construct a model instance of TurnEventGenerativeAICalledMetrics by calling from_dict on the json representation turn_event_generative_ai_called_metrics_model = TurnEventGenerativeAICalledMetrics.from_dict(turn_event_generative_ai_called_metrics_model_json) @@ -14562,9 +14572,9 @@ def test_message_output_debug_turn_event_turn_event_generative_ai_called_seriali turn_event_generative_ai_called_callout_model['idk_reason_code'] = 'testString' turn_event_generative_ai_called_metrics_model = {} # TurnEventGenerativeAICalledMetrics - turn_event_generative_ai_called_metrics_model['search_time_ms'] = 'unknown type: float' - turn_event_generative_ai_called_metrics_model['answer_generation_time_ms'] = 'unknown type: float' - turn_event_generative_ai_called_metrics_model['total_time_ms'] = 'unknown type: float' + turn_event_generative_ai_called_metrics_model['search_time_ms'] = 72.5 + turn_event_generative_ai_called_metrics_model['answer_generation_time_ms'] = 72.5 + turn_event_generative_ai_called_metrics_model['total_time_ms'] = 72.5 # Construct a json representation of a MessageOutputDebugTurnEventTurnEventGenerativeAICalled model message_output_debug_turn_event_turn_event_generative_ai_called_model_json = {} From ddcb11f32b902a48146d18f5fda62ffd2a11bf0c Mon Sep 17 00:00:00 2001 From: Angelo Paparazzi Date: Wed, 8 Oct 2025 13:05:26 -0500 Subject: [PATCH 2/3] fix(wa-v2): fix missing path parameter in HTTP request creation for message functions --- ibm_watson/assistant_v2.py | 39 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/ibm_watson/assistant_v2.py b/ibm_watson/assistant_v2.py index 0e546f82..32d898ab 100644 --- a/ibm_watson/assistant_v2.py +++ b/ibm_watson/assistant_v2.py @@ -641,19 +641,10 @@ def message( (including context data) stored by watsonx Assistant for the duration of the session. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -722,7 +713,7 @@ def message( path_param_values = self.encode_path_vars(assistant_id, environment_id, session_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/v2/assistants/{assistant_id}/sessions/{session_id}/message'.format( + url = '/v2/assistants/{assistant_id}/environments/{environment_id}/sessions/{session_id}/message'.format( **path_param_dict) request = self.prepare_request( method='POST', @@ -751,19 +742,10 @@ def message_stateless( Send user input to an assistant and receive a response, with conversation state (including context data) managed by your application. - :param str assistant_id: The assistant ID or the environment ID of the - environment where the assistant is deployed. - Set the value for this ID depending on the type of request: - - For message, session, and log requests, specify the environment ID of - the environment where the assistant is deployed. - - For all other requests, specify the assistant ID of the assistant. - To get the **assistant ID** and **environment ID** in the watsonx - Assistant interface, open the **Assistant settings** page, and scroll to - the **Assistant IDs and API details** section and click **View Details**. - **Note:** If you are using the classic Watson Assistant experience, always - use the assistant ID. - To find the **assistant ID** in the user interface, open the **Assistant - settings** and click **API Details**. + :param str assistant_id: Unique identifier of the assistant. To get the + **assistant ID** in the watsonx Assistant interface, open the **Assistant + settings** page, and scroll to the **Assistant IDs and API details** + section and click **View Details**. :param str environment_id: Unique identifier of the environment. To find the environment ID in the watsonx Assistant user interface, open the environment settings and click **API Details**. **Note:** Currently, the @@ -829,7 +811,8 @@ def message_stateless( path_param_keys = ['assistant_id', 'environment_id'] path_param_values = self.encode_path_vars(assistant_id, environment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/v2/assistants/{assistant_id}/message'.format(**path_param_dict) + url = '/v2/assistants/{assistant_id}/environments/{environment_id}/message'.format( + **path_param_dict) request = self.prepare_request( method='POST', url=url, From f6eef01ab6c3319d7dfb32be2211c34087d1d7e6 Mon Sep 17 00:00:00 2001 From: Angelo Paparazzi Date: Fri, 10 Oct 2025 11:40:51 -0500 Subject: [PATCH 3/3] ci(deploy): fix automated release process --- .bumpversion.cfg | 2 +- .github/workflows/deploy.yml | 8 +++----- ibm_watson/version.py | 2 +- setup.py | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 654bd4b5..8edc9657 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 9.0.0 +current_version = 10.0.0 commit = True message = Bump version: {current_version} → {new_version} [skip ci] diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3b58867e..781cee26 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -67,11 +67,9 @@ jobs: - name: Build binary wheel and a source tarball run: | pip3 install setuptools wheel twine build - python -m build --sdist --outdir dist/ + python setup.py sdist - - name: Publish distribution to Test PyPI - continue-on-error: true - uses: pypa/gh-action-pypi-publish@v1.4.2 # Try to update version tag every release + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_TOKEN }} - repository_url: https://upload.pypi.org/legacy/ # This must be changed if testing deploys to test.pypi.org diff --git a/ibm_watson/version.py b/ibm_watson/version.py index 33de8d16..2e568bf4 100644 --- a/ibm_watson/version.py +++ b/ibm_watson/version.py @@ -1 +1 @@ -__version__ = '9.0.0' +__version__ = '10.0.0' diff --git a/setup.py b/setup.py index 9fd6acf3..566a960d 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ from setuptools import setup from os import path -__version__ = '9.0.0' +__version__ = '10.0.0' # read contents of README file this_directory = path.abspath(path.dirname(__file__))