def main():
    """
    Main function to process instrument descriptions using command line arguments.

    Parses command line arguments, loads and filters the dataset, and processes
    descriptions using the Gemini AI model.
    """
    # Set up argument parser
    parser = argparse.ArgumentParser(
        description="Process instrument descriptions using Gemini AI"
    )
    parser.add_argument("--dataset", required=True, help="Path to CSV dataset file")
    parser.add_argument(
        "--symbol-column",
        required=False,
        default="symbol",
        help="Column name containing symbols/tickers",
    )
    parser.add_argument(
        "--name-column",
        required=False,
        default="name",
        help="Column name containing instrument names",
    )
    parser.add_argument(
        "--summary-column",
        required=False,
        default="summary",
        help="Column name containing summaries/descriptions",
    )
    parser.add_argument(
        "--process-all", required=False, action="store_true", help="Process all rows"
    )
    parser.add_argument(
        "--output", required=True, help="Path to save the pickle file with descriptions"
    )
    parser.add_argument(
        "--batch-size",
        type=int,
        default=100,
        help="Number of instruments to process in each batch",
    )
    parser.add_argument(
        "--model", default="gemini-2.0-flash", help="Gemini model to use"
    )

    args = parser.parse_args()

    try:
        # Load and filter dataset
        dataset = helpers.load_dataset(args.dataset)
        filtered_dataset = filter_dataset(
            dataset, args.summary_column, args.name_column, args.process_all
        )

        # Load existing descriptions
        descriptions_dict = helpers.load_existing(args.output)

        # Process descriptions
        process_descriptions(
            dataset=filtered_dataset,
            symbol_column=args.symbol_column,
            name_column=args.name_column,
            pickle_file_name=args.output,
            descriptions_dict=descriptions_dict,
            batch_size=args.batch_size,
            model=args.model,
        )

    except Exception as e:
        print(f"Error: {e}")
        sys.exit(1)

    Main function to process instrument descriptions using command line arguments.

    Parses command line arguments, loads and filters the dataset, and processes
    descriptions using the Gemini AI model.
    
parsers/descriptions_controller.py