T.i is an AI-powered teaching assistant for Coderschool's Discord forums. It combines OpenAI's GPT models with Discord's interactive features to provide intelligent, contextual assistance to learners.
- Multi-language support with natural, friendly communication
- Context-aware responses based on course materials and documentation
- Smart handling of follow-up questions in thread conversations
- GitHub repository integration
- Automatic code extraction and analysis
- Support for multiple programming languages
- Code review and improvement suggestions
- Image analysis for debugging visualizations
- Error identification in charts and plots
- Step-by-step guidance for fixing visual issues
- Automatic YouTube tutorial suggestions
- Curated educational content recommendations
- Topic-specific learning materials
- Seamless Discord thread management
- Automatic TA tagging for complex queries
- Real-time feedback collection system
- Progress tracking and response monitoring
# User asks about their GitHub repository
"I'm having trouble with my code at github.com/user/project. Can you help?"
# Bot automatically:
1. Extracts repository details
2. Fetches relevant code
3. Analyzes the implementation
4. Provides targeted feedback
# User shares a matplotlib visualization
"Why does my plot look weird?"
# Bot helps by:
1. Analyzing the image
2. Identifying visual issues
3. Suggesting improvements
4. Providing example code fixes
# User asks about a topic
"Can you help me understand pandas DataFrame joins?"
# Bot responds with:
1. Clear explanation
2. Relevant code examples
3. Curated YouTube tutorials
4. Additional learning resources
# User continues the conversation
"How can I optimize this query?"
# Bot provides:
1. Step-by-step guidance
2. Performance tips
3. Best practices
4. Links to related tutorials
chatbot/
βββ bot/
β βββ extensions/
β β βββ questions.py # Discord client implementation
| βββ __init__.py
| βββ __main__.py
| βββ bot.py
| βββ assistant.py # Core AI assistant implementation
| βββ tools.py # Assistant tool definitions
βββ docs/ # Documents for knowledge retrieval
βββ data/
β βββ instructions.txt # Assistant guidelines
βββ .env # Environment variables
βββ .gitignore
βββ LICENSE
βββ README.md
βββ requirements.txt
- OpenAI GPT models for natural language understanding
- Vector store for efficient document search
- Tool-based architecture for extensibility
- Thread-based conversations
- File and image handling
- Reaction-based feedback system
- Role-based access control
- GitHub API integration
- YouTube search capabilities
- Code analysis tools
- Documentation search
Workflow
graph TD
A((On new Message)) --> B(Check if Thread Exists)
B -->|Yes| C(Add Message to Thread)
B -->|No| D(Create Thread)
D --> C
C --> E(Create Run)
E --> E'(Process Run)
E' --> F{Run Status Check}
F -->|completed| G(Retrieve Response Messages)
F -->|requires_action| H(Process Required Tool Calls)
H --> I{Tool Type}
I -->|GitHub| J(Fetch Repository Code)
I -->|YouTube| K(Search Videos)
I -->|Document| L(Send Doc Content)
J --> E'
K --> E'
L --> E'
F -->|failed| M(Log Error and Exit)
G --> O{Check Citations}
O -->|Yes| P(Add Referenced Files)
O -->|No| Q(Display Response to User)
P --> Q
Q --> S(((End)))
- Clone and setup:
git clone https://github.com/nauqh/ti.git
cd ti
pip install -r requirements.txt
- Configure environment:
OPENAI_API_KEY=<Your OpenAI API Key>
DISCORD_TOKEN=<Your Discord Bot Token>
GITHUB_TOKEN=<Your GitHub Personal Access Token>
- Run the bot:
python -Om bot
Contributions are welcome! See CONTRIBUTING.md for guidelines.
This project is under the MIT License. See LICENSE for details.