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
gefragt vor einem Monat300 Aufrufe
1 Antwort
1
Akzeptierte Antwort

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
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
  • Thank you for the answer. I was trying from postman. Possibly that could be the reason. I'll try to use the method suggested!!!

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen