Educhain Documentation

repository·main·Indexed 18 days ago

https://github.com/satvik314/educhain

A Python package that leverages Generative AI to create personalized educational content, including MCQs, lesson plans, and pedagogy-based learning materials. It supports various AI providers such as Google Gemini 2.0, Groq (Llama4), Anthropic Claude 3.5 Sonnet, and OpenAI. The library includes a cookbook with starter apps for flashcard generation, mock-trial simulation (AI Courtroom), consulting interview prep, and pedagogical content generation based on theories like Bloom's Taxonomy and Socratic Questioning.

Tokens
50.4K
Snippets
173
Records
212
Agent score
64%

What's inside Educhain

  1. Overview of Educhain Pedagogy Features

    main
    Educhain provides a pedagogy-based content generation system that supports 8 evidence-based pedagogical approaches. Unlike traditional generators that produce simple bullet points or frameworks, Educhain's system is designed for Content-Rich Generation, producing complete, consumable educational content such as detailed study materials, step-by-step procedures, and full educational experiences. This makes it suitable for LMS integration, educational applications, and self-study platforms.
  2. Overview of Educhain features

    main

    Educhain is a Python package designed for generating personalized educational content using Generative AI.

    Content Generation

    • MCQs: Generate Multiple Choice Questions with explanations.
    • Flashcards: Create flashcards for studying.
    • Lesson Plans: Build comprehensive plans including objectives and activities.
    • Study Guides: Generate summaries and educational guides.

    Technical Capabilities

    • LLM Support: Works with Gemini, GPT-4, Claude, and other models.
    • Multilingual: Supports multilingual content generation and preservation.
    • Multimodal: Generates questions from images and extracts content from YouTube videos.
    • Data Sources: Generates questions from URLs, PDFs, and raw text.

    Integration & Export

    • Formats: Export content to JSON, PDF, CSV, and DOCX.
    • Customization: Supports customizable prompt templates.
    • App Building: Integrates with Streamlit for building educational applications.
  3. Explore Educhain Features

    main

    Educhain provides several advanced features for automated educational content generation. Key features include:

    • MCQ Generation: Generate Multiple Choice Questions from raw data.
    • Flashcards: Create basic flashcards for study.
    • Bulk Generation: Generate large volumes of questions at once.
    • Visual Question Generation: Generate questions based on visual data.
    • YouTube Integration: Generate questions directly from YouTube content.
    • Career Connection: Link educational content to career paths.
    • Lesson Planning: Generate structured lesson plans.
    • Study Guides: Create comprehensive study guides.
  4. Explore Educhain Use Cases

    main

    Educhain can be applied to various real-world scenarios, such as:

    • Webpage to Quiz: Convert any webpage into a quiz.
    • Transcript to Quiz: Generate quizzes from video or audio transcripts.
    • PDF Processing: Process long PDF documents into quizzes.
    • Multilingual Support: Generate multilingual MCQs (e.g., using Sutra).
    • News-based Quizzes: Create quizzes based on the latest news.
    • High-Speed Generation: Utilize the 'World's Fastest Quiz' engine.
    • Llama4 Integration: Use Llama4 via Groq.
  5. Use different LLMs with LLMConfig

    main

    Educhain allows you to switch from the default OpenAI model to other LLMs (like Gemini, Claude, or Llama via Groq) by using the LLMConfig class.

    1. Initialize your preferred model using a LangChain compatible chat model (e.g., ChatGoogleGenerativeAI, ChatAnthropic, or ChatOpenAI).
    2. Wrap that model in an LLMConfig(custom_model=...) object.
    3. Pass the LLMConfig instance to the Educhain constructor.
    from educhain import Educhain, LLMConfig
    from langchain_google_genai import ChatGoogleGenerativeAI
    
    # 1. Initialize the model
    gemini_flash = ChatGoogleGenerativeAI(
        model="gemini-2.0-flash",
        google_api_key="YOUR_GOOGLE_API_KEY"
    )
    
    # 2. Create the config
    Gemini_config = LLMConfig(custom_model=gemini_flash)
    
    # 3. Initialize Educhain with the config
    client = Educhain(Gemini_config)
    
    plan = client.content_engine.generate_study_guide(
        topic = "Introduction to Programming with Python",
        difficulty_level = "Beginner"
    )
    
    plan.show()
  6. Compare different TTS providers for Educhain

    main

    Choose a provider based on your project requirements:

    Use CaseRecommended Provider
    Testing & Devgoogle (Free, no setup)
    AI-Powered/Naturalgemini (Latest Gemini 2.5, 30 voices)
    Production Qualityopenai (Excellent quality, natural)
    Professional/Monetizedelevenlabs (Best voice quality)
    Enterprise/Multi-Languageazure (400+ voices, 100+ languages)
    Budget/Open-Sourcedeepinfra (Most affordable, MIT/Apache models)
  7. Available Pedagogical Approaches in Educhain

    main

    Educhain supports 8 distinct pedagogical approaches to guide content generation. The following approaches are available (partial list from guide):

    1. Bloom's Taxonomy: Used for complete course curriculum design and skill-based training for professionals.
    2. Socratic Questioning: Ideal for philosophy and ethics courses and developing critical thinking.
    3. Project-Based Learning (PBL): Designed for STEM education and industry-partnered learning scenarios.
  8. Understand the MCQList and MCQ output format

    main

    The output of the question generation engine is an MCQList object containing a list of MCQ objects. Each MCQ object includes the question text, a list of options, the correct answer, and an explanation.

    MCQList(
        questions=[
            MCQ(
                question="What is artificial intelligence primarily concerned with?",
                options=[
                    "Creating intelligent machines",
                    "Developing faster computers",
                    "Improving internet connectivity",
                    "Designing user interfaces"
                ],
                correct_answer="Creating intelligent machines",
                explanation="Artificial intelligence focuses on creating machines that can perform tasks requiring human-like intelligence."
            ),
            # More questions...
        ]
    )
  9. Compatibility and Breaking Changes in v0.4.0

    main

    The migration to LangChain v1.0 in Educhain v0.4.0 introduced the following changes:

    Breaking Changes

    • Python Support: Python 3.9 is no longer supported. You must use Python 3.10+.
    • Dependencies: The langchain-classic package has been removed. If you have it in your environment, it must be uninstalled.
    • Internal RAG Implementation: The RAG functionality now uses an agent-based pattern instead of the legacy RetrievalQA chain. This allows for multi-step reasoning and better context understanding.

    Backward Compatibility

    • Public API: All public API methods, including generate_questions_with_rag(), have unchanged signatures.
    • Return Types: All method return types remain the same, ensuring existing code using Educhain will work without modification.
  10. Supported Pedagogies in Educhain Pedagogy

    main

    The application supports generating tailored learning experiences using the following pedagogical approaches:

    • blooms_taxonomy (Blooms Taxonomy)
    • socratic_questioning (Socratic Questioning)
    • project_based_learning (Project Based Learning)
    • flipped_classroom (Flipped Classroom)
    • inquiry_based_learning (Inquiry Based Learning)
    • constructivist (Constructivist)
    • gamification (Gamification)
    • peer_learning (Peer Learning)
    • game_based_learning (Game-Based Learning)
  11. Quickstart Paperfold.ai (Origami Tutorial Generator)

    main

    Paperfold.ai is an AI-powered web application that generates step-by-step origami folding guides from uploaded images using the horizon-beta model via OpenRouter.

    To run the application locally, follow these steps:

    1. Clone the repository
    2. Set up a Python environment (requires Python $\ge$ 3.13).
    3. Install dependencies (includes educhain, langchain-openai, and streamlit).
    4. Configure OpenRouter by obtaining an API key from openrouter.ai.
    5. Launch the Streamlit app.

    Supported OS: macOS, Linux, Windows.

    # 1. Clone the repo
    git clone https://github.com/your-org/paperfold.ai.git
    cd paperfold.ai
    
    # 2. Set up Python (using uv)
    uv venv
    source .venv/bin/activate
    uv pip install -r requirements.txt
    
    # 4. Launch locally
    streamlit run app.py
  12. Getting Started with Educhain Cookbook

    main

    To begin using the Educhain cookbook examples, clone the repository, navigate to the cookbook directory, and open the desired Jupyter Notebook (.ipynb) file in your environment.

    Setup Steps

    1. Clone the repository:
      git clone https://github.com/satvik314/educhain
    2. Navigate to the cookbook folder:
      cd educhain/cookbook
    3. Open any .ipynb file in your Jupyter Notebook environment to access specific guides and examples.
    git clone https://github.com/satvik314/educhain
    cd educhain/cookbook