The NetApp Workload Factory GenAI sample application enables external application developers to test authentication and retrieval from a published NetApp Workload Factory knowledge base by interacting directly with it in a web-based chatbot application. Its features are similar to the chatbot interface within the NetApp Workload Factory UI, and it uses the same Workload Factory API for conversations. As a developer, you can use this sample application to test published knowledge bases and see API examples that can help you develop your own chatbot application.
The NetApp Workload Factory GenAI sample application is a Next.js project bootstrapped with create-next-app
.
The sample application uses Redux Toolkit with RTK Query for data fetching.
- Node.js 18.17 or later stable version.
- The NetApp Workload Factory GenAI sample application relies on one of the following login providers:
- You need a knowledge base created with NetApp Workload Factory GenAI that is configured for active authentication and published:
- You need the ID of the published knowledge base. You can find the knowledge base ID on the Knowledge bases > Manage knowledge base page in Workload Factory GenAI, or you can work with the person that created the knowledge base.
To get started, you need to configure one of the supported login providers. Configure the same login provider (issuer) that is used by the knowledge base that will integrate with the sample chatbot application.
- Follow the Create user pool instructions to create a Cognito user pool.
- Use the Amazon Cognito documentation to find your user pool ID and user web client ID:
- Find your user pool ID.
For example:aws cognito-idp list-user-pools --max-results=60 --output=table
- Find your web client ID.
For example:aws cognito-idp list-user-pool-clients --user-pool-id $(USER_POOL_ID) --output=table
- Find your user pool ID.
- Download and unpack the Workload Factory GenAI sample application source package.
- In the Workload Factory GenAI sample application source, rename the
.env.local.sample
file to.env.local
. - In the
.env.local
file, uncomment the corresponding section for the login provider you plan to use, and make sure the section for the other provider is commented out. - In the
.env.local
file, change the following variables in the appropriate provider section to match your environment. ReplaceYOUR_KNOWLEDGE_BASE_ID
with the knowledge base ID from Workload Factory:- NEXT_PUBLIC_LOGIN_PROVIDER=cognito
- NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
- NEXT_PUBLIC_AWS_USER_POOLS_ID=YOUR_AWS_USER_POOLS_ID
- NEXT_PUBLIC_AWS_USER_WEB_CLIENT_ID=YOUR_AWS_USER_WEB_CLIENT_ID
- To integrate Active Directory with Amazon Cognito, follow the A guide to AD FS federation with Amazon Cognito user pools instructions (Steps 1 to 4).
- To configure SAML request signing, follow the instructions in Signing SAML requests.
- Specify the federated identity provider and authorization by adding the following variables to the
.env.local
file, with values that match your environment.- NEXT_PUBLIC_LOGIN_EXTERNAL_PROVIDER=YOUR_COGNITO_IDENTITY_PROVIDER_NAME
- NEXT_PUBLIC_AWS_OAUTH={"domain":"<DOMAIN_PREFIX>.auth..amazoncognito.com","scope":["openid", "profile", "email"],"redirectSignIn":"http://localhost:9091","redirectSignOut":"http://localhost:9091","responseType":"code"}
- Domain - The domain for your Cognito user pool.
- Scope - Scopes specifying the access privileges.
- redirectSignIn - The URL to redirect to after a successful sign-in.
- redirectSignOut - The URL to redirect to after a successful sign-out.
- responseType - The type of response to receive from the authorization server.
- Follow the Sign up instructions to sign up for a Clerk account.
- Download and unpack the Workload Factory GenAI sample application source package.
- In the Workload Factory GenAI sample application source, rename the
.env.local.sample
file to.env.local
. - In the
.env.local
file, uncomment the corresponding section for the login provider you plan to use, and make sure the section for the other provider is commented out. - In the
.env.local
file, change the following variables in the appropriate provider section to match your environment. ReplaceYOUR_KNOWLEDGE_BASE_ID
with the knowledge base ID from Workload Factory:- NEXT_PUBLIC_LOGIN_PROVIDER=clerk
- NEXT_PUBLIC_KNOWLEDGE_BASE_ID=YOUR_KNOWLEDGE_BASE_ID
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=YOUR_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
- CLERK_SECRET_KEY=YOUR_CLERK_SECRET_KEY
- NEXT_PUBLIC_CLERK_TEMPLATE=YOUR_CLERK_TEMPLATE
To install the sample application, run the following command:
npm install
-
To run the application locally, run the following command:
npm run dev
-
Open http://localhost:9091 with your browser to log in to the application.
To build bundle.js, run the following command:
npm run build
- Learn more about BlueXP Workload Factory for AWS.
- Learn more about the APIs used in this sample application by visiting the Workload Factory API documentation.
- To learn more about Next.js, take a look at the following resources:
- Next.js documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.