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

New chat webapp and ecommerce demo #61

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
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
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