Skip to content

Commit

Permalink
Complete TODOs now that upstream is merged
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Oct 21, 2024
1 parent bf69c7a commit ee9e545
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public PlainActionFuture<WorkflowData> execute(
outputs,
toolParameterKeys
);
@SuppressWarnings("unchecked")
Map<String, String> config = (Map<String, String>) inputs.getOrDefault(CONFIG_FIELD, Collections.emptyMap());

MLToolSpec.MLToolSpecBuilder builder = MLToolSpec.builder();
Expand All @@ -105,8 +106,7 @@ public PlainActionFuture<WorkflowData> execute(
if (includeOutputInAgentResponse != null) {
builder.includeOutputInAgentResponse(includeOutputInAgentResponse);
}
// TODO https://github.com/opensearch-project/ml-commons/pull/2977/files must be merged for this to compile
// builder.configMap(config);
builder.configMap(config);

MLToolSpec mlToolSpec = builder.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ public void setUp() throws Exception {
this.flowFrameworkIndicesHandler = mock(FlowFrameworkIndicesHandler.class);
MockitoAnnotations.openMocks(this);

MLToolSpec tools = new MLToolSpec("tool1", "CatIndexTool", "desc", Collections.emptyMap(), false);
MLToolSpec tools = MLToolSpec.builder()
.type("tool1")
.name("CatIndexTool")
.description("desc")
.parameters(Collections.emptyMap())
.includeOutputInAgentResponse(false)
.build();

LLMSpec llmSpec = new LLMSpec("xyz", Collections.emptyMap());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public void testTool() throws ExecutionException, InterruptedException {
);
assertTrue(future.isDone());
assertEquals(MLToolSpec.class, future.get().getContent().get("tools").getClass());
// TODO https://github.com/opensearch-project/ml-commons/pull/2977/files must be merged for this to compile
// assertEquals(Map.of("foo", "bar"), ((MLToolSpec) future.get().getContent().get("tools")).getConfigMap());
assertEquals(Map.of("foo", "bar"), ((MLToolSpec) future.get().getContent().get("tools")).getConfigMap());
}

public void testBoolParseFail() {
Expand Down

0 comments on commit ee9e545

Please sign in to comment.