Skip to content

A Python package for generating educational content using Generative AI

License

Notifications You must be signed in to change notification settings

satvik314/educhain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

educhain

A Python package for generating educational content using Generative AI. Educhain makes it easy to apply Generative AI in various educational use cases to create engaging and personalized learning experiences

Installation

pip install educhain

Usage

Generate MCQs

Open In Colab

Here are some examples on how to use educhain:

Quickstart

from educhain import qna_engine

questions = qna_engine.generate_mcq(
    topic="Indian History",
    level="Beginner",
    num=5
)

questions

Using Custom Prompt Templates

You can create your own prompt templates and customize it with various input fields

from educhain import qna_engine

custom_template = """
Generate {num} multiple-choice question (MCQ) based on the given topic and level.
Provide the question, four answer options, and the correct answer.

Topic: {topic}
Learning Objective: {learning_objective}
Difficulty Level: {difficulty_level}
"""

result = qna_engine.generate_mcq(
    topic="Python Programming",
    num=2,
    learning_objective = "Usage of Python classes",
    difficulty_level = "Hard",
    prompt_template=custom_template,
)

result

Using Different LLMs

Switch from default OpenAI models to other models using ChatOpenAI.

Example shows using Llama 3 model through Groq

from educhain import qna_engine
from langchain_openai import ChatOpenAI

llama3_groq = ChatOpenAI(
    model = "llama3-70b-8192",
    openai_api_base = "https://api.groq.com/openai/v1",
    openai_api_key = "GROQ_API_KEY"
)

questions = qna_engine.generate_mcq(
    topic="Chess",
    level="Hard",
    num=5,
    llm = llama3_groq
)

questions

Export questions to JSON, PDF, CSV

from educhain import to_json, to_pdf, to_csv

to_json(questions, "questions.json") # export questions to JSON
to_pdf(questions, "questions.pdf") # export questions to PDF
to_csv(questions, "questions.csv") # export questions to CSV

Generate Lesson Plans

Quickstart

from educhain import content_engine

topic = "Medieval History"
level = "Beginner"

lesson_plan = content_engine.generate_lesson_plan(topic, level)
print(lesson_plan)

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

Next Steps

Will be releasing more features for MCQ Generation

  • Bulk Generation
  • Outputs in JSON format
  • Custom Prompt Templates
  • Custom Response Models using Pydantic
  • Exports questions to JSON/PDF/CSV
  • Support for other LLM models
  • Generate questions from text/pdf file
  • Finetuned Model for question generation

About

A Python package for generating educational content using Generative AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published