Skip to content

Commit

Permalink
add register connector
Browse files Browse the repository at this point in the history
Signed-off-by: zhichao-aws <[email protected]>
  • Loading branch information
zhichao-aws committed Dec 29, 2023
1 parent d6fc397 commit 90fb110
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/test/java/org/opensearch/integTest/BaseAgentToolsIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.ml.common.MLModel;
import org.opensearch.ml.common.MLTask;
import org.opensearch.ml.common.MLTaskState;
import org.opensearch.ml.common.input.execute.agent.AgentMLInput;
Expand Down Expand Up @@ -90,6 +91,12 @@ private Object parseFieldFromResponse(Response response, String field) {
return result;
}

protected String createConnector(String requestBody) {
Response response = makeRequest(client(), "POST", "/_plugins/_ml/connectors/_create", null, requestBody, null);
assertEquals(RestStatus.OK, RestStatus.fromCode(response.getStatusLine().getStatusCode()));
return parseFieldFromResponse(response, MLModel.CONNECTOR_ID_FIELD).toString();
}

protected String registerModel(String requestBody) {
Response response = makeRequest(client(), "POST", "/_plugins/_ml/models/_register", null, requestBody, null);
assertEquals(RestStatus.OK, RestStatus.fromCode(response.getStatusLine().getStatusCode()));
Expand Down

0 comments on commit 90fb110

Please sign in to comment.