import os

from huggingface_hub import snapshot_download

from app.config import PROJECT_ROOT


def download_model():
    """
    Downloads the 'sentence-transformers/multi-qa-mpnet-base-dot-v1' model
    to the models/ directory in project root.
    """
    # Ensure the directory exists

    model_id = "sentence-transformers/multi-qa-mpnet-base-dot-v1"

    local_dir = PROJECT_ROOT / "models/multi-qa-mpnet-base-dot-v1"
    os.makedirs(local_dir, exist_ok=True)

    print(f"Downloading {model_id} to {local_dir}...")

    snapshot_download(
        repo_id=model_id,
        local_dir=local_dir,
    )

    print("Model download complete.")


if __name__ == "__main__":
    download_model()
