diff --git a/kb_pipeline/schemas.py b/kb_pipeline/schemas.py index e05aa7b..5553917 100644 --- a/kb_pipeline/schemas.py +++ b/kb_pipeline/schemas.py @@ -9,6 +9,7 @@ from pydantic import BaseModel, Field from typing import Optional, Dict, Literal, Any, List from datetime import datetime from enum import Enum +from pathlib import Path class StepStatus(str, Enum): @@ -353,3 +354,54 @@ class AnalyzeOutput(StepOutput): key_insights: List[str] = Field(default_factory=list, description="Key insights") tags: List[str] = Field(default_factory=list, description="Recommended tags") stats: Dict[str, Any] = Field(default_factory=dict, description="Statistics about analysis") + + +# ============================================================================= +# Pipeline Schemas (Phase 04-04) +# ============================================================================= + + +class PipelineInput(BaseModel): + """Pipeline input - URL to process + + Attributes: + url: URL to process (required) + output_dir: Optional output directory for content + skip_completed: Skip already completed steps (default True) + """ + url: str = Field(..., min_length=1, description="URL to process") + output_dir: Optional[Path] = Field(None, description="Output directory for content") + skip_completed: bool = Field(default=True, description="Skip already completed steps") + + +class PipelineOutput(BaseModel): + """Pipeline output - results from all steps + + Attributes: + success: Whether the pipeline completed successfully + error_message: Error message if pipeline failed + results: Dictionary of results from each step + content_dir: Path to the content directory + """ + success: bool = Field(..., description="Whether the pipeline completed successfully") + error_message: Optional[str] = Field(None, description="Error message if pipeline failed") + results: Dict[str, Any] = Field(default_factory=dict, description="Results from each step") + content_dir: Optional[Path] = Field(None, description="Path to the content directory") + + +class PipelineConfig(BaseModel): + """Pipeline configuration + + Attributes: + steps: Steps to execute in order (default: parse, download, asr, analyze) + output_dir: Base output directory + skip_completed: Skip completed steps (default True) + max_retries: Max retries per step (default 3) + """ + steps: List[str] = Field( + default_factory=lambda: ["parse", "download", "asr", "analyze"], + description="Steps to execute in order" + ) + output_dir: Optional[Path] = Field(None, description="Base output directory") + skip_completed: bool = Field(default=True, description="Skip completed steps") + max_retries: int = Field(default=3, description="Max retries per step")