why do I get an answer in binary rather than json. Any help please?

0

Request URL: https://bedrock-agent-runtime.{{AWS_Region}}.amazonaws.com/agents/0J7APE0Z4F/agentAliases/3KL1DTE7G4/sessions/abc123/text

Request Body: { "inputText": "what is blurred vision?", "enableTrace": false, "endSession": false }

Response: + Kõøo :event-type chunk :content-type application/json :message-type event{"bytes":"QmFzZWQgb24geW91ciBxdWVzdGlvbiBhc2tpbmcgd2hhdCBwZXJpb2RvbnRpdGlzIGlzLCBJIGNoZWNrZWQgb3VyIG1lZGljYWwga25vd2xlZGdlIGJhc2UgYW5kIGZvdW5kIGEgZGV0YWlsZWQgZGVmaW5pdGlvbiBvZiBwZXJpb2RvbnRpdGlzLiBUaGUgZGVmaW5pdGlvbiBzdGF0ZXMgdGhhdCBwZXJpb2RvbnRpdGlzIGlzIGEgc2VyaW91cyBndW0gaW5mZWN0aW9uIHRoYXQgZGFtYWdlcyB0aGUgc29mdCB0aXNzdWUgYW5kIGRlc3Ryb3lzIHRoZSBib25lIHRoYXQgc3VwcG9ydHMgeW91ciB0ZWV0aC4gUGVyaW9kb250aXRpcyBjYW4gY2F1c2UgdG9vdGggbG9zcyBpZiBsZWZ0IHVudHJlYXRlZC4="}.—”

I get appropriate and correct output when I use the AWS Agent Test from AWS console.

Guru
asked 13 days ago280 views
1 Answer
1
Accepted Answer

Hi,

Based on this document, it appears the endpoint uses InvokeAgentCommand API from the AWS SDK. As per the documentation, the response is returned in the bytes field of the chunk object. The response is in base64 format.

I would suggest you decode the output using a base64 decoder. Some examples are here

Hope this helps!

Thanks, Rama

profile pictureAWS
Rama
answered 13 days ago
profile picture
EXPERT
reviewed 13 days ago
profile picture
EXPERT
reviewed 13 days ago
  • Thank you for the answer. I was trying from postman. Possibly that could be the reason. I'll try to use the method suggested!!!

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