Skip to content

gwenf/course_content_generator

Repository files navigation

Course Lesson Generator

NOTE: this is a modified version of something I used to generate content for a project I was doing a few months ago. I had to remove a lot of things like the exact prompts I used and the naming conventions so it needs a lot more updating to work for more general use cases.

This repository contains scripts and templates for generating course lessons and exporting them into Word documents for a course named {{ course_name }} which is a {{ course_level }} course in the {{ course_track }}. The scripts utilize generative AI prompts combined with lesson material to create structured outputs for modules.


Folder Structure

course_lessons/

This is the main directory for lesson-related files.

  • input/: Contains all the lesson material for each module.

    • Each module folder (e.g., module1, module2, etc.) includes markdown files for assignments, discussions, quizzes, voting exercises, and portfolio-related lessons.
  • output/: Stores generated content for lessons. Each module folder contains the generated markdown or JSON outputs.

    • The word_docs/ subfolder contains Word document exports for each module.

prompts/

This folder contains specific prompt templates for each lesson type:

  • assignment/: Prompts for generating assignments.
  • discussion/: Prompts for discussions.
  • project/: Prompts for project-based lessons.
  • quiz/: Prompts for quizzes.
course_generator/
│
├── course_lessons/
│   ├── input/               # Input lesson material
│   │   ├── module1/       # module-specific markdown files
│   │   └── module2/
│   ├── output/              # Generated outputs
│   │   ├── module1/       # Markdown or JSON files
│   │   ├── module2/
│   │   └── word_docs/       # Word documents for modules
│   └── prompts/             # Prompts for generating specific lesson types
│
├── app.py                   # Main lesson generation script
├── export_to_word.py        # Exports generated lessons into Word documents
├── parse_json.py            # Utilities for parsing JSON
├── pyproject.toml           # Poetry configuration
├── poetry.lock              # Poetry dependency lock file
└── README.md                # Project documentation

Root Scripts

  • app.py: Main script for generating lessons. Combines input lesson material with prompts to create outputs in the output/ folder.
  • export_to_word.py: Converts lesson outputs into formatted Word documents for each module.
  • parse_json.py: Utility for parsing JSON into markdown or other formats.
  • .env: Stores environment variables like API keys.
  • poetry.lock, pyproject.toml: Poetry configuration files for dependency management.

Dependencies

The scripts require Python 3.12+ and the dependencies listed in pyproject.toml. Use Poetry for dependency management.


Setup

  1. Clone the Repository:

    git clone <repository-url>
    cd course_generator
  2. Set Up a Virtual Environment: Using Poetry:

    poetry install
    poetry shell

    Using pip (optional, if Poetry isn't available):

    python -m venv venv
    source venv/bin/activate   # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt  # This file is not included but can be manually generated from pyproject.toml
  3. Set Environment Variables: Create a .env file with the necessary variables, such as the OpenAI API key.

    Example .env file:

    OPENAI_API_KEY=your_openai_api_key
    

Usage

1. Generate Lessons

Run app.py to generate lessons for all modules based on the prompts and lesson materials in course_lessons/input/.

python app.py

This will process all markdown files in input/ and output the generated lessons to course_lessons/output/.

2. Export Lessons to Word Documents

Run export_to_word.py to create Word documents for each module.

python export_to_word.py

This will create .docx files for each module in course_lessons/output/word_docs/.


Notes

  • Make sure your API key is correctly set up in the .env file before running the scripts.
  • Review the course_lessons/output/ directory for generated files.
  • Use word_docs/ for finalized Word documents ready for distribution.

About

Work in progress...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages