diff --git a/wit/wit.py b/wit/wit.py index 12a8bf7..c595a42 100644 --- a/wit/wit.py +++ b/wit/wit.py @@ -67,7 +67,7 @@ def message(self, msg, context=None, n=None, verbose=None): resp = req(self.logger, self.access_token, "GET", "/message", params) return resp - def speech(self, audio_file, headers=None, verbose=None): + def speech(self, audio_file, headers=None, context=None, verbose=None): """Sends an audio file to the /speech API. Uses the streaming feature of requests (see `req`), so opening the file in binary mode is strongly recommended (see @@ -81,6 +81,8 @@ def speech(self, audio_file, headers=None, verbose=None): """ params = {} headers = headers or {} + if context: + params["context"] = json.dumps(context) if verbose: params["verbose"] = True resp = req(