# Reason Flow - AI Engineering Reasoning System An intelligent AI system for complex engineering reasoning with continuous learning capabilities. ## Architecture - **MODEL1**: Engineering reasoning model that creates step-by-step plans - **QUERYMODEL**: Execution model that uses tools to carry out plans - **RAG Pipeline**: Document search and retrieval system - **6 Specialized Tools**: Query expansion, extraction, reports, web search, PDF search - **Feedback Loop**: Continuous learning system ## Tech Stack - **Backend**: Express.js, PostgreSQL, Sequelize - **Frontend**: React, Socket.io - **AI Models**: Kimi K2 (Groq), OpenAI - **RAG**: LangChain, Vector Database - **Fine-tuning**: SFT, DPO, Correction Memory ## Setup Instructions 1. Install dependencies: ```bash npm run install-all ``` 2. Set up environment variables: ```bash cp env.example .env # Edit .env with your API keys and database credentials ``` 3. Set up database: ```bash # Create PostgreSQL database createdb reason_flow ``` 4. Start development servers: ```bash npm run dev-full ``` ## Project Structure ``` reason_flow/ ├── server/ # Express.js backend │ ├── controllers/ # Route controllers │ ├── models/ # Database models │ ├── routes/ # API routes │ ├── services/ # Business logic │ ├── middleware/ # Custom middleware │ └── utils/ # Utility functions ├── client/ # React frontend │ ├── src/ │ │ ├── components/ # React components │ │ ├── pages/ # Page components │ │ ├── services/ # API services │ │ └── utils/ # Utility functions ├── data/ # Training data and documents ├── tests/ # Test files └── uploads/ # File uploads ``` ## Features - **Intelligent Planning**: AI generates step-by-step engineering plans - **Tool Execution**: Automated execution using specialized tools - **Document Search**: RAG-powered document retrieval - **Continuous Learning**: Feedback loop for model improvement - **Real-time Chat**: WebSocket-based communication - **File Upload**: Document processing and indexing ## API Endpoints - `/api/health` - Health check - `/api/auth/*` - Authentication - `/api/chat/*` - Chat functionality - `/api/models/*` - Model management - `/api/documents/*` - Document management - `/api/feedback/*` - Feedback collection - `/api/tools/*` - Tool execution ## Development Run tests: ```bash npm test ``` Build for production: ```bash npm run build ``` ## License MIT