@@ -18,6 +18,7 @@ def inference(
18
18
skill_id = None ,
19
19
intent_to_action_mapping = None ,
20
20
timeout = 1 ,
21
+ environment_id = None ,
21
22
):
22
23
"""
23
24
query the message api to generate results on the test data
@@ -29,6 +30,7 @@ def inference(
29
30
:parameter: assistant_id:
30
31
:parameter: intent_to_action_mapping:
31
32
:parameter: timeout: integer or float that specifies number of seconds each thread should wait for inference result
33
+ :parameter: environment_id: environment id
32
34
:return result_df: results dataframe
33
35
"""
34
36
skd_version = "V1"
@@ -54,6 +56,7 @@ def inference(
54
56
user_id = user_id ,
55
57
assistant_id = assistant_id ,
56
58
skill_id = skill_id ,
59
+ environment_id = environment_id ,
57
60
)
58
61
time .sleep (0.3 )
59
62
@@ -118,6 +121,7 @@ def inference(
118
121
assistant_id = assistant_id ,
119
122
intent_to_action_mapping = intent_to_action_mapping ,
120
123
timeout = timeout ,
124
+ environment_id = environment_id ,
121
125
)
122
126
return result_df
123
127
@@ -131,6 +135,7 @@ def thread_inference(
131
135
skill_id = None ,
132
136
intent_to_action_mapping = None ,
133
137
timeout = 1 ,
138
+ environment_id = None ,
134
139
):
135
140
"""
136
141
Perform multi thread inference for faster inference time
@@ -143,6 +148,7 @@ def thread_inference(
143
148
:param assistant_id:
144
149
:parameter: intent_to_action_mapping:
145
150
:parameter: timeout: integer or float that specifies number of seconds each thread should wait for inference result
151
+ :parameter: environment_id: environment id
146
152
:return result_df: results dataframe
147
153
"""
148
154
if isinstance (conversation , ibm_watson .AssistantV1 ):
@@ -162,6 +168,7 @@ def thread_inference(
162
168
user_id = user_id ,
163
169
assistant_id = assistant_id ,
164
170
skill_id = skill_id ,
171
+ environment_id = environment_id ,
165
172
)
166
173
except Exception :
167
174
count += 1
@@ -179,6 +186,7 @@ def thread_inference(
179
186
user_id = user_id ,
180
187
assistant_id = assistant_id ,
181
188
skill_id = skill_id ,
189
+ environment_id = environment_id ,
182
190
retry = 0 ,
183
191
)
184
192
futures [future ] = (test_example , ground_truth )
@@ -248,6 +256,7 @@ def get_intent_confidence_retry(
248
256
user_id ,
249
257
assistant_id ,
250
258
skill_id ,
259
+ environment_id ,
251
260
retry = 0 ,
252
261
):
253
262
try :
@@ -258,6 +267,7 @@ def get_intent_confidence_retry(
258
267
user_id = user_id ,
259
268
assistant_id = assistant_id ,
260
269
skill_id = skill_id ,
270
+ environment_id = environment_id ,
261
271
)
262
272
except Exception as e :
263
273
if retry < MAX_RETRY :
@@ -268,6 +278,7 @@ def get_intent_confidence_retry(
268
278
user_id ,
269
279
assistant_id ,
270
280
skill_id ,
281
+ environment_id = environment_id ,
271
282
retry = retry + 1 ,
272
283
)
273
284
else :
0 commit comments