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.5.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.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: educhain-0.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 10227309f3b758013bc0460f422d2628d1ad48782b347cfe087e5c30e0bb2200
MD5 3c056a02331fa27c00330d4bcecbc4e7
BLAKE2b-256 63a847c12fec4e92399a50681f1070c7f280abd03dbcdf1adb65dd729c1662d6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: educhain-0.2.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ea53ab74e395bef93e5566d42aff700c8c6b3a93763ce440da629a4b4c70ec1d
MD5 c75bfefe87a0af92746736c00308bfbd
BLAKE2b-256 f2164671e13c7cdd78d1cd938bbd5c2f5eb4b2238d33c202b3fa1493d32ffaed

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