@defikitdotnet/education-module-ai
Version:
AI Education Module using Agent Framework
100 lines (99 loc) • 2.46 kB
TypeScript
/**
* Content generation request parameters
*/
export interface GenerateCourseRequest {
teacherId: string;
title?: string;
description: string;
level: string;
subject?: string;
topics?: string[];
numSections: number;
numLecturesPerSection: number;
includeQuizzes: boolean;
numQuestionsPerQuiz: number;
}
/**
* Generated lecture
*/
export interface GeneratedLecture {
title: string;
content: string;
type: "text" | "h5p" | "presentation";
orderIndex: number;
}
/**
* Generated quiz question
*/
export interface GeneratedQuizQuestion {
question: string;
options: string[];
answer: string;
explanation: string;
}
/**
* Generated section
*/
export interface GeneratedSection {
title: string;
description: string;
orderIndex: number;
lectures: GeneratedLecture[];
quiz?: {
title: string;
description: string;
questions: GeneratedQuizQuestion[];
};
}
/**
* Complete generated course
*/
export interface GeneratedCourse {
title: string;
description: string;
thumbnail?: string;
level: string;
subject?: string;
sections: GeneratedSection[];
}
/**
* Service for generating educational content using AI
*/
export declare class AiContentService {
private apiKey;
private apiUrlBase;
private modelName;
constructor();
/**
* Generate a complete course structure with lectures and quizzes
*/
generateCourse(request: GenerateCourseRequest): Promise<GeneratedCourse>;
/**
* Generate a sample course when API access is not available
*/
private generateSampleCourse;
/**
* Generate just a single section with lectures and quiz
*/
generateSection(courseId: string, title: string, description: string, orderIndex: number, numLectures: number, includeQuiz: boolean, numQuestions: number): Promise<GeneratedSection>;
/**
* Generate a sample section when API access is not available
*/
private generateSampleSection;
/**
* Create a prompt for course generation
*/
private createCourseGenerationPrompt;
/**
* Create a prompt for section generation
*/
private createSectionGenerationPrompt;
/**
* Parse the AI response into a structured course
*/
private parseCourseResponse;
/**
* Parse the AI response into a structured section
*/
private parseSectionResponse;
}