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 Logo

PyPI version License: MIT Python Versions Downloads

Educhain ๐ŸŽ“๐Ÿ”—

Educhain Website Documentation

Welcome to Educhain! Transform your educational content effortlessly with cutting-edge AI tools. Explore our Website and dive into the Documentation to get started.

Educhain is a powerful Python package that leverages Generative AI to create engaging and personalized educational content. From generating multiple-choice questions to crafting comprehensive lesson plans, Educhain makes it easy to apply AI in various educational scenarios.

Educhain Logo

๐Ÿš€ Features

๐Ÿ“ Generate Multiple Choice Questions (MCQs)
from educhain import Educhain

client = Educhain()

# Basic MCQ generation
mcq = client.qna_engine.generate_questions(
    topic="Solar System",
    num=3,
    question_type="Multiple Choice"
)

# Advanced MCQ with custom parameters
advanced_mcq = client.qna_engine.generate_questions(
    topic="Solar System",
    num=3,
    question_type="Multiple Choice",
    difficulty_level="Hard",
    custom_instructions="Include recent discoveries"
)

print(mcq.json())  # View in JSON format
๐Ÿ“Š Create Lesson Plans
from educhain import Educhain

client = Educhain()

# Basic lesson plan
lesson = client.content_engine.generate_lesson_plan(
    topic="Photosynthesis"
)

# Advanced lesson plan with specific parameters
detailed_lesson = client.content_engine.generate_lesson_plan(
    topic="Photosynthesis",
    duration="60 minutes",
    grade_level="High School",
    learning_objectives=["Understanding the process", "Identifying key components"]
)

print(lesson.json())
๐Ÿ”„ Support for Various LLM Models
from educhain import Educhain, LLMConfig
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_openai import ChatOpenAI

# Using Gemini
gemini_model = ChatGoogleGenerativeAI(
    model="gemini-1.5-pro",
    google_api_key="YOUR_GOOGLE_API_KEY"
)
gemini_config = LLMConfig(custom_model=gemini_model)
gemini_client = Educhain(gemini_config)

# Using GPT-4
gpt4_model = ChatOpenAI(
    model_name="gpt-4",
    openai_api_key="YOUR_OPENAI_API_KEY"
)
gpt4_config = LLMConfig(custom_model=gpt4_model)
gpt4_client = Educhain(gpt4_config)
๐Ÿ“ Export Questions to Different Formats
from educhain import Educhain

client = Educhain()
questions = client.qna_engine.generate_questions(topic="Climate Change", num=5)

# Export to JSON
questions.json("climate_questions.json")

# Export to PDF
questions.to_pdf("climate_questions.pdf")

# Export to CSV
questions.to_csv("climate_questions.csv")
๐ŸŽจ Customizable Prompt Templates
from educhain import Educhain

client = Educhain()

# Custom template for questions
custom_template = """
Generate {num} {question_type} questions about {topic}.
Ensure the questions are:
- At {difficulty_level} level
- Focus on {learning_objective}
- Include practical examples
- {custom_instructions}
"""

questions = client.qna_engine.generate_questions(
    topic="Machine Learning",
    num=3,
    question_type="Multiple Choice",
    difficulty_level="Intermediate",
    learning_objective="Understanding Neural Networks",
    custom_instructions="Include recent developments",
    prompt_template=custom_template
)
๐Ÿ“š Generate Questions from Files
from educhain import Educhain

client = Educhain()

# From URL
url_questions = client.qna_engine.generate_questions_from_data(
    source="https://example.com/article",
    source_type="url",
    num=3
)

# From PDF
pdf_questions = client.qna_engine.generate_questions_from_data(
    source="path/to/document.pdf",
    source_type="pdf",
    num=3
)

# From Text File
text_questions = client.qna_engine.generate_questions_from_data(
    source="path/to/content.txt",
    source_type="text",
    num=3
)
๐Ÿ“น Generate Questions from YouTube Videos New
from educhain import Educhain

client = Educhain()

# Basic usage - Generate 3 MCQs from a YouTube video
questions = client.qna_engine.generate_questions_from_youtube(
    url="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    num=3
)
print(questions.json())

# Generate questions preserving original language
preserved_questions = client.qna_engine.generate_questions_from_youtube(
    url="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    num=2,
    target_language='hi',
    preserve_original_language=True  # Keeps original language
)
๐Ÿฅฝ Generate Questions from Images New
from educhain import Educhain

client = Educhain() #Default is 4o-mini (make sure to use a multimodal LLM!)

question = client.qna_engine.solve_doubt(
    image_source="path-to-your-image",
    prompt="Explain the diagram in detail",
    detail_level = "High" 
    )

print(question)

๐Ÿ“ˆ Workflow

Reimagining Education with AI ๐Ÿค–

  • ๐Ÿ“œ QnA Engine: Generates an infinte variety of Questions
  • ๐Ÿ“ฐ Content Engine: One-stop content generation - lesson plans, flashcards, notes etc
  • ๐Ÿ“Œ Personalization Engine: Adapts to your individual level of understanding for a tailored experience.

Educhain workflow diagram

๐Ÿ›  Installation

pip install educhain

๐ŸŽฎ Usage

Starter Guide

Open In Colab

Quick Start

Get started with content generation in < 3 lines!

from educhain import Educhain

client = Educhain()

ques = client.qna_engine.generate_questions(topic="Newton's Law of Motion",
                                            num=5)
print(ques)
ques.json() # ques.dict()

Supports Different Question Types

Generates different types of questions. See the advanced guide to create a custom question type.

# Supports "Multiple Choice" (default); "True/False"; "Fill in the Blank"; "Short Answer"

from educhain import Educhain

client = Educhain()

ques = client.qna_engine.generate_questions(topic = "Psychology", 
                                            num = 10,
                                            question_type="Fill in the Blank"
                                            custom_instructions = "Only basic questions")

print(ques)
ques.json() #ques.dict()

Use Different LLM Models

To use a custom model, you can pass a model configuration through the LLMConfig class

Here's an example using the Gemini Model

from langchain_google_genai import ChatGoogleGenerativeAI
from educhain import Educhain, LLMConfig

gemini_flash = ChatGoogleGenerativeAI(
    model="gemini-1.5-flash-exp-0827",
    google_api_key="GOOGLE_API_KEY")

flash_config = LLMConfig(custom_model=gemini_flash)

client = Educhain(flash_config) #using gemini model with educhain

ques = client.qna_engine.generate_questions(topic="Psychology",
                                            num=10)

print(ques)
ques.json() #ques.dict()

Customizable Prompt Templates

Configure your prompt templates for more control over input parameters and output quality.

from educhain import Educhain

client = Educhain()

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}
"""

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

print(ques)

Generate Questions from Data Sources

Ingest your own data to create content. Currently supports URL/PDF/TXT.

from educhain import Educhain
client = Educhain()

ques = client.qna_engine.generate_questions_from_data(
    source="https://en.wikipedia.org/wiki/Big_Mac_Index",
    source_type="url",
    num=5)

print(ques)
ques.json() # ques.dict()

Generate Lesson Plans

Create interactive and detailed lesson plans.

from educhain import Educhain

client = Educhain()

plan = client.content_engine.generate_lesson_plan(
                              topic = "Newton's Law of Motion")

print(plan)
plan.json()  # plan.dict()

๐Ÿ“Š Supported Question Types

  • Multiple Choice Questions (MCQ)
  • Short Answer Questions
  • True/False Questions
  • Fill in the Blank Questions

๐Ÿ”ง Advanced Configuration

Educhain offers advanced configuration options to fine-tune its behavior. Check our advanced guide for more details. (coming soon!)

๐ŸŒŸ Success Stories

Educators worldwide are using Educhain to transform their teaching. Read our case studies to learn more.

๐Ÿ“ˆ Usage Statistics

Educhain's adoption has been growing rapidly:

Usage Growth Graph

๐Ÿ—บ Roadmap

  • 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
  • Integration with popular Learning Management Systems
  • Mobile app for on-the-go content generation

๐Ÿค Contributing

We welcome contributions! Please see our Contribution Guide for more details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ฌ Contact

For bug reports or feature requests, please open an issue on our GitHub repository.


Educhain Logo

Made with โค๏ธ by Buildfastwithai

www.educhain.in

About

A Python package for generating educational content using Generative AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages