radicalxdev / marvel-ai-backend

This is the Marvel Teaching Assistant ai repo.
MIT License
16 stars 79 forks source link

Worksheet Generator Feature PR #102

Open vash02 opened 2 weeks ago

vash02 commented 2 weeks ago

Worksheet Question Generator

This project enables the generation of quiz and worksheet questions using a machine learning model, integrated with LangChain. Users can provide topics, difficulty levels, and hints to generate customized questions, with robust validation processes to ensure accuracy and relevance.

Key Features

Dual-Prompt Setup

Based on experimentation, using two distinct prompts—one for quiz questions and another for worksheet questions—yields optimal results. This dual-prompt approach enhances the quality and relevance of the generated content.

Question Generation

The WorksheetBuilder class supports the generation of both quiz and worksheet questions based on:

Validation Mechanism

Logging & Error Handling

Detailed logs at key stages ensure smooth execution and help debug any issues.

How to Use

  1. Instantiate the WorksheetBuilder class with the required parameters.
  2. Use create_questions() for quiz questions or create_worksheet_questions() for worksheet questions.
  3. The validated questions are returned as dictionaries containing the question, answer, and explanation.

Example


executor([ToolFile(url="https://example.com/resource.pdf")],
         "machine learning", "Masters", "single sentence answer questions", 5, 5)