Skip to content

Commit 62798f0

Browse files
committed
add wrapper for function endpoint
1 parent 5509911 commit 62798f0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

dataikuapi/apinode_client.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,16 @@ def predict_records(self, endpoint_id, records, forced_generation=None, dispatch
6565
elif dispatch_key is not None:
6666
obj["dispatch"] = {"dispatchKey" : dispatch_key }
6767

68-
return self._perform_json("POST", "%s/predict-multi" % endpoint_id, body = obj)
68+
return self._perform_json("POST", "%s/predict-multi" % endpoint_id, body = obj)
69+
70+
def apply_on_record(self, endpoint_id, features):
71+
"""
72+
Applies a function on a single record on a DSS API node endpoint (Python or R function)
73+
74+
:param str endpoint_id: Identifier of the endpoint to query
75+
:param features: Python dictionary of features of the record
76+
77+
:return: a Python dict of the API answer. The answer contains a "result" key (itself a dict)
78+
"""
79+
return self._perform_json("POST", "%s/run" % endpoint_id, body = features)
80+

0 commit comments

Comments
 (0)