Skip to content

Custom Virtual Assistant Client Code Example Errors #51

@KEDW02

Description

@KEDW02

Which topic are you reporting about?

https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-api-client&code=python#api-client-v1-api

What do you think needs to be updated?

The first is that all the examples contain the line:
assistant_id = '{environment_id}' # replace with environment ID
Here although the variable name is assistant_id the comment and assignment value both say environment. Here assistant ID would be correct and the line should read:
assistant_id = '{assistant_id}' # replace with assistant ID

The second error is found in examples 2 and 3. These contain this section:
result = assistant.message_stateless(
assistant_id,
input = message_input,
context=context
).get_result()
the function assistant.message_stateless() requires the positional argument environment_id. The solution to this is to add the line
environment_id = '{environment_id}' # replace with environment ID
next to the assistant ID line from earlier on. Then the section of code in examples 2 and 3 should be changed to read:
result = assistant.message_stateless(
environment_id = environment_id,
assistant_id = assistant_id,
input = message_input,
context = context
).get_result()

The final issue I have found is that the section:
Initialize with empty message to start the conversation.
message_input = {
'message_type:': 'text',
'text': ''
}
context = {}
is repeated in example 3.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions