Skip to content

Commit

Permalink
Added Api.ai session_id as optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoelzl committed May 19, 2016
1 parent 06d1956 commit e17feb5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reference/library-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Returns the most likely transcription if ``show_all`` is false (the default). Ot

Raises a ``speech_recognition.UnknownValueError`` exception if the speech is unintelligible. Raises a ``speech_recognition.RequestError`` exception if the speech recognition operation failed, if the key isn't valid, or if there is no internet connection.

``recognizer_instance.recognize_api(audio_data, client_access_token, language = "en", show_all = False)``
``recognizer_instance.recognize_api(audio_data, client_access_token, language = "en", session_id=None, show_all = False)``
----------------------------------------------------------------------------------------

Perform speech recognition on ``audio_data`` (an ``AudioData`` instance), using the api.ai Speech to Text API.
Expand All @@ -230,6 +230,8 @@ The api.ai API client access token is specified by ``client_access_token``. Unfo

Although the recognition language is specified when creating the api.ai agent in the web console, it must also be provided in the ``language`` parameter as an RFC5646 language tag like ``"en"`` (US English) or ``"fr"`` (International French), defaulting to US English. A list of supported language values can be found in the `API documentation <https://api.ai/docs/reference/#languages>`__.

The session_id is a string token up to 36 symbols long, used to identify the client and to manage sessions parameters (including contexts) per client.

Returns the most likely transcription if ``show_all`` is false (the default). Otherwise, returns the `raw API response <https://api.ai/docs/reference/#a-namepost-multipost-query-multipart>`__ as a JSON dictionary.

Raises a ``speech_recognition.UnknownValueError`` exception if the speech is unintelligible. Raises a ``speech_recognition.RequestError`` exception if the speech recognition operation failed, if the key isn't valid, or if there is no internet connection.
Expand Down Expand Up @@ -307,4 +309,4 @@ If ``convert_rate`` is specified and the audio sample rate is not ``convert_rate

If ``convert_width`` is specified and the audio samples are not ``convert_width`` bytes each, the resulting audio is converted to match.

Writing these bytes directly to a file results in a valid `FLAC file <https://en.wikipedia.org/wiki/FLAC>`__.
Writing these bytes directly to a file results in a valid `FLAC file <https://en.wikipedia.org/wiki/FLAC>`__.

0 comments on commit e17feb5

Please sign in to comment.