Skip to content

Commit

Permalink
Merge pull request #61 from awslabs/new-chat-webapp
Browse files Browse the repository at this point in the history
New chat webapp and ecommerce demo
  • Loading branch information
brnaba-aws authored Oct 10, 2024
2 parents e5bcf2f + ca90334 commit 25f0ef6
Show file tree
Hide file tree
Showing 77 changed files with 42,784 additions and 375 deletions.
125 changes: 125 additions & 0 deletions examples/chat-demo-app/lambda/auth/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 24 additions & 2 deletions examples/chat-demo-app/lambda/multi-agent/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from "@aws-lambda-powertools/logger";
import {
import {
MultiAgentOrchestrator,
BedrockLLMAgent,
DynamoDbChatStorage,
Expand Down Expand Up @@ -169,6 +169,28 @@ if (BEDROCK_AGENT_ENABLED === "true") {
);
}

const greetingAgent = new BedrockLLMAgent({
name: "Greeting Agent",
description: "Welcome the user and list him the available agents",
streaming: false,
inferenceConfig: {
temperature: 0.0,
},
saveChat: false,
});

let agentList = "";
const agents = orchestrator.getAllAgents();
Object.entries(agents).forEach(([agentKey, agentInfo], index) => {
agentList += `${index + 1}-${agentInfo.name}: ${agentInfo.description}\n\n`;
});
const greetingAgentPrompt = `You are a greeting agent that responds to hello or help. Be nice with the user.
List to the user all the agents available to support him from this below list:\n\n${agentList}`;

greetingAgent.setSystemPrompt(greetingAgentPrompt);
orchestrator.addAgent(greetingAgent);


async function eventHandler(
event: APIGatewayProxyEventV2,
responseStream: NodeJS.WritableStream
Expand Down Expand Up @@ -204,7 +226,7 @@ async function eventHandler(
// Send metadata immediately
logger.info(` > Agent ID: ${response.metadata.agentId}`);
logger.info(` > Agent Name: ${response.metadata.agentName}`);

logger.info(`> User Input: ${response.metadata.userInput}`);
logger.info(`> User ID: ${response.metadata.userId}`);
logger.info(`> Session ID: ${response.metadata.sessionId}`);
Expand Down
2 changes: 1 addition & 1 deletion examples/chat-demo-app/lib/user-interface-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class UserInterfaceStack extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);

const appPath = path.join(__dirname, "../user-interface");
const appPath = path.join(__dirname, "../ui");
const buildPath = path.join(appPath, "dist");

const websiteBucket = new s3.Bucket(this, "WebsiteBucket", {
Expand Down
Loading

0 comments on commit 25f0ef6

Please sign in to comment.