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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file educhain-0.2.3.tar.gz.
File metadata
- Download URL: educhain-0.2.3.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9848f45ce4f2039fd1c423833a9278b43ae4b3df7785e12b267ba3d5840341ea
|
|
| MD5 |
aadbdf87ab3c29f8d1885d64c252d464
|
|
| BLAKE2b-256 |
a66e994dc8e6ab97d07e35483d8610ab98e1212fe57436be72e74329a4e24f66
|
File details
Details for the file educhain-0.2.3-py3-none-any.whl.
File metadata
- Download URL: educhain-0.2.3-py3-none-any.whl
- Upload date:
- Size: 7.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b64d02080ecccedad0021c2a7cf2679dc5558d580ca42371adc3f8ed958899dd
|
|
| MD5 |
49155af714206e6d0c5732e5a6aa90f2
|
|
| BLAKE2b-256 |
edd759d10291618f70dd920f7a616be5772181639673f17659374237c3e21701
|