Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix streaming for tooluse in ts #53

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading