Lex Chatbot with Polly Audio Responses


I hope this message finds you well. I am currently facing a challenge in integrating Amazon Polly audio responses with my Lex chatbot. The objective is to provide users with both text and audio responses based on their interactions with the chatbot.

Problem 1: Polly Audio Integration with Lex Text I have successfully implemented a Lex chatbot with response generation using a Language Model (LLM). For audio generation, I have integrated Amazon Polly, which generates audio responses and saves them in an S3 bucket. However, I am struggling to seamlessly integrate Polly audio responses with the Lex text responses and display them in the Lex bot's UI.

Problem 2: Mic Input for Audio Question Additionally, when attempting to use the microphone option in Lex for asking questions in audio form, I encounter the following error:

Invalid Bot Configuration: Encountered an exception when making Amazon Polly service call, 1 validation error detected: Value null at 'voiceId' failed to satisfy constraint: Member must not be null (Service: AmazonPolly; Status Code: 400; Error Code: ValidationException; Request ID: 7a3064eb-9d7f-4497-896c-494049124d6a; Proxy: null)

I would greatly appreciate any guidance or insights from the community on resolving these issues. If anyone has successfully integrated Amazon Polly audio responses with Lex chatbots or has experience with the microphone input configuration, your assistance would be invaluable.

Thank you in advance for your help!

1 Answer

Have you specified the voice to be used (the voice id, for example Matthew)? The error message seems to be complaining about that. https://docs.aws.amazon.com/polly/latest/dg/API_Voice.html

profile pictureAWS
answered 2 months ago
  • polly_client = boto3.client('polly') import base64 voice_id = 'Joanna' def generate_audio_from_text(text): response = polly_client.synthesize_speech( Text=text, OutputFormat='mp3', VoiceId=voice_id ) I also add this , but error remain same

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions