Spaces:
Runtime error
Runtime error
|
Download README.md from TrueTensor/Vidya-V3-Tutor: direct link, hf CLI and curl.
- Browser
- Download file 4.87 kB
-
https://huggingface.co/spaces/TrueTensor/Vidya-V3-Tutor/resolve/main/README.md
- Command line
-
hf download hf://spaces/TrueTensor/Vidya-V3-Tutor/README.md
-
curl -L -o README.md https://huggingface.co/spaces/TrueTensor/Vidya-V3-Tutor/resolve/main/README.md
4.87 kB
A newer version of the Gradio SDK is available: 6.33.0
metadata
title: Vidya AI Tutor
emoji: π€
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.32.0
app_file: app.py
pinned: false
Vidya V3 β Real-Time AI Tutor (Terminal POC)
A modular, terminal-based AI tutoring system powered by Google Gemini and Cognitive Apprenticeship (CA) pedagogy. Zero UI, zero server β just Python and a terminal.
Architecture
vidya-realtime-ai-tutor/
βββ src/
β βββ main.py β entry point + REPL loop
β βββ config.py β env vars + constants
β βββ gemini_client.py β Gemini API (google-genai SDK)
β βββ tutor_session.py β per-turn orchestration
β βββ schemas.py β Pydantic input/output models
β βββ signal_extractor.pyβ local debug signal detector
β βββ phase_manager.py β fallback CA phase logic
β βββ utils.py β terminal colors + helpers
βββ prompts/
β βββ system_prompt.txt β Gemini's identity + rules
βββ logs/
β βββ conversations.json β auto-saved session logs
βββ requirements.txt
βββ .env.example
Streamlit start
streamlit run streamlit_app.py
## Quickstart
```bash
# 1. Create and activate virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set up API key
copy .env.example .env # Windows
cp .env.example .env # macOS/Linux
# Edit .env and paste your Gemini API key:
# GEMINI_API_KEY=your_key_here
# 4. Run the tutor
python src/main.py
# Optional: enable debug signal view on startup
python src/main.py --debug
Getting a Gemini API Key
- Go to https://aistudio.google.com/app/apikey
- Sign in with your Google account
- Click Create API key
- Paste it into your
.envfile
Session Setup (one-time per run)
When you run the app you'll be asked:
| Question | Example inputs |
|---|---|
| Skill topic | Python functions, SQL joins, OOP concepts |
| Mastery level | 0.0 (beginner) β 1.0 (expert), e.g. 0.2 |
| Who are you? | 1 for student, 2 for service engineer |
| Starting phase | 1 MODEL, 2 COACH, 3 SCAFFOLD, 4 FADE |
| Language | 1 English, 2 Hindi, 3 Mixed |
Demo Conversation (Python Functions, student, en)
You: I don't understand what a function is.
π Vidya [MODEL]
A function is a reusable block of code. Think of it like a recipe:
def greet(name):
return f"Hello, {name}!"
greet("Riya") β "Hello, Riya!"
The def keyword defines it; you call it by name.
π‘ Next: Try writing a function that adds two numbers.
You: Just tell me the answer.
π Vidya [COACH]
I'd love to help β but you'll learn much more by trying first!
What would the function signature look like? What inputs would it take?
π‘ Next: Start with: def add(a, b): and see what you can fill in.
You: Can you teach me cricket?
π Vidya [COACH]
That's a fun topic! But right now we're focused on Python functions β
and you're doing well! Let's stick with it. What part of functions
feels most unclear?
π‘ Next: Come back to Python functions β you're almost there!
You: exit
β
Conversation saved to logs/conversations.json (3 turns)
Cognitive Apprenticeship Phases
| Phase | Tutor Behaviour |
|---|---|
| MODEL | Shows a worked example, thinks out loud |
| COACH | Asks guiding questions, no direct answers |
| SCAFFOLD | Partial hints, fills gaps not full solutions |
| FADE | Learner leads, tutor lightly nudges |
Gemini decides which phase to advance/hold/regress based on your responses.
Debug Mode
Type debug at any point during the chat to toggle signal visibility:
[DEBUG] signals=confusion, answer_seeking | phase_reason=turn 3
Or start with --debug for it enabled from the first turn.
Swapping LLM Provider
The Gemini call is isolated in src/gemini_client.py. To swap to OpenAI or
Anthropic Claude:
- Open
src/gemini_client.py - Replace the
call_gemini()function body with your provider's SDK call - Keep the same function signature and return type (raw string)
- Update
requirements.txtwith the new SDK - Add the new
*_API_KEYto.env.example
tutor_session.py, main.py, and everything else stay unchanged.
Log Format (logs/conversations.json)
[
{
"config": { "skill_topic": "...", "mastery_level": 0.2, ... },
"final_phase": "COACH",
"turns": 5,
"conversation": [
{ "role": "user", "content": "..." },
{ "role": "assistant", "content": "..." }
]
}
]
Requirements
- Python 3.10+
- Google Gemini API key (free tier available)
- Dependencies:
google-genai,python-dotenv,pydantic