watson-developer-cloud / swift-sdk

:iphone: The Watson Swift SDK enables developers to quickly add Watson Cognitive Computing services to their Swift applications.
https://watson-developer-cloud.github.io/swift-sdk/
Apache License 2.0
877 stars 223 forks source link

[Watson Assistant V2] Context variable in message response is always "nil" #1021

Closed benjaminbruch closed 4 years ago

benjaminbruch commented 4 years ago

Overview [Watson Assistant V2] Context variable in message response is always "nil"

In my welcome dialog node I defined 2 context variables. But these were not send within message response.

Expected behavior These variables should be within context variable.

Actual behavior context = (Assistant.MessageContext?) nil

How to reproduce Create welcome dialog node , define context variable, start conversation and try to receive context data.

Screenshots Bildschirmfoto 2020-07-02 um 13 40 26 Bildschirmfoto 2020-07-02 um 13 39 35

SDK Version 3.5.0 & 3.4.0 Bildschirmfoto 2020-07-02 um 14 07 09

Additional information: Apple Swift version 5.2.4

Additonal questions:

  1. Is there any current documentation on "How to set context variable for sending to Watson?
  2. 'IBMSwiftSDKCore', '~> 1.0.0' dependency is still 1.0.0 -> Will this be updated to latest version 1.1.0?
benjaminbruch commented 4 years ago

Found the solution to my problem at:

https://stackoverflow.com/questions/55793357/how-to-get-context-variables-from-the-response-of-ibm-watson-assistant-v2-using

Had to set return context option "true" in message input. Here is an example:

assistant.message(assistantID: assistantID, sessionID: sessionID, input: MessageInput(options: MessageInputOptions(returnContext: true))) { response, error in
            if let error = error {
                print(error)
                return
            }
        }

Still would be nice if this and the following question would be in the docs:

Is there any current documentation on "How to set context variable for sending to Watson?