Exposes x-watson-learning-opt-out request query parameter #35
Conversation
@@ -102,6 +102,7 @@ - (NSString *)getStartMessage{ | |||
[inputParameters setValue:self.interimResults forKey:@"interim_results"]; | |||
[inputParameters setValue:self.continuous forKey:@"continuous"]; | |||
[inputParameters setValue:self.inactivityTimeout forKey:@"inactivity_timeout"]; | |||
[inputParameters setValue:self.learningOptOut forKey:@"x-watson-learning-opt-out"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter should be set into the WebSocket header, not here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihui I was looking at the docs and they say query parameter:
http://www.ibm.com/watson/developercloud/doc/text-to-speech/websockets.shtml Am I looking at the correct place?
I checked in the demo app https://speech-to-text-demo.mybluemix.net/ in index.js and found that "X-Watson-Learning-Opt-Out" was supposed to go in the query parameter too but is actually not being set. It is a TODO. So I am confused. How can I check the value was correctly set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is TTS and it should be the same as STT. And yes, it says it is query parameter, so it should be like /v1/recognize?x-watson-learning-opt-out=true
or /v1/synthesize?x-watson-learning-opt-out=true
, not in the start message and should be before that.
But on Data Collection sections, it says "If you do not want to share your data, set the header parameter X-Watson-Learning-Opt-Out to true for each request. Data is collected for any request that omits this header.", see URLs below:
http://www.ibm.com/watson/developercloud/speech-to-text/api/v1/#data_collection
http://www.ibm.com/watson/developercloud/text-to-speech/api/v1/#data_collection
http://www.ibm.com/watson/developercloud/doc/getting_started/gs-logging.shtml
You can also review 4b20393 for STT and TTS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. You already did it right?! thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nacho4d not all, will commit the TTS part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @germanattanasio ! |
Thanks @germanattanasio , appreciated. |
This reverts commit 92e78be.
@mihui I have updated this. I hope it is ok now :] |
|
||
@property (readonly) NSString *token; | ||
@property (copy, nonatomic) void (^tokenGenerator) (void (^tokenHandler)(NSString *token)); | ||
|
||
- (void) invalidateToken; | ||
- (void) requestToken: (void(^)(AuthConfiguration *config)) completionHandler; | ||
- (NSDictionary*) createRequestHeaders; | ||
- (NSDictionary*) createRequestHeadersWithXWatsonLearningOptOut; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep only one "createRequestHeaders" method because it is only SDK-internal use, and change value through config. If the developers want to change the SDK code, they could do it, we just keep the code simple.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. What do you think about having a private header "AuthConfiguration+Internal.h" ? It should look something like this:
// AuthConfiguration+Internal.h
#import AuthConfiguration.h
@interface AuthConfiguration(Internal)
- (NSDictionary*) createRequestHeaders;
- (NSDictionary*) createRequestHeadersWithXWatsonLearningOptOut;
... other internal methods to be used only by the sdk...
@end
This way we can separate internal and internal stuff. In this case createRequestHeadersWithXWatsonLearningOptOut
is used in STT and TTS request. IMO is better to have it as a method instead of doing it separately twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good idea to separate them, changing configuration is good too, either way is OK.
@mihui I have the code. I hope it is ok now :] |
I am merging this since I have to ship something including this by this week. |
I exposed this parameter since it could be a requirement for some clients