Skip to content

Commit ed2d015

Browse files
fixes: 2229 - complete prompt doesn't work and appears like a no-op
1 parent 68b1eba commit ed2d015

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/api/providers/bedrock.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff 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",

0 commit comments

Comments
 (0)