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

Uploaded Python 3

File details

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

File metadata

  • Download URL: educhain-0.2.7.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.32.3 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.4 importlib-metadata/7.1.0 keyring/24.0.1 rfc3986/1.5.0 colorama/0.4.6 CPython/3.10.14

File hashes

Hashes for educhain-0.2.7.tar.gz
Algorithm Hash digest
SHA256 1d14e3bcadf3fdd5ee8a0210d0780aaa63905421849d23fa1d4df5c0f5f96340
MD5 97e6a7e79458f62bb008c4bda691d838
BLAKE2b-256 47beaf22823462456e2aeab0cfc3f499afd7eaf5f12bd82bbf3ae94b904e99c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: educhain-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.32.3 requests-toolbelt/1.0.0 urllib3/2.2.1 tqdm/4.66.4 importlib-metadata/7.1.0 keyring/24.0.1 rfc3986/1.5.0 colorama/0.4.6 CPython/3.10.14

File hashes

Hashes for educhain-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bc8c8e8a29c9871d10bbdbccd19cfdd258c88c64ef5fd2746034ea2cde614558
MD5 50df53a9619546e0ac53b9f644c1c3e0
BLAKE2b-256 b3ce7c1e8ca0eb376d64aa377ae208fba2885f334d8bba989840194619e6926a

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