0

When I tried to use google speech api and set RecognitionConfig with meta, with an attribute audioTopic = "xxx", it says: AttributeError: Assignment not allowed (no field "audioTopic" in protocol message object)

The code likes:

    metadata = speech.types.RecognitionMetadata()
    metadata.audioTopic = "blablabla" 

    audio = types.RecognitionAudio(uri=gcs_uri)
    config = types.RecognitionConfig(
        encoding=enums.RecognitionConfig.AudioEncoding.FLAC,
        sample_rate_hertz=44100,
        language_code='en-US',
        enable_automatic_punctuation=True,
        enable_word_time_offsets=True,
        metadata = metadata
    )

Does this feature still work?

1 Answers1

0

"metadata.audioTopic" should be changed to "metadata.audio_topic".