How wolframresearch/chatbook works
Project Type and Purpose
• It is neither a standalone web app nor a microservice-based system; it is a full-featured plugin composed of:
• Kernel code (Wolfram Language packages under Source/Chatbook)
• Build and packaging scripts (under Scripts/ and Developer/)
• Configuration assets (LLM personas, vector databases, user snippets)
File Structure
• Top-level directories reveal architectural layers:
• FrontEnd: notebook stylesheets, text resources, system bitmaps—wired into Mathematica’s front end
• Source/Chatbook: core Wolfram Language code—business logic for chat sessions, prompt generation, request handling, state management, UI glue
• LLMConfiguration: predefined persona configurations for different chat modes
• VectorDatabases: builders and source data for embedding-based context retrieval
• Scripts: build pipelines (vector DB, paclet packaging, stylesheet building) and CI hooks
• Tests: automated notebooks and script tests verifying functionality
• Configuration files (PacletInfo.wl, .github/workflows/*.yml, .gitignore) define packaging and CI.
README for Additional Insights
• Chatbook is installed as a paclet; users enable the Chatbook stylesheet to get new cell styles.
• Users must supply an OpenAI API key (SystemCredential["OPENAI_API_KEY"]).
• The README highlights chat interaction, code generation, and in-place evaluation—key use cases the architecture must support.
Detail Without Overthinking
• Break the WD packages (Source/Chatbook/*.wl) into logical groups: State, UI, Services, PromptGenerators, Tools.
• Configuration directories (LLMConfiguration, VectorDatabases) as input to the kernel at startup.