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
질문됨 한 달 전295회 조회
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
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
profile picture
전문가
검토됨 한 달 전
  • Thank you for the answer. I was trying from postman. Possibly that could be the reason. I'll try to use the method suggested!!!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠