Skip to content

base

Abstract base class for generator subclasses that interact with AI service provider APIs to create course content.

Subclasses must implement the abstract methods on CourseGenerator and add service provider-specific API interaction logic to generate the outline, lectures, image, and audio for a course.

For example, the OpenAIAsyncGenerator is an example of a subclass that implements the CourseGenerator's abstract methods to interact with OpenAI's API to generate course content.

Classes:

Name Description
CourseGenerator

Abstract base class for generating a course outline, its lectures, a cover image, and audio for the course.

CourseGenerator

CourseGenerator(course: Course)

Abstract base class for generating a course outline, its lectures, a cover image, and audio for the course.

Parameters:

Name Type Description Default
course Course

The course to generate content for.

required

Attributes:

Name Type Description
log getLogger

The logger for the generator.

Subclasses must implement the abstract methods to generate the course outline, lectures, image, and audio.

Methods:

Name Description
generate_audio

Uses a text-to-speech (TTS) model to generate audio for the course from its lectures.

generate_image

Uses an image generation model to generate a cover image for the course based on its title.

generate_lectures

Uses a generative pre-trained transformer (GPT) to generate the lectures in the course outline.

generate_outline

Uses a generative pre-trained transformer (GPT) to generate an outline for the course based on its title.

Attributes:

Name Type Description
log getLogger

The logger for the generator.

log instance-attribute

log: getLogger = None

The logger for the generator.

generate_audio abstractmethod

generate_audio(course: Course) -> Course

Uses a text-to-speech (TTS) model to generate audio for the course from its lectures.

This method requires that the course has had its lectures generated with a call to generate_lectures before being passed to this method.

Returns:

Name Type Description
Course Course

The course with the audio_file_path attribute set in its generation_info attribute.

generate_image abstractmethod

generate_image(course: Course) -> Course

Uses an image generation model to generate a cover image for the course based on its title.

Parameters:

Name Type Description Default
course Course

The course to generate an image for.

required

Returns:

Name Type Description
Course Course

The course with the image_file_path attribute set in its generation_info attribute.

generate_lectures abstractmethod

generate_lectures(course: Course) -> Course

Uses a generative pre-trained transformer (GPT) to generate the lectures in the course outline.

This method requires that the course has had its outline generated with a call to generate_outline before being passed to this method.

Parameters:

Name Type Description Default
course Course

The course to generate lectures for. The given course must have had its outline generated and its outline attribute set.

required

Returns:

Name Type Description
Course Course

The course with its lectures attribute set.

generate_outline abstractmethod

generate_outline(course: Course) -> Course

Uses a generative pre-trained transformer (GPT) to generate an outline for the course based on its title.

Modify the Course.settings attribute before calling this method to customize the generation process and its output.

Parameters:

Name Type Description Default
course Course

The course to generate an outline for.

required

Returns:

Name Type Description
Course Course

The course with its outline attribute set.