def main():
    """
    Main function to parse arguments and process instrument codes.
    """
    # Set up argument parser
    parser = argparse.ArgumentParser(
        description="Process instrument codes 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(
        "--code-type",
        required=True,
        help="Type of code to generate (e.g., ISIN, CUSIP)",
    )
    parser.add_argument(
        "--output", required=True, help="Path to save the pickle file with codes"
    )
    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"
    )
    parser.add_argument(
        "--skip-confirmation",
        action="store_true",
        help="Skip confirmation of category options",
    )

    args = parser.parse_args()

    try:
        code_examples = {
            "ISIN": "US00846U1016",
            "CUSIP": "00846U101",
            "FIGI": "BBG000C2V541",
            "COMPOSITE_FIGI": "BBG000C2V3D6",
            "SHARECLASS_FIGI": "BBG001SCTQY4",
        }

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

        # Load existing categories
        code_dict = helpers.load_existing(args.output)

        # Process categories
        process_categories(
            dataset=filtered_dataset,
            symbol_column=args.symbol_column,
            name_column=args.name_column,
            summary_column=args.summary_column,
            code_type=args.code_type,
            code_example=code_examples[args.code_type],
            pickle_file_name=args.output,
            code_dict=code_dict,
            batch_size=args.batch_size,
            model=args.model,
        )
    except Exception as e:
        print(f"Error: {e}")
        sys.exit(1)

    Main function to parse arguments and process instrument codes.
    
parsers/codes_controller.py