5
5
import tempfile
6
6
import time
7
7
from typing import Optional
8
- import httpx
9
8
9
+ import httpx
10
10
import pandas as pd
11
11
12
12
from ... import Openlayer
@@ -22,6 +22,7 @@ def upload_batch_inferences(
22
22
dataset_df : pd .DataFrame ,
23
23
config : data_stream_params .Config ,
24
24
storage_type : Optional [StorageType ] = None ,
25
+ merge : bool = False ,
25
26
) -> None :
26
27
"""Uploads a batch of inferences to the Openlayer platform."""
27
28
uploader = _upload .Uploader (client , storage_type )
@@ -61,6 +62,26 @@ def upload_batch_inferences(
61
62
cast_to = httpx .Response ,
62
63
body = {
63
64
"storageUri" : presigned_url_response .storage_uri ,
64
- "performDataMerge" : False ,
65
+ "performDataMerge" : merge ,
65
66
},
66
67
)
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