class_factory package
class_factory.ClassFactory module
ClassFactory Module
The ClassFactory module provides a unified interface for managing AI-powered educational content generation modules.
Supported Modules
BeamerBot: Automates LaTeX Beamer slide generation based on lesson materials
ConceptWeb: Creates concept maps showing relationships between key lesson concepts
QuizMaker: Generates quizzes with interactive features and similarity analysis
Key Functionalities
Module Management: - Dynamic module creation via
create_module()
- Shared context and configurations across modules - Consistent error handling and validationResource Management: - Centralized path handling for lesson materials - Organized output structure in
ClassFactoryOutput
- Automated resource loading and validationAI Integration: - Flexible LLM support (GPT-4, LLaMA, etc.) - Consistent AI interaction patterns - Shared context across operations
Output Directory Structure
ClassFactoryOutput/
├── BeamerBot/
│ └── L{lesson_no}/
├── ConceptWeb/
│ └── L{lesson_no}/
└── QuizMaker/
└── L{lesson_no}/
Usage
from class_factory import ClassFactory
from langchain_openai import ChatOpenAI
from pathlib import Path
# Initialize factory
factory = ClassFactory(
lesson_no=10,
syllabus_path="path/to/syllabus.docx",
reading_dir="path/to/readings",
llm=ChatOpenAI(api_key="your_key")
)
# Create and use modules
slides = factory.create_module("BeamerBot").generate_slides()
concept_map = factory.create_module("ConceptWeb").build_concept_map()
quiz = factory.create_module("QuizMaker").make_a_quiz()
Dependencies
pathlib
: Path handlinglangchain
: LLM integrationpyprojroot
: Project directory managementCustom modules:
BeamerBot
,ConceptWeb
,QuizMaker
Notes
BeamerBot operates on single lessons only
ConceptWeb and QuizMaker support lesson ranges
All modules inherit factory-level configurations
Output directories are automatically created and managed
- class class_factory.ClassFactory.ClassFactory(lesson_no: int, syllabus_path: str | Path, reading_dir: str | Path, llm, project_dir: str | Path | None = None, output_dir: str | Path | None = None, slide_dir: str | Path | None = None, lesson_range: range | None = None, course_name: str = 'Political Science', verbose: bool = True, **kwargs)[source]
Bases:
object
A factory class responsible for creating and managing instances of various educational modules.
ClassFactory provides a standardized interface for initializing educational modules designed for generating lesson-specific materials, such as slides, concept maps, and quizzes. Modules are dynamically created based on the specified module name, with configurations for content generation provided by the user.
Modules available for creation include: - BeamerBot: Automated LaTeX Beamer slide generation. - ConceptWeb: Concept map generation based on lesson objectives and readings. - QuizMaker: Quiz creation, hosting, and analysis.
- lesson_no
The lesson number for which the module instance is created.
- Type:
int
- syllabus_path
Path to the syllabus file.
- Type:
Path
- reading_dir
Path to the directory containing lesson readings.
- Type:
Path
- slide_dir
Path to the directory containing lesson slides.
- Type:
Path
- llm
Language model instance used for content generation in modules.
- project_dir
Base project directory.
- Type:
Path
- output_dir
Directory where outputs from modules are saved.
- Type:
Path
- lesson_range
Range of lessons covered by the factory instance.
- Type:
range
- course_name
Name of the course for which content is generated.
- Type:
str
- lesson_loader
Instance of LessonLoader for loading lesson-related data and objectives.
- Type:
LessonLoader
By default, all module outputs are saved in a structured directory under “ClassFactoryOutput” within the project directory.
- create_module(module_name: str, **kwargs)[source]
Create a specific module instance based on the provided module name.
- Parameters:
module_name (str) – Name of the module to create. Case-insensitive options: - ‘BeamerBot’/’beamerbot’: For LaTeX slide generation - ‘ConceptWeb’/’conceptweb’: For concept map creation - ‘QuizMaker’/’quizmaker’: For quiz generation and management
**kwargs – Module-specific configuration options: - output_dir (Path): Custom output directory (defaults to self.output_dir) - verbose (bool): Enable detailed logging (defaults to False) - course_name (str): Override default course name - lesson_range (range): Override default lesson range - slide_dir (Path): Custom slide directory (BeamerBot only)
- Returns:
The created module instance based on the provided name.
- Return type:
Union[BeamerBot, ConceptMapBuilder, QuizMaker]
- Raises:
ValueError – If an invalid module name is provided.
Notes
Each module’s output is automatically organized in a dedicated subdirectory:
ClassFactoryOutput/{ModuleName}/L{lesson_no}/ - BeamerBot operates on single lessons, while ConceptWeb and QuizMaker can handle lesson ranges
Submodules
- class_factory.beamer_bot package
- class_factory.concept_web package
- class_factory.concept_web.ConceptWeb module
- ConceptWeb Module
ConceptMapBuilder
ConceptMapBuilder.lesson_no
ConceptMapBuilder.lesson_loader
ConceptMapBuilder.llm
ConceptMapBuilder.course_name
ConceptMapBuilder.output_dir
ConceptMapBuilder.lesson_range
ConceptMapBuilder.save_relationships
ConceptMapBuilder.relationship_list
ConceptMapBuilder.concept_list
ConceptMapBuilder.prompts
ConceptMapBuilder.verbose
ConceptMapBuilder.G
ConceptMapBuilder.user_objectives
ConceptMapBuilder.build_concept_map()
ConceptMapBuilder.load_and_process_lessons()
- class_factory.concept_web.ConceptWeb module
- class_factory.quiz_maker package
- class_factory.quiz_maker.QuizMaker module
- QuizMaker Module
QuizMaker
QuizMaker.llm
QuizMaker.syllabus_path
QuizMaker.reading_dir
QuizMaker.output_dir
QuizMaker.prior_quiz_path
QuizMaker.lesson_range
QuizMaker.course_name
QuizMaker.device
QuizMaker.rejected_questions
QuizMaker.assess_quiz_results()
QuizMaker.launch_interactive_quiz()
QuizMaker.make_a_quiz()
QuizMaker.save_quiz()
QuizMaker.save_quiz_to_ppt()
- class_factory.quiz_maker.QuizMaker module
- class_factory.utils package