Skip to main content

A Python package for generating educational content using Generative AI

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

educhain-0.2.4.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

educhain-0.2.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file educhain-0.2.4.tar.gz.

File metadata

  • Download URL: educhain-0.2.4.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.0.1 rfc3986/1.5.0 colorama/0.4.6 CPython/3.10.14

File hashes

Hashes for educhain-0.2.4.tar.gz
Algorithm Hash digest
SHA256 76e727dd05de8b3cb81742ac94d7f20e127a96cc2e7e6ae559d6dbec575b0c34
MD5 c67fa6d33d111c78042eb8d9df4eb065
BLAKE2b-256 e097fa2ffb8a6548833f3b1a3f0076f71b9d558a42fca45e146b5d0fbda46145

See more details on using hashes here.

File details

Details for the file educhain-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: educhain-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/1.26.18 tqdm/4.66.1 importlib-metadata/6.8.0 keyring/24.0.1 rfc3986/1.5.0 colorama/0.4.6 CPython/3.10.14

File hashes

Hashes for educhain-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d79a0bc7a6abb7290b092d01f7d6a34a1fab70cf27b501264b9375a9fdf6fbe4
MD5 884ded4623515e91356cdf2b1284fbfd
BLAKE2b-256 6fc04b0710a7ff71175d7e719327c983c7446811eeaf50289d0045a51ef499bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page