How getmetal/motorhead works
Main Components
a) Core Components:
• Memory Management Service (src/memory.rs)
• Long-term Memory Service (src/long_term_memory.rs)
• Retrieval Service (src/retrieval.rs)
• Redis Database Integration (src/redis_utils.rs)
• Message Reducer (src/reducer.rs)
b) External Services:
• OpenAI API (or Azure OpenAI)
• Redis with RediSearch VSS
┌─ Client Layer ─────────────────────────────────┐
• External Applications/Examples │
• (JS, Python, Vanilla JS clients) │
• ┬───────────────────────────┘
┌─ API Layer ───────┼───────────────────────────┐
• REST Endpoints: │ │
• GET /sessions/:id/memory │
• POST /sessions/:id/memory │
• DELETE /sessions/:id/memory │
• POST /sessions/:id/retrieval │
• ┬───────────────────────────┘
┌─ Core Services ───┼───────────────────────────┐
• ┌─────────────┐ │ ┌──────────────┐ │
• Memory │──┼──│ Retrieval │ │
• Manager │ │ │ Service │ │
• ┘ │ └──────────────┘ │
• ┌─────────────┐ │ ┌──────────────┐ │
• Message │──┼──│ Long-term │ │
• Reducer │ │ │ Memory │ │
• ┘ │ └──────────────┘ │
• ┬───────────────────────────┘
┌─ External Services┼───────────────────────────┐
• ┌─────────────┐ │ ┌──────────────┐ │
• OpenAI/ │──┼──│ Redis │ │
• Azure OpenAI │ │ │ (RediSearch) │ │
• ┘ │ └──────────────┘ │
• ┘
Important Elements to Highlight
a) Data Flow:
• Message flow from clients through API endpoints
• Memory management process
• Retrieval query path
• Interaction with Redis for storage and search
• Summarization flow with OpenAI
b) Configuration Elements:
• Window size management
• Long-term memory toggle
• Model selection (GPT-3.5/4)
• Redis connection
• Azure/OpenAI API configuration
Implementation Details
• Session-based architecture
• Message window management
• Integration with vector search
• Summarization pipeline
• Multiple client support
• Configuration flexibility
Remember to:
• Keep the main flow clear and centered
• Related components together
• Use consistent styling
• Notes for important configuration options
• Scaling points