15
15
import org .apache .hc .core5 .http .HttpHeaders ;
16
16
import org .apache .hc .core5 .http .message .BasicHeader ;
17
17
import org .junit .Before ;
18
+ import org .junit .Ignore ;
18
19
import org .junit .Rule ;
19
20
import org .junit .rules .ExpectedException ;
20
21
import org .opensearch .client .Response ;
@@ -171,19 +172,6 @@ public void testSearchMLTasks_afterCreation() throws IOException {
171
172
assertEquals ((Double ) 1.0 , (Double ) ((Map ) ((Map ) responseMap .get ("hits" )).get ("total" )).get ("value" ));
172
173
}
173
174
174
- public void testRegisterRemoteModel () throws IOException , InterruptedException {
175
- Response response = createConnector (completionModelConnectorEntity );
176
- Map responseMap = parseResponseToMap (response );
177
- String connectorId = (String ) responseMap .get ("connector_id" );
178
- response = registerRemoteModel ("openAI-GPT-3.5 completions" , connectorId );
179
- responseMap = parseResponseToMap (response );
180
- String taskId = (String ) responseMap .get ("task_id" );
181
- waitForTask (taskId , MLTaskState .COMPLETED );
182
- response = getTask (taskId );
183
- responseMap = parseResponseToMap (response );
184
- assertNotNull (responseMap .get ("model_id" ));
185
- }
186
-
187
175
public void testDeployRemoteModel () throws IOException , InterruptedException {
188
176
Response response = createConnector (completionModelConnectorEntity );
189
177
Map responseMap = parseResponseToMap (response );
@@ -202,42 +190,6 @@ public void testDeployRemoteModel() throws IOException, InterruptedException {
202
190
waitForTask (taskId , MLTaskState .COMPLETED );
203
191
}
204
192
205
- public void testPredictRemoteModel () throws IOException , InterruptedException {
206
- // Skip test if key is null
207
- if (OPENAI_KEY == null ) {
208
- return ;
209
- }
210
- Response response = createConnector (completionModelConnectorEntity );
211
- Map responseMap = parseResponseToMap (response );
212
- String connectorId = (String ) responseMap .get ("connector_id" );
213
- response = registerRemoteModel ("openAI-GPT-3.5 completions" , connectorId );
214
- responseMap = parseResponseToMap (response );
215
- String taskId = (String ) responseMap .get ("task_id" );
216
- waitForTask (taskId , MLTaskState .COMPLETED );
217
- response = getTask (taskId );
218
- responseMap = parseResponseToMap (response );
219
- String modelId = (String ) responseMap .get ("model_id" );
220
- response = deployRemoteModel (modelId );
221
- responseMap = parseResponseToMap (response );
222
- taskId = (String ) responseMap .get ("task_id" );
223
- waitForTask (taskId , MLTaskState .COMPLETED );
224
- String predictInput = "{\n " + " \" parameters\" : {\n " + " \" prompt\" : \" Say this is a test\" \n " + " }\n " + "}" ;
225
- response = predictRemoteModel (modelId , predictInput );
226
- responseMap = parseResponseToMap (response );
227
- List responseList = (List ) responseMap .get ("inference_results" );
228
- responseMap = (Map ) responseList .get (0 );
229
- responseList = (List ) responseMap .get ("output" );
230
- responseMap = (Map ) responseList .get (0 );
231
- responseMap = (Map ) responseMap .get ("dataAsMap" );
232
- responseList = (List ) responseMap .get ("choices" );
233
- if (responseList == null ) {
234
- assertTrue (checkThrottlingOpenAI (responseMap ));
235
- return ;
236
- }
237
- responseMap = (Map ) responseList .get (0 );
238
- assertFalse (((String ) responseMap .get ("text" )).isEmpty ());
239
- }
240
-
241
193
public void testPredictWithAutoDeployAndTTL_RemoteModel () throws IOException , InterruptedException {
242
194
// Skip test if key is null
243
195
if (OPENAI_KEY == null ) {
@@ -335,26 +287,6 @@ public void testPredictRemoteModelWithWrongOutputInterface() throws IOException,
335
287
});
336
288
}
337
289
338
- public void testUndeployRemoteModel () throws IOException , InterruptedException {
339
- Response response = createConnector (completionModelConnectorEntity );
340
- Map responseMap = parseResponseToMap (response );
341
- String connectorId = (String ) responseMap .get ("connector_id" );
342
- response = registerRemoteModel ("openAI-GPT-3.5 completions" , connectorId );
343
- responseMap = parseResponseToMap (response );
344
- String taskId = (String ) responseMap .get ("task_id" );
345
- waitForTask (taskId , MLTaskState .COMPLETED );
346
- response = getTask (taskId );
347
- responseMap = parseResponseToMap (response );
348
- String modelId = (String ) responseMap .get ("model_id" );
349
- response = deployRemoteModel (modelId );
350
- responseMap = parseResponseToMap (response );
351
- taskId = (String ) responseMap .get ("task_id" );
352
- waitForTask (taskId , MLTaskState .COMPLETED );
353
- response = undeployRemoteModel (modelId );
354
- responseMap = parseResponseToMap (response );
355
- assertTrue (responseMap .toString ().contains ("undeployed" ));
356
- }
357
-
358
290
public void testOpenAIChatCompletionModel () throws IOException , InterruptedException {
359
291
// Skip test if key is null
360
292
if (OPENAI_KEY == null ) {
@@ -418,8 +350,12 @@ public void testOpenAIChatCompletionModel() throws IOException, InterruptedExcep
418
350
responseMap = parseResponseToMap (response );
419
351
// TODO handle throttling error
420
352
assertNotNull (responseMap );
421
- }
422
353
354
+ response = undeployRemoteModel (modelId );
355
+ responseMap = parseResponseToMap (response );
356
+ assertTrue (responseMap .toString ().contains ("undeployed" ));
357
+ }
358
+ @ Ignore
423
359
public void testOpenAIEditsModel () throws IOException , InterruptedException {
424
360
// Skip test if key is null
425
361
if (OPENAI_KEY == null ) {
@@ -490,7 +426,7 @@ public void testOpenAIEditsModel() throws IOException, InterruptedException {
490
426
491
427
assertFalse (((String ) responseMap .get ("content" )).isEmpty ());
492
428
}
493
-
429
+ @ Ignore
494
430
public void testOpenAIModerationsModel () throws IOException , InterruptedException {
495
431
// Skip test if key is null
496
432
if (OPENAI_KEY == null ) {
@@ -720,7 +656,7 @@ public void testCohereGenerateTextModel() throws IOException, InterruptedExcepti
720
656
responseMap = (Map ) responseList .get (0 );
721
657
assertFalse (((String ) responseMap .get ("text" )).isEmpty ());
722
658
}
723
-
659
+ @ Ignore
724
660
public void testCohereClassifyModel () throws IOException , InterruptedException {
725
661
// Skip test if key is null
726
662
if (COHERE_KEY == null ) {
0 commit comments