from dataclasses import dataclass from pathlib import Path from typing import List @dataclass(frozen=True) class OllamaConfig: """Configuration for Ollama client.""" model: str server_url: str timeout: int max_retries: int @dataclass(frozen=True) class ReviewConfig: """Complete configuration for ReviewLlama.""" paths: List[Path] ollama: OllamaConfig base_branch: str def create_ollama_config( model: str, server_url: str, timeout: int, max_retries: int ) -> OllamaConfig: """Create OllamaConfig with validated parameters.""" return OllamaConfig( model=model, server_url=server_url, timeout=timeout, max_retries=max_retries, ) def create_review_config( paths: List[Path], ollama_config: OllamaConfig, base_branch: str ) -> ReviewConfig: """Create complete ReviewConfig from validated components.""" return ReviewConfig(paths=paths, ollama=ollama_config, base_branch=base_branch) def create_config_from_vars( paths: List[Path], model: str, server_url: str, timeout: int, max_retries: int, base_branch: str, ): ollama_config = OllamaConfig( model=model, server_url=server_url, timeout=timeout, max_retries=max_retries, ) return create_review_config(paths, ollama_config, base_branch)