DEV Community

Ayyanar Jeyakrishnan
Ayyanar Jeyakrishnan

Posted on

TriviaGen_AI

As an active member of the AWS User Group Bangalore and Cloudnloud Tech Community, we regularly publish monthly projects focused on Machine Learning and Artificial Intelligence. These projects come with detailed architectures, allowing interested community members to participate, contribute, and receive credit for their involvement. It serves as a collaborative platform where individuals can join forces, learn, and showcase their skills in the exciting fields of ML/AI within our community.

Introduction

We are building a Quiz Platform to interact with target audience to test their knowledge, Involve them in Poll. We help the Clients to create Poll and Trivia using Generative AI - using a Large Language Model.

Technical quizzes and marketing polls are both important tools for different reasons. Technical quizzes serve as a way to test and assess knowledge on a specific subject or topic, which is essential for personal growth, skill development, and career advancement. On the other hand, marketing polls are used to collect information from potential customers to gain insights into their preferences, behaviors, and opinions, which is crucial for businesses to develop and market products effectively. By combining the insights from technical quizzes and marketing polls, businesses can gain a better understanding of their target audience and develop products that meet their needs and preferences. Overall, both technical quizzes and marketing polls are important tools for personal and professional development, as well as for businesses to succeed in the market.

The application supports the following use-cases for web users:

  • Register & login
  • Create a Custom Quiz, Poll Manually and Publish to target users.
  • Generate a Quiz or Poll Automatically using Generative AI and Human in Loop.
  • Custom Fine-Tune Generative AI based on your data - Text and Image.
  • Analytics over user Engagements.

Architecture Overview

Image description

Frontend-UI

The frontend of a quiz application is the user interface that users interact with to access and use the application. It is the visible part of the application that users see and interact with, and it is responsible for providing a seamless and intuitive user experience.

In our application using Amplify, the frontend built using React JS,. Amplify provides a set of pre-built UI components that can be easily integrated into the frontend to handle tasks such as user authentication, API calls, and data management. Using Amplify, we leverage pre-built UI components and frameworks to rapidly build and deploy a frontend that meets the needs of users.

  1. User authentication: Users must be authenticated before they can access the quiz application. Amplify provides pre-built UI components for user authentication, including sign-in and sign-up using external IdP (Google, Linkedin, Github and Twitter) , and handles the secure storage and management of user credentials.

  2. Quiz Creation Interface: This has three options.
    a) Manual Trivia
    b) GenAI-Trivia
    c) Fine-GenAI-Trivia

  3. Quiz interface: The quiz interface provides a clear and intuitive way for consumers to answer questions and navigate through the quiz. This may include features such as question numbering, progress tracking and a timer.

  4. Results screen: Once the quiz is completed, the frontend should display the user's score and provide feedback on the questions answered incorrectly. This may include a breakdown of the user's performance and suggestions for improvement.

Data Processing and Serving.

Manual Trivia: Clients can create their quiz using the Dynamic Page. Here we use GraphQL API, AppSync, DynamoDB, and Lambda. The platform would have a GraphQL API for CRUD operations on quizzes, questions, and answers, with DynamoDB as a backend database. AppSync would be used for backend development and scaling, and Lambda functions would execute server-side logic. Additionally, the platform would allow real-time data synchronization using WebSockets, and support authentication and authorization for users.

GenAI-Trivia: Client Provide Input as String “AWS Lambda”. Here we create a quiz using Generative AI We add Amplify to use API Gateway service to create a new API and define the necessary routes for creating, reading, updating, and deleting quizzes, questions, and answers. Integrate with Sagemaker Model Endpoint with API Gateway to allow for natural language processing and generation of quiz questions. AWS Lambda to create serverless functions that will execute business logic such as authentication, authorization, and quiz scoring and update DynamoDB table to store quiz data and integrate it with the Lambda functions for data retrieval and storage. You can use AWS Foundation Model like AI21Labs Jurrasic Jumbo for this usecase or use AWS Bedrock API (still in beta).

AI-In-Loop : Here based on GenAI data, Clients will provide a Dynamic Page to approve/Reject the Generated Quiz and once Approved. It will be send to target Consumers.

Fine-GenAI-Trivia: Client Provide PDF file or Text, Eg new book and like to create a quiz based on new Data.

Here you can upload the PDF or text file, It will store in S3 and lambda will be invoked based on the S3 Put Event and launch the AWS Textract Job which extracts the Data from the PDF file and stores it again in S3. Create a Eventbridge and trigger a sagemaker pipeline and use embed model to convert the text in vector and store it in the Serverless Opensearch domain (Here Elasticsearch act as Vector Database) with the unique index it.
Now clients can use their “Prompt” to generate the quiz for their custom content uploaded as PDF. Here Prompt + Context retrieved from Elasticsearch provided to Sagemaker Endpoint as input for generate text.

AI-In-Loop : Here based on GenAI data, Clients will provide a Dynamic Page to approve/Reject the Generated Quiz and once Approved. It will be send to target Consumers.

Benefits of this solution

  • Scalability of quiz/Trivia Platform using AWS Amplify and Generative AI
  • Clients can easily publish the Trivia to target users to test their knowledge.
  • We can use the same logic and pivot the Usecase to Marketing, Campaign, User Analytics.
  • Support for multiple devices using adaptive bitrate streaming for playback in all networks.
  • Quickly building and deploying the solution using Amplify and CloudFormation.
  • Colleges, Universities, Companies can Publish the MCQ to different questions to consumers/Students.

GitHub Link
https://github.com/aws-data-usergroup-bangalore/triviagen-ai

awscommunitybuilders #awscommunitybuilder

Top comments (0)