unitypredict 1.1.79__tar.gz → 1.1.80__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unitypredict-1.1.79 → unitypredict-1.1.80}/PKG-INFO +1 -1
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict/UnityPredictClient.py +23 -3
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict.egg-info/PKG-INFO +1 -1
- {unitypredict-1.1.79 → unitypredict-1.1.80}/README.md +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/setup.cfg +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/setup.py +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict/__init__.py +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict.egg-info/SOURCES.txt +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict.egg-info/dependency_links.txt +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict.egg-info/requires.txt +0 -0
- {unitypredict-1.1.79 → unitypredict-1.1.80}/unitypredict.egg-info/top_level.txt +0 -0
|
@@ -57,19 +57,21 @@ class UnityPredictRequest:
|
|
|
57
57
|
InputValues (dict): A dictionary of input values for the model, where the key is the input variable name and the value of the variable's value.
|
|
58
58
|
DesiredOutcomes (list): A list of desired output variable names.
|
|
59
59
|
OutputFolderPath (str): The target path for saving model's output files (this is optional/not used if the model doesn't produce any output files).
|
|
60
|
+
CallbackUrl (str): (Optional) consumer-provided endpoint that will be involved (POST) with a copy of the InferenceResponse. Note: endpoint must be publicly accessible.
|
|
60
61
|
"""
|
|
61
62
|
|
|
62
63
|
ContextId: str = ''
|
|
63
64
|
InputValues: dict
|
|
64
65
|
DesiredOutcomes: list
|
|
65
66
|
OutputFolderPath: str
|
|
67
|
+
CallbackUrl: str = ''
|
|
66
68
|
|
|
67
|
-
def __init__(self, ContextId='', InputValues={}, DesiredOutcomes=[], OutputFolderPath=""):
|
|
69
|
+
def __init__(self, ContextId='', InputValues={}, DesiredOutcomes=[], OutputFolderPath="", CallbackUrl=''):
|
|
68
70
|
self.ContextId = ContextId
|
|
69
71
|
self.InputValues = InputValues
|
|
70
72
|
self.DesiredOutcomes = DesiredOutcomes
|
|
71
73
|
self.OutputFolderPath = OutputFolderPath
|
|
72
|
-
|
|
74
|
+
self.CallbackUrl = CallbackUrl
|
|
73
75
|
|
|
74
76
|
class UnityPredictResponse:
|
|
75
77
|
|
|
@@ -87,7 +89,10 @@ class UnityPredictResponse:
|
|
|
87
89
|
|
|
88
90
|
ContextId: str = ''
|
|
89
91
|
RequestId: str = ''
|
|
92
|
+
LogMessages: str = ''
|
|
90
93
|
ErrorMessages: str = ''
|
|
94
|
+
ComputeTime: str = ''
|
|
95
|
+
ComputeTimeCharged: str = ''
|
|
91
96
|
ComputeCost: float = 0.0
|
|
92
97
|
Outcomes: dict = {}
|
|
93
98
|
Status: str|None = None
|
|
@@ -108,7 +113,7 @@ class UnityPredictClient:
|
|
|
108
113
|
ApiMaxTimeout: int = 12 * 60 * 60
|
|
109
114
|
|
|
110
115
|
|
|
111
|
-
def __init__(self, apiKey, apiMaxTimeoutInSec = 12 * 60 * 60):
|
|
116
|
+
def __init__(self, apiKey, apiMaxTimeoutInSec = 12 * 60 * 60, apiEnv: str = 'prod', apiCustomUrl: str = ''):
|
|
112
117
|
|
|
113
118
|
"""
|
|
114
119
|
Initializes a UnityPredictClient instance.
|
|
@@ -117,6 +122,18 @@ class UnityPredictClient:
|
|
|
117
122
|
apiKey (str): The UnityPredict API key for authentication.
|
|
118
123
|
apiMaxTimeoutInSec (int, optional): The maximum wait time (in seconds) for synchronous responses. Defaults to 12 hours.
|
|
119
124
|
"""
|
|
125
|
+
|
|
126
|
+
if apiEnv.casefold() == 'prod':
|
|
127
|
+
self.ApiBaseUrl = 'https://api.prod.unitypredict.com/api'
|
|
128
|
+
elif apiEnv.casefold() == 'dev':
|
|
129
|
+
self.ApiBaseUrl = 'https://api.dev.unitypredict.net/api'
|
|
130
|
+
elif apiEnv.casefold() == 'custom':
|
|
131
|
+
if apiCustomUrl == '':
|
|
132
|
+
raise ValueError(f"Invalid API URL: {apiCustomUrl}")
|
|
133
|
+
self.ApiBaseUrl = apiCustomUrl
|
|
134
|
+
else:
|
|
135
|
+
raise ValueError(f"Invalid API environment: {apiEnv}")
|
|
136
|
+
|
|
120
137
|
self.ApiKey = f"APIKEY@{apiKey}"
|
|
121
138
|
self.ApiMaxTimeout = apiMaxTimeoutInSec
|
|
122
139
|
|
|
@@ -232,10 +249,13 @@ class UnityPredictClient:
|
|
|
232
249
|
|
|
233
250
|
try:
|
|
234
251
|
results.Status = finalResponseJson.get('status')
|
|
252
|
+
results.ComputeTime = finalResponseJson.get('computeTime')
|
|
253
|
+
results.ComputeTimeCharged = finalResponseJson.get('computeTimeCharged')
|
|
235
254
|
results.ComputeCost = finalResponseJson.get('computeCost')
|
|
236
255
|
results.Outcomes = outcomes
|
|
237
256
|
results.RequestId = finalResponseRequestId
|
|
238
257
|
results.ContextId = finalResponseJson.get('contextId')
|
|
258
|
+
results.LogMessages = finalResponseJson.get('logMessages')
|
|
239
259
|
results.ErrorMessages = finalResponseJson.get('errorMessages')
|
|
240
260
|
|
|
241
261
|
except Exception as e:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|