Skip to content

Commit

Permalink
fix streaming for tooluse in ts
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelcroi committed Sep 25, 2024
1 parent cd7764f commit e00478f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions typescript/src/agents/bedrockLLMAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ export class BedrockLLMAgent extends Agent {

while (continueWithTools && maxRecursions > 0){
// send the conversation to Amazon Bedrock
const bedrockResponse = await this.handleSingleResponse(converseCmd);
let bedrockResponse;
if (this.streaming) {
bedrockResponse = this.handleStreamingResponse(converseCmd);
} else {
bedrockResponse = await this.handleSingleResponse(converseCmd);
}

// Append the model's response to the ongoing conversation
conversation.push(bedrockResponse);
Expand All @@ -218,7 +223,7 @@ export class BedrockLLMAgent extends Agent {
if (this.streaming) {
return this.handleStreamingResponse(converseCmd);
} else {
return this.handleSingleResponse(converseCmd);
return await this.handleSingleResponse(converseCmd);
}
}
}
Expand Down

0 comments on commit e00478f

Please sign in to comment.