generate.py

Code Hygiene Score: 75

Issues 1

Zeile Typ Beschreibung
- coupling Klasse hat 24 Dependencies (max: 15)

Dependencies 24

Code

#!/usr/bin/env python3
"""
Content Generation for KI-System - Wrapper Module.

This module provides backward compatibility by re-exporting all functions
from the generators subpackage. New code should import directly from generators.

Refactored for SRP compliance - see generators/ for implementation.
"""

import json
import sys

from generators import (
    build_generation_prompt,
    call_llm,
    generate_content,
    get_author_profile,
    get_config_item,
    get_contract,
    get_critic,
    get_order,
    get_prompt,
    get_rag_context,
    get_semantic_context,
    get_structure,
    get_taxonomy_context,
    revise_content,
    run_critic,
    run_critique_round,
    save_sources,
    save_version,
    update_order_status,
)

# Re-export all public functions from generators package
from generators import (
    repair_json as _repair_json,
)

# Also export config_loader parsers with original names for backward compatibility
from generators.config_loader import parse_author_profile as _parse_new_author_profile
from generators.config_loader import parse_structure as _parse_new_structure

__all__ = [
    "_repair_json",
    "get_rag_context",
    "get_semantic_context",
    "get_taxonomy_context",
    "get_prompt",
    "get_config_item",
    "get_author_profile",
    "get_contract",
    "get_structure",
    "get_order",
    "_parse_new_author_profile",
    "_parse_new_structure",
    "build_generation_prompt",
    "call_llm",
    "generate_content",
    "save_version",
    "save_sources",
    "update_order_status",
    "get_critic",
    "run_critic",
    "run_critique_round",
    "revise_content",
]


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: python generate.py <command> <id> [options]")
        print("Commands: generate, critique, revise")
        sys.exit(1)

    command = sys.argv[1]
    entity_id = int(sys.argv[2])
    model = sys.argv[3] if len(sys.argv) > 3 else "anthropic"

    if command == "generate":
        result = generate_content(entity_id, model=model)
    elif command == "critique":
        result = run_critique_round(entity_id, model=model)
    elif command == "revise":
        result = revise_content(entity_id, model=model)
    else:
        print(f"Unknown command: {command}")
        sys.exit(1)

    print(json.dumps(result, ensure_ascii=False, indent=2))
← Übersicht