Final course project (lab 9) for Laboratory Course of Machine Intelligence, Peking University, 2025 Fall.
An LLM-based interactive agent that models a learner’s understanding by adaptively probing topics from lecture materials through observation, planning, and reflection.
Implemented as a CLI tool that extracts topics from a lecture PDF, quizzes the user, reflects on answers, and tracks knowledge state. Supports topic number limiting and verbose mode with token usage.
- Python 3.12
- Install dependency:
pip install -r interactive_knowledge_agent/requirements.txt
- Set OpenAI key or call your API key later:
export OPENAI_API_KEY=<your_openai_api_key>
From repo root:
python interactive_knowledge_agent/main.py \
--pdf interactive_knowledge_agent/pdf_materials/example.pdf \
--prompt-dir interactive_knowledge_agent/prompts \
--output-dir interactive_knowledge_agent/outputs \
--model gpt-4o \
--max-topics 3 \
--verbose \
--api-key "$OPENAI_API_KEY"
--pdf(required): path to lecture PDF.--prompt-dir: prompt templates directory (defaultprompts).--output-dir: where session JSONs are saved (defaultoutputs).--model: OpenAI chat model name (defaultgpt-4o).--max-topics: keep only the first N topics from analysis.--verbose: print topics, per-turn reflections, knowledge updates, and token usage.--api-key: optional; otherwise usesOPENAI_API_KEYenv.