File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -426,13 +426,18 @@ export class AwsBedrockHandler extends BaseProvider implements SingleCompletionH
426426 const command = new ConverseCommand ( payload )
427427 const response = await this . client . send ( command )
428428
429- if ( response . output && response . output instanceof Uint8Array ) {
429+ if (
430+ response ?. output ?. message ?. content &&
431+ response . output . message . content . length > 0 &&
432+ response . output . message . content [ 0 ] . text &&
433+ response . output . message . content [ 0 ] . text . trim ( ) . length > 0
434+ ) {
430435 try {
431- const outputStr = new TextDecoder ( ) . decode ( response . output )
432- const output = JSON . parse ( outputStr )
433- if ( output . content ) {
434- return output . content
435- }
436+ // const outputStr = new TextDecoder().decode(response.output.message.content[0].text )
437+ // const output = JSON.parse(outputStr)
438+ // if (response. output.message. content[0].text ) {
439+ return response . output . message . content [ 0 ] . text
440+ // }
436441 } catch ( parseError ) {
437442 logger . error ( "Failed to parse Bedrock response" , {
438443 ctx : "bedrock" ,
You can’t perform that action at this time.
0 commit comments