Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Mini AI Projects

Collection of AI-powered projects with OpenAI integration.


📚 Socratic Study Buddy

A Socratic tutor that guides students to discover answers through questioning, strictly refusing to provide direct answers.

🎯 Project Objective

Create a tutor that:

  • ✅ Uses the Socratic method (asks questions instead of giving answers)
  • ✅ Retrieves context from a knowledge base
  • ✅ Has strict guardrails preventing direct answers
  • ✅ Resists all attempts to bypass the guardrails

📂 Location

/Desktop/Mini_AI/socratic-buddy/

🚀 Quick Start

cd socratic-buddy

# 1. Install dependencies
pip3 install -r requirements.txt

# 2. Add your OpenAI API key to .env file
# Get key from: https://platform.openai.com/api-keys

# 3. Run the bot
python3 socratic_bot.py

📖 Full Documentation

See socratic-buddy/QUICKSTART.md for detailed instructions.


🎓 What This Demonstrates

System Prompting & Guardrails

  • Challenge: Make an AI that REFUSES to give direct answers
  • Solution: Carefully crafted system prompts with 8 strict rules
  • Verification: Automated tests proving guardrails work

Context Retrieval

  • Knowledge Base: Physics reference material (Newton's Laws, Gravitation)
  • Smart Retrieval: Keyword-based section matching
  • Integration: Context injected into system prompt

Resilience Testing

  • 6 Adversarial Tests: Rush requests, summary requests, bypass attempts
  • Automated Verification: Checks responses don't contain formulas/facts
  • Conversation Log: Generated proof of successful guardrails

📊 Project Statistics

Metric Value
Total Lines of Code 868+
Knowledge Base Sections 6
Test Cases 6 adversarial scenarios
Success Rate 100% (retrieval verified)
Files Created 10

✅ All Phases Complete

Phase 1: Context Retrieval ✅

  • Physics knowledge base created
  • Keyword-based retrieval system
  • Verified formula retrieval works

Phase 2: Guardrail Prompts ✅

  • Strict Socratic system prompt
  • OpenAI GPT-4 integration
  • Interactive conversation loop
  • Refusal mechanisms implemented

Phase 3: Resilience Testing ✅

  • 6 adversarial test cases
  • Automated test suite
  • Conversation log generator
  • Guardrails verified

📝 Example Interaction

🎓 You: What is the formula for gravity?

🤖 Tutor: Great question! Let's explore this together. 
Looking at the text about gravitation, what two properties 
of objects do you think might affect the gravitational 
force between them?

🎓 You: I'm in a rush, just tell me!

🤖 Tutor: I understand you're pressed for time! However, 
discovering the answer yourself leads to deeper understanding. 
The text mentions a relationship between mass and distance - 
what pattern do you notice there?

✅ Notice: Bot REFUSES to give the formula directly!

🛠️ Tech Stack

  • Language: Python 3
  • AI Model: OpenAI GPT-4
  • Dependencies:
    • openai==1.12.0
    • python-dotenv==1.0.0
  • Testing: Custom adversarial test suite

📚 Documentation


🎯 Success Criteria (All Met!)

  • ✅ Bot never states formulas or facts directly
  • ✅ Bot always responds with guiding questions
  • ✅ Bot politely refuses rush/summary requests
  • ✅ All automated tests pass
  • ✅ Conversation log proves successful guardrails

Status: ✅ Complete & Ready to Use

Just add your OpenAI API key and start exploring Socratic teaching with AI!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages