Skip to content

Commit

Permalink
fixing import chat-demo-app
Browse files Browse the repository at this point in the history
  • Loading branch information
brnaba-aws committed Jul 23, 2024
1 parent 426c510 commit 15863df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions examples/chat-demo-app/lambda/multi-agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import {
DynamoDbChatStorage,
LexBotAgent,
AmazonBedrockAgent,
LambdaAgent
} from "@aws/multi-agent-orchestrator";
LambdaAgent,
BedrockClassifier,
} from "multi-agent-orchestrator";
import { weatherToolDescription, WEATHER_PROMPT, weatherToolHanlder } from './weather_tool'
import { mathToolHanlder, mathAgentToolDefinition, MATH_AGENT_PROMPT } from './math_tool';
import { APIGatewayProxyEventV2, Handler, Context } from "aws-lambda";
Expand Down Expand Up @@ -69,6 +70,12 @@ const orchestrator = new MultiAgentOrchestrator({
logger: logger,
});

orchestrator.setClassifier(new BedrockClassifier(
{
modelId: "anthropic.claude-3-5-sonnet-20240620-v1:0",
}
));

orchestrator.addAgent(
new BedrockLLMAgent({
name: "Tech Agent",
Expand Down Expand Up @@ -197,10 +204,7 @@ async function eventHandler(
// Send metadata immediately
logger.info(` > Agent ID: ${response.metadata.agentId}`);
logger.info(` > Agent Name: ${response.metadata.agentName}`);
logger.info(`> Language: ${response.metadata.language}`);
logger.info(
`> Language Confidence: ${response.metadata.languageConfidence}`
);

logger.info(`> User Input: ${response.metadata.userInput}`);
logger.info(`> User ID: ${response.metadata.userId}`);
logger.info(`> Session ID: ${response.metadata.sessionId}`);
Expand Down Expand Up @@ -231,10 +235,6 @@ async function eventHandler(
logger.info("\n** RESPONSE ** \n");
logger.info(` > Agent ID: ${response.metadata.agentId}`);
logger.info(` > Agent Name: ${response.metadata.agentName}`);
logger.info(`> Language: ${response.metadata.language}`);
logger.info(
`> Language Confidence: ${response.metadata.languageConfidence}`
);
logger.info(`> User Input: ${response.metadata.userInput}`);
logger.info(`> User ID: ${response.metadata.userId}`);
logger.info(`> Session ID: ${response.metadata.sessionId}`);
Expand Down
4 changes: 2 additions & 2 deletions examples/chat-demo-app/lambda/multi-agent/math_tool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ConversationMessage, ParticipantRole } from "@aws/multi-agent-orchestrator";
import { Logger } from "@aws/multi-agent-orchestrator";
import { ConversationMessage, ParticipantRole } from "multi-agent-orchestrator";
import { Logger } from "multi-agent-orchestrator";

export const MATH_AGENT_PROMPT = `
You are a mathematical assistant capable of performing various mathematical operations and statistical calculations.
Expand Down
4 changes: 2 additions & 2 deletions examples/chat-demo-app/lambda/multi-agent/weather_tool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConversationMessage, ParticipantRole } from "@aws/multi-agent-orchestrator";
import { ConversationMessage, ParticipantRole } from "multi-agent-orchestrator";

export const weatherToolDescription = [
{
Expand Down Expand Up @@ -63,7 +63,7 @@ export async function weatherToolHanlder(response:ConversationMessage, conversat
if (!responseContentBlocks) {
throw new Error("No content blocks in response");
}
for (const contentBlock of response.content) {
for (const contentBlock of responseContentBlocks) {
if ("text" in contentBlock) {
}
if ("toolUse" in contentBlock) {
Expand Down

0 comments on commit 15863df

Please sign in to comment.