55import tempfile
66import time
77from typing import Optional
8- import httpx
98
9+ import httpx
1010import pandas as pd
1111
1212from ... import Openlayer
@@ -22,6 +22,7 @@ def upload_batch_inferences(
2222 dataset_df : pd .DataFrame ,
2323 config : data_stream_params .Config ,
2424 storage_type : Optional [StorageType ] = None ,
25+ merge : bool = False ,
2526) -> None :
2627 """Uploads a batch of inferences to the Openlayer platform."""
2728 uploader = _upload .Uploader (client , storage_type )
@@ -61,6 +62,26 @@ def upload_batch_inferences(
6162 cast_to = httpx .Response ,
6263 body = {
6364 "storageUri" : presigned_url_response .storage_uri ,
64- "performDataMerge" : False ,
65+ "performDataMerge" : merge ,
6566 },
6667 )
68+
69+
70+ def update_batch_inferences (
71+ client : Openlayer ,
72+ inference_pipeline_id : str ,
73+ dataset_df : pd .DataFrame ,
74+ config : data_stream_params .Config ,
75+ storage_type : Optional [StorageType ] = None ,
76+ ) -> None :
77+ """Updates a batch of inferences on the Openlayer platform."""
78+ if config ["inference_id_column_name" ] is None :
79+ raise ValueError ("inference_id_column_name must be set in config" )
80+ upload_batch_inferences (
81+ client = client ,
82+ inference_pipeline_id = inference_pipeline_id ,
83+ dataset_df = dataset_df ,
84+ config = config ,
85+ storage_type = storage_type ,
86+ merge = True ,
87+ )
0 commit comments