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
質問済み 1ヶ月前300ビュー
1回答
1
承認された回答

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
回答済み 1ヶ月前
profile picture
エキスパート
レビュー済み 1ヶ月前
profile picture
エキスパート
レビュー済み 1ヶ月前
  • Thank you for the answer. I was trying from postman. Possibly that could be the reason. I'll try to use the method suggested!!!

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ