class_factory package¶
Subpackages¶
- class_factory.beamer_bot package
- class_factory.concept_web package
- class_factory.quiz_maker package
- Submodules
- class_factory.quiz_maker.QuizMaker module
- QuizMaker Module
QuizMakerQuizMaker.llmQuizMaker.syllabus_pathQuizMaker.reading_dirQuizMaker.output_dirQuizMaker.prior_quiz_pathQuizMaker.lesson_rangeQuizMaker.course_nameQuizMaker.deviceQuizMaker.rejected_questionsQuizMaker.make_a_quiz()QuizMaker.save_quiz()QuizMaker.save_quiz_to_ppt()QuizMaker.launch_interactive_quiz()QuizMaker.assess_quiz_results()
- class_factory.quiz_maker.quiz_prompts module
- class_factory.quiz_maker.quiz_to_app module
- class_factory.quiz_maker.quiz_viz module
- Module contents
- class_factory.utils package
- Submodules
- class_factory.utils.base_model module
- class_factory.utils.llm_validator module
- class_factory.utils.load_documents module
- Document Loading and Processing Module
LessonLoaderLessonLoader.reading_dirLessonLoader.slide_dirLessonLoader.project_dirLessonLoader.syllabus_pathLessonLoader.loggerLessonLoader.slide_dirLessonLoader.ocr_available()LessonLoader.missing_ocr_packages()LessonLoader.load_readings()LessonLoader.load_directory()LessonLoader.load_lessons()LessonLoader.load_beamer_presentation()LessonLoader.find_prior_beamer_presentation()LessonLoader.extract_text_from_pdf()LessonLoader.ocr_pdf()LessonLoader.load_docx_syllabus()LessonLoader.extract_lesson_objectives()LessonLoader.find_docx_indices()
- class_factory.utils.response_parsers module
- class_factory.utils.slide_pipeline_utils module
- class_factory.utils.tools module
- class_factory.utils.validator_prompts module
- Module contents
Submodules¶
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, reading_dir: str | Path, llm, syllabus_path: str | Path = None, 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, tabular_syllabus: bool = False, **kwargs)[source]¶
Bases:
objectA 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:
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