Skip to content

Commit f72ac54

Browse files
authored
Merge pull request #2717 from daspecster/fix-speech-streaming-speech-context-bug
Fix bug with speech streaming speech_context.
2 parents 56560e7 + e55935e commit f72ac54

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

google-cloud-speech/google/cloud/speech/_gax.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ def _stream_requests(sample, language_code=None, max_alternatives=None,
329329
"""
330330
config_request = _make_streaming_request(
331331
sample, language_code=language_code, max_alternatives=max_alternatives,
332-
profanity_filter=profanity_filter, speech_context=speech_context,
332+
profanity_filter=profanity_filter,
333+
speech_context=SpeechContext(phrases=speech_context),
333334
single_utterance=single_utterance, interim_results=interim_results)
334335

335336
# The config request MUST go first and not contain any audio data.

google-cloud-speech/unit_tests/test__gax.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ def test_stream_requests(self):
130130
from io import BytesIO
131131
from google.cloud import speech
132132
from google.cloud.speech.sample import Sample
133-
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import (
134-
SpeechContext)
135133
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import (
136134
StreamingRecognitionConfig)
137135
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import (
@@ -143,7 +141,7 @@ def test_stream_requests(self):
143141
language_code = 'US-en'
144142
max_alternatives = 2
145143
profanity_filter = True
146-
speech_context = SpeechContext(phrases=self.HINTS)
144+
speech_context = self.HINTS
147145
single_utterance = True
148146
interim_results = False
149147
streaming_requests = self._callFUT(sample, language_code,

0 commit comments

Comments
 (0)