How hanoi0126/ai-paper-summarizer works
The AI Paper Summarizer project is a full-stack application tailored to process research papers and technical documents by summarizing them using LLM-based natural language processing. These summaries are then sent to Slack and saved in a Notion database, making the application an integration of text processing, external service communication, and serverless execution (via AWS Lambda).
Project Identification and Core Purpose
• This is an AI-powered summarization tool focused on research papers.
• Primary functions include summarizing documents (using an LLM), sending results through Slack (chat and post interactions), and recording results in a Notion database.
• The presence of a lambda_function.py and GitHub workflows (including lambda_deploy) indicates deployment as a serverless function on AWS Lambda.
File Structure and Its Architectural Implications
• Top-level directories/files include configuration (pyproject.toml, requirements.txt, Makefile), CI/CD scripts, and a clean separation between source code (src) and tests.
• The src directory is organized by layer:
• application: Contains the Slack handler, acting as the entry point for Slack messages.
• domain: Holds models and services – this is where core business logic and summarization service sit.
• infrastructure: Implements integration with external systems. It is subdivided into:
▪ file_downloader: Likely for retrieving remote documents.
▪ llm: Contains types, the main LLM integration for summarization, and utility functions.
▪ notion: Manages interaction with Notion’s API.
▪ slack: Manages lower-level Slack integration.
• dependency_injector: Indicates use of dependency injection to manage and decouple component responsibilities.
• The tests directory supports unit testing for validating core logic.
Breakdown of Main Components
a. External Clients & Communication:
• Slack: Classify as both an input (paper submission, Q&A messages) and output (summary delivery) channel.
• Notion: Mark as the external service for storing summary results.
• End User: Represent researchers or users interacting via Slack.
b. Application Layer:
• Slack Handler: Acts as the first receiver of Slack messages.
• Lambda Function: Deployment unit indicating serverless execution (likely triggered by Slack events).
c. Domain Layer:
• Summarization Service: Where the business logic for processing paper content takes place, leveraging LLM integration.
• Domain Models: Represent the information structure and summary objects.
d. Infrastructure Layer:
• File Downloader: Retrieves stored or linked document content.
• LLM Module: Handles communication with the large language model and processes tasks such as summarization.
• Slack Module (under infrastructure): Low-level operations for posting messages and handling Slack API interactions.
• Notion Module: Manages API communication with the Notion database.
e. Dependency Management:
• Dependency Injector: Coordinates and provides dependencies for different modules ensuring decoupling.
Relationships & Data Flows
• Data enters via Slack (user posts a paper for summarization).
• The Slack handler in the application layer receives the input, and the request flows toward the domain layer service.
• The summarization service calls on the LLM module to generate a summary.
• The result is then routed via the infrastructure layer:
• Sending summary back to Slack for immediate feedback.
• Saving detailed summary data to a Notion database.
• Auxiliary flows include retrieving documents via the file_downloader if needed.
• Deployment and orchestration are managed via AWS Lambda (lambda_function.py) and automated CI/CD workflows via GitHub Actions.
Architectural Patterns and Design Principles
• Clear separation of Concerns: Application, Domain, and Infrastructure layers.
• Dependency Injection: Managed by the dependency_injector module which enhances modularity and testability.
• Serverless Architecture: Lambda deployment supports scalability and cost efficiency.
• External API Integration: Both Slack and Notion are integrated as external services with dedicated infrastructure modules.