Yaswanth123's picture
Update README.md
8a8f96d verified

A newer version of the Gradio SDK is available: 5.38.0

Upgrade
metadata
title: AI-Tutor-and-Syllabus-Planner
emoji: πŸš€
colorFrom: indigo
colorTo: purple
sdk: gradio
app_file: app.py
pinned: false
tags:
  - agent-demo-track

AI Tutor Project

A personalized AI learning assistant that designs your learning plan with you, then tutors you through it.

Table of Contents


What is AI Tutor?

This project is an AI powered tutor designed to provide a personalized learning experience. You can define what you want to learn, provide resources (like documents or books), and the AI will help generate a structured syllabus and interact with you in a specific persona to teach you the material.

Why Use This AI Tutor?

Traditional Large Language Models (LLMs) are incredibly knowledgeable but can sometimes lack depth on specific topics unless guided precisely. They also tend to have a fixed interaction style once a session begins. This AI Tutor aims to address these points by:

  1. Focused Learning: Creating a detailed syllabus based on your input and resources, ensuring the AI stays on track and provides in-depth explanations.
  2. Adaptive Persona: Allowing you to define the teaching style (e.g., Socratic, first-principles, like a famous figure) for a more engaging and effective learning experience. (Currently, the persona is set per chat session, with future ideas for dynamic updates.)

Features

  • Personalized syllabus generation based on user goals and optional resources.
  • Customizable teaching persona for the AI Explainer Agent.
  • Interactive conversation manager to clarify learning objectives.
  • Proper rendering of code and math formulas in explanations.
  • Designed for topics requiring deep thinking and understanding.

How It Works (The Gist)

The AI Tutor guides you from a broad idea to a focused learning session in four simple steps:

  1. Plan Your Lessons Start by chatting with the AI to define your learning goals. It can even process documents you provide (like PDFs or articles) to understand the context of what you want to master.

  2. Refine Your Roadmap The system then drafts a structured syllabus tailored to your conversation. You have full control to review, modify, and finalize this plan until it perfectly matches your needs.

  3. Choose Your Teacher Once your plan is locked in, you describe your ideal teaching style. Want a demanding professor who uses the Socratic method? A friendly peer who explains with analogies? You define the persona.

  4. Start Learning A custom AI tutor comes to life, ready to teach you based on your syllabus and in your preferred style, complete with proper formatting for code and math.

A Deeper Dive: How AI Tutor Works

LLMs have vast knowledge, but making them act as effective, specialized tutors requires addressing a few challenges:

  1. Depth vs. Breadth: LLMs often need precise guidance to provide in-depth knowledge on specific topics rather than general overviews.
  2. Static Prompts: Once a system prompt (which defines the AI's behavior, knowledge base, and persona) is set, it's typically fixed for that interaction.

This project tackles these issues through a structured workflow:

Core Components

  1. Conversation Manager (Convo Manager)

    • Key Responsibility: Manages the initial dialogue to define user goals and control the workflow
    • Role: Interacts with the user to understand their learning goals: what they want to learn, why (optional), and how (teaching style preferences. The "how" is further refined by the Persona Prompt Generator).
    • Resource Handling: If resources are provided, it generates an initial summary.
    • Control Flow: Manages the conversation flow, asking clarifying questions (temperature can be adjusted to reduce chattiness) and producing tags (e.g., generate , modify , finalize , persona) to trigger subsequent agents like the Syllabus Generator and Persona Generator.
  2. Syllabus Generator

    • Key Responsibility: Generates a structured learning plan from the user's goals and provided resources.
    • Input: User's learning objectives (from Convo Manager) and any provided resources.
    • Process:
      • No Resources: Uses a specific prompt to generate a syllabus from scratch.
      • With Resources: For large resources, it truncates text (e.g., to 100,000 chars per resource) and creates a "Dynamic Summary" (considering user history) before generating the syllabus.
      • (Note: Performance with heavy resources can be enhanced with more powerful models or paid tiers by tweaking code in orchestrator & Dynamic Resource Generation.)
    • Output: A structured syllabus, which the user can then ask to modify.
  3. Persona Prompt Generator

    • Key Responsibility: Crafts the detailed system prompt that defines the AI tutor's personality and teaching methodology.
    • Trigger: Activates after the syllabus is finalized.
    • Goal: Defines the teaching style and "personality" of the Explainer Agent. This is a critical step for an effective learning experience.
    • User Input: The user describes how they want to be taught.
      • Effective Answers: Focus on pedagogical approaches (e.g., First Principle Thinking, Socratic method), emulate learning styles of great thinkers (past/present) or even fictional characters. Aim for a serious, efficient teaching style, not overly pleasing. Mentioning "search capabilities" or other tool use can be integrated if using other platforms like Google AI Studio with grounding.
      • Example: "Teach me with Socratic questioning, focusing on first principles. Be serious and ensure I understand the fundamentals before moving on. You have search capabilities to verify facts(Helpful for Tool Calling)."
    • Output: A system prompt for the Explainer Agent, generated by PersonaPromptBodyPredictSignature based on chat history and the user's persona description.
    • (Note: A good persona prompt is key. A generic one often leads to a subpar learning experience.)
  4. Explainer Agent

    • Key Responsibility: Acts as the final AI tutor, executing the teaching session based on the finalized syllabus and persona.
    • Input: The system prompt (syllabus + persona) generated previously.
    • Role: Greets the user and begins teaching according to the syllabus and defined persona.
    • Features: Renders code and mathematical formulas correctly.
    • Portability: The system prompt can be copied from the admin panel to be used in other LLM interfaces like Google AI Studio

Effective Use Cases & Tips

  • Ideal Topics (based on experience):
    • Subjects requiring deep conceptual understanding where visual/audio aids are not primary (e.g., learning music theory concepts is okay, but learning an instrument is not ideal for this text-based version).and also not optimal for Topics where you need extreme precision from a preferred resource.
    • Examples: Increasing cognitive ability, learning Chess & Go strategies, brain control
    • Technical Topics: Revising classic machine learning, exploring advanced Reinforcement Learning (e.g., using Barto & Sutton as a resource and AI Studio(can handle large files) for syllabus creation) and understanding codebases.
  • Performance: Generally strong for conceptual/philosophical topics. For highly technical subjects, see "Improvements" below.
  • Resource Limitation: Currently, resources can only be provided at the start of a conversation.

Future Improvements

Technical Improvements:

  1. RAG for Explainer Agent: Implementing Retrieval Augmented Generation (RAG) for the Explainer Agent could significantly improve performance for technical topics by grounding explanations in specific documents.
    • Challenge: Self-hosting effective RAG models can be difficult. My testing indicates that smaller models (e.g., 1B parameters) often yield lower accuracy (frequently below 50% for relevant tasks), while larger, more accurate models (e.g., 7B+) demand significantly more computational resources. Other Improvements:
  2. Prompt Engineering:
    • Some prompts (e.g., FormatSyllabusXMLToMarkdown) are quite long and could be refined or made optional.
    • The Convo Manager's questioning style could be more adaptable.
    • The Persona Prompt Generator could be more "agentic" (multi-step, iterative refinement) rather than a single-step generation.
  3. UI/UX Enhancements:
    • Visual cues for transitions between stages (Convo > Syllabus > Persona > Explainer).
    • General UI polish.