How pro402/ai-report-generator works
Main Components
• User Interface: Represented by streamlit_app.py, which is the entry point for the interactive web interface where users input parameters and trigger the report generation workflow.
• Report Generation Engine: Represented by report_generator.py; this component handles the creation of outlines and compiling the final report content using AI models.
• Workflow Orchestrator: Represented by workflow.py; it implements the state graph workflow (powered by LangGraph) to manage multi-stage transitions from research to report compilation.
• Tools Module: Represented by tools.py; contains functions to perform deep research and specialized searches (e.g., general, finance, and news) by interfacing with the Tavily API.
• Data Models: Represented by models.py; it defines TypedDict-based data models for tracking Report and Research state throughout the generation process.
• External Services: Indicate integration with multiple external services such as:
• Tavily API for search functionality.
• ChatNVIDIA and LangChain for AI-powered content generation.
• Pandoc for markdown to PDF conversion (as mentioned in the README).
• Supporting Files: Configuration files (.env_example, .gitignore) and demo assets found in the demos directory that help illustrate workflow and functionality.
Relationships and Interactions
• User Interaction: The user engages with the system via the Streamlit UI, which collects parameters and initiates the workflow.
• Workflow Process: The input from the UI is passed on to the workflow module. The state graph in workflow.py defines various states (research, outline generation, content creation, and final assembly) and transitions for handling the report creation lifecycle.
• Handling Research: Within the workflow, the tools module (tools.py) is invoked to perform deep research by calling the Tavily API and possibly other specialized search endpoints.
• Report Composition: Once research data is fetched, report_generator.py processes and converts the data, leveraging AI models, to generate structured markdown reports.
• Data Flow: Models defined in models.py help maintain and pass structured data between these components thus enabling consistency.
Architectural Patterns and Design Principles
• Modular Separation: Emphasize a clear separation of concerns with dedicated modules for UI (streamlit_app.py), workflow coordination (workflow.py), business logic (report_generator.py), and external API integration (tools.py).
• State Graph Workflow: Illustrate the state transition mechanism managed by LangGraph—for instance, how states move from research initiation to content generation and final report output.
• Extensibility: Note that the system is designed for customization. The modular design makes it easier to extend or refine the workflow (e.g., adding new research steps or more data sources).