AI Writing Agent
A modular writing assistant powered by LangChain and GPT-4o-mini with specialized tools for grammar, style, simplification, and content completion.
Overview
A smart writing assistant built with LangChain's agent framework, offering a suite of specialized writing tools. The OpenAI Functions agent intelligently selects the right tool for each user request, while conversation memory ensures contextually aware suggestions.
Problem Statement
Generic LLM chat interfaces lack the structure needed for reliable writing assistance. A tool-based agent approach enables precise, auditable actions (grammar fix, formal rewrite, etc.) rather than unpredictable open-ended generation.
Architecture
- LangChain OpenAI Functions agent as the orchestration layer
- Grammar correction tool for fixing language errors
- Formal rewriting tool for professional tone conversion
- Sentence simplification tool for complex text
- Article completion tool for continuing partial content
- Conversation memory for multi-turn context
Challenges
- ✗Ensuring the agent selects the right tool consistently
- ✗Maintaining coherent context across multi-turn conversations
- ✗Preventing over-generation that drifts from user intent
Solutions
- ✓Carefully designed tool descriptions to guide agent tool selection
- ✓ConversationBufferMemory for persistent context within a session
- ✓Temperature tuning per tool (lower for grammar, higher for completion)
Lessons Learned
- 💡Tool descriptions are the most impactful lever for agent reliability
- 💡OpenAI Functions calling is more reliable than ReAct-style agents for structured tasks
- 💡Memory management is critical — long contexts degrade performance
Related Projects
Brain CT Scan Classifier
Multi-label classification system for brain CT scans using ConvNeXt-V2 and Multiple Instance Learning with a dual-head architecture.
Microjobs Portal
A local part-time job board with an AI-powered recommendation system using TF-IDF and FAISS for fast similarity search.
AI Customer Support Chatbot
RAG-based chatbot that resolves customer complaints by retrieving similar past cases and generating responses with a local LLM.