A second-language learning application powered by local LLMs via Ollama. This is a converted version of the original Google AI Studio prototype, now running completely offline with open-source language models.
- Fully Local: No API keys required, runs completely offline
- Conversational Practice: Interactive chat sessions for language learning
- Real-time Grammar Feedback: Get corrections and explanations for your mistakes
- Progress Tracking: Monitor student performance and common error patterns
- Customizable Lessons: Create lessons with specific scenarios and vocabulary
- Multiple Language Support: Works with any language supported by your chosen LLM
- Node.js (v18 or higher)
- Ollama - Local LLM runtime
macOS/Linux:
curl -fsSL https://ollama.com/install.sh | shWindows: Download from https://ollama.com/download
# Clone or extract the project
cd interact-llm
# Run the setup script (macOS/Linux)
chmod +x setup-ollama.sh
./setup-ollama.sh
# Or manually setup:
# 1. Start Ollama service
ollama serve
# 2. Pull a language model (in another terminal)
ollama pull llama3.2:3b
# 3. Copy environment configuration
cp .env.example .env
# 4. Install dependencies
npm installnpm run devOpen http://localhost:5173 in your browser.
| Model | Size | Speed | Quality | Best For |
|---|---|---|---|---|
| llama3.2:3b | 2GB | Fast | Good | General language learning, balanced performance |
| gemma2:2b | 1.6GB | Very Fast | Good | Educational content, grammar checking |
| qwen2.5:3b | 2GB | Fast | Excellent | Multilingual learning, Asian languages |
| mistral:7b | 4GB | Medium | Very Good | Advanced conversations, nuanced feedback |
| phi3:mini | 2GB | Very Fast | Good | Quick responses, basic conversations |
Edit .env file to customize:
# Ollama API endpoint (default: http://localhost:11434)
VITE_OLLAMA_BASE_URL=http://localhost:11434
# Model to use (must be installed via ollama pull)
VITE_OLLAMA_MODEL=llama3.2:3bTo use a different model:
-
Pull the new model:
ollama pull mistral:7b
-
Update
.env:VITE_OLLAMA_MODEL=mistral:7b
-
Restart the development server
- API Service: Replaced
geminiService.tswithollamaService.ts - Dependencies: Removed
@google/genai, now using native fetch API - Response Handling: Adapted to handle both JSON and plain text responses from different models
- Error Handling: Added fallbacks for models that don't strictly follow JSON formatting
- All UI components and user experience
- Lesson structure and progression system
- Student progress tracking
- Feedback mechanisms
# Start Ollama service
ollama serve
# Check if running
curl http://localhost:11434/api/tags# List installed models
ollama list
# Pull the required model
ollama pull llama3.2:3b- Try a smaller model (e.g.,
phi3:miniorgemma2:2b) - Ensure you have enough RAM (at least 8GB recommended)
- Close other applications to free up memory
Some models may not always return perfect JSON. The app includes fallback handling, but for best results:
- Use models known for good instruction following (llama3.2, gemma2)
- Consider fine-tuning a model specifically for this task
- Model Selection: Smaller models (2-3B parameters) often work better for structured tasks like language learning
- Context Length: Keep conversations reasonable length to maintain performance
- Hardware:
- Minimum: 8GB RAM
- Recommended: 16GB RAM, dedicated GPU (for faster inference)
interact-llm/
├── components/ # React components
├── services/
│ ├── ollamaService.ts # Ollama API integration (NEW)
│ ├── dataService.ts # Data persistence
│ └── ...
├── types.ts # TypeScript definitions
└── ...
The OllamaService exposes the same interface as the original GeminiService:
getChatResponse(lesson, message)- Get AI responseanalyzeConversation(lesson, conversation)- Analyze performancegetPostConversationFeedback(lesson, conversation)- Generate feedbackgetDetailedFeedback(lesson, conversation, feedback)- Elaborate on feedback
- JSON Consistency: Open-source models may not always return perfectly structured JSON
- Language Quality: Response quality varies by model and language
- Grammar Detection: Less sophisticated than commercial APIs for complex grammar rules
- Response Time: Depends on local hardware capabilities
Feel free to contribute improvements, especially:
- Model-specific prompting strategies
- Better error handling for various models
- Performance optimizations
- Additional language-specific features
[Your License Here]
- Original prototype built with Google AI Studio
- Powered by Ollama and open-source LLMs
- INTERACT-LLM research project
