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
posta un mese fa295 visualizzazioni
1 Risposta
1
Risposta accettata

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
con risposta un mese fa
profile picture
ESPERTO
verificato un mese fa
profile picture
ESPERTO
verificato un mese fa
  • Thank you for the answer. I was trying from postman. Possibly that could be the reason. I'll try to use the method suggested!!!

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande