How jeff14994/summary-llm works
Main Components
• Summarizer Module: The core logic is encapsulated in several modules:
• html_extractor.py: Handles fetching and parsing HTML content.
• prompt_builder.py: Constructs prompts for the LLM.
• local_llm.py: Interfaces with the local Ollama LLM for inference.
• output_formatter.py: Formats the LLM output into structured JSON summaries.
• Main Application Layers:
• CLI-based main execution via main.py (and main1.py, if applicable).
• API Server via api_server.py: Provides REST endpoints for summarization, including health checks and Swagger documentation.
• Configuration and Environment:
• The .env file holds key configuration parameters (e.g., LLM model, timeouts, output directories).
• Testing Suite: The tests directory includes unit tests for each major component.
• Deployment Infrastructure: Docker support is provided, meaning you have a Dockerfile and instructions to containerize the app.
Out Relationships and Interactions
• Data Flow:
• For CLI usage: The user provides a URL to main.py → html_extractor fetches HTML → prompt_builder constructs a prompt → local_llm generates summaries → output_formatter creates the final JSON output.
• For API usage: A POST to /summarize on the REST API triggers a similar flow, where api_server.py orchestrates the call to the summarizer module.
• External Dependencies:
• The project depends on the local Ollama runtime for LLM inference.
• Docker serves as a containerization technology for deployment.
Architectural Patterns & Design Principles
• Modularity: Clear separation of concerns among the modules (extractor, builder, inference, and formatter).
• API Layer: The REST API server abstracts the summarization service for external integrations.
• Configurability: Environment variables (.env) allow the behavior of the summarizer to be customized.
• Testing: The test suite ensures component reliability.
Relevant Technologies
• Python 3.9+ for coding.
• Docker for containerization.
• Ollama for local LLM inference.
• REST API documentation tools (Swagger, ReDoc) available in the API server.