@@ -325,6 +325,49 @@ def bulk_update(
325325 logger .info (f"Bulk update complete: { json .dumps (summary_results )} " )
326326
327327
328+ # Bulk update existing records with embeddings commands
329+
330+
331+ @main .command ()
332+ @click .option (
333+ "-i" ,
334+ "--index" ,
335+ help = "Name of the index where the bulk update to add embeddings is performed." ,
336+ )
337+ @click .option (
338+ "-s" ,
339+ "--source" ,
340+ type = click .Choice (VALID_SOURCES ),
341+ help = (
342+ "Source whose primary-aliased index will receive the bulk updated "
343+ "records with embeddings."
344+ ),
345+ )
346+ @click .option ("-rid" , "--run-id" , help = "Run ID." )
347+ @click .argument ("dataset_path" , type = click .Path ())
348+ @click .pass_context
349+ def bulk_update_embeddings (
350+ ctx : click .Context , index : str , source : str , run_id : str , dataset_path : str
351+ ):
352+ client = ctx .obj ["CLIENT" ]
353+ index = helpers .validate_bulk_cli_options (index , source , client )
354+
355+ logger .info (
356+ f"Bulk updating records with embeddings from dataset '{ dataset_path } ' into '{ index } '"
357+ )
358+
359+ update_results = {"updated" : 0 , "errors" : 0 , "total" : 0 }
360+
361+ td = TIMDEXDataset (location = dataset_path )
362+
363+ # TODO: update TDA to read embeddings
364+
365+ try :
366+ update_results .update (tim_os .bulk_index (client , index , records_to_index ))
367+ except BulkIndexingError as exception :
368+ logger .info (f"Bulk indexing failed: { exception } " )
369+
370+
328371@main .command ()
329372@click .option (
330373 "-s" ,
0 commit comments