Skip to content

Commit

Permalink
add java doc for function
Browse files Browse the repository at this point in the history
Signed-off-by: xinyual <[email protected]>
  • Loading branch information
xinyual committed Dec 9, 2024
1 parent 411dc73 commit e29c011
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ public AgentModelsSearcher(Map<String, Tool.Factory> toolFactories) {
}
}

public SearchRequest constructQueryRequestToSearchModelId(String candidateModelId) {
/**
* Construct a should query to search all agent which containing candidate model Id
@param candidateModelId the candidate model Id
@return a should search request towards agent index.
*/
public SearchRequest constructQueryRequestToSearchModelIdInsideAgent(String candidateModelId) {
SearchRequest searchRequest = new SearchRequest(ML_AGENT_INDEX);
BoolQueryBuilder shouldQuery = QueryBuilders.boolQuery();
for (String keyField : relatedModelIdSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public void onFailure(Exception e) {

private void checkAgentBeforeDeleteModel(String modelId, ActionListener<Boolean> actionListener) {
// check whether agent are using them
SearchRequest searchAgentRequest = agentModelsSearcher.constructQueryRequestToSearchModelId(modelId);
SearchRequest searchAgentRequest = agentModelsSearcher.constructQueryRequestToSearchModelIdInsideAgent(modelId);
client.search(searchAgentRequest, ActionListener.wrap(searchResponse -> {
SearchHit[] searchHits = searchResponse.getHits().getHits();
if (searchHits.length == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ private void prepare() throws IOException {
}).when(client).execute(eq(GetSearchPipelineAction.INSTANCE), any(), any());
configDataMap = Map
.of("single_model_id", "test_id", "list_model_id", List.of("test_id"), "test_map_id", Map.of("model_id", "test_id"));
doAnswer(invocation -> new SearchRequest()).when(agentModelsSearcher).constructQueryRequestToSearchModelId(any());
doAnswer(invocation -> new SearchRequest()).when(agentModelsSearcher).constructQueryRequestToSearchModelIdInsideAgent(any());

GetResponse getResponse = prepareMLModel(MLModelState.REGISTERED, null, false);
doAnswer(invocation -> {
Expand Down

0 comments on commit e29c011

Please sign in to comment.