Skip to content

Commit

Permalink
Addressing PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Owais Kazi <[email protected]>
  • Loading branch information
owaiskazi19 committed Nov 29, 2023
1 parent 7243fab commit 18e331e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
import static org.opensearch.flowframework.common.CommonValue.LLM_FIELD;
import static org.opensearch.flowframework.util.ParseUtils.buildLLMMap;
import static org.opensearch.flowframework.util.ParseUtils.buildStringToStringMap;
import static org.opensearch.flowframework.util.ParseUtils.parseStringToStringMap;
import static org.opensearch.flowframework.util.ParseUtils.*;

/**
* This represents a process node (step) in a workflow graph in the {@link Template}.
Expand Down Expand Up @@ -100,7 +98,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
}
}
xContentBuilder.endArray();
} else if (e.getValue() instanceof Object) {
} else if (e.getValue() instanceof LLMSpec) {
if (LLM_FIELD.equals(e.getKey())) {
xContentBuilder.startObject();
buildLLMMap(xContentBuilder, (LLMSpec) e.getValue());
Expand Down Expand Up @@ -150,7 +148,7 @@ public static WorkflowNode parse(XContentParser parser) throws IOException {
break;
case START_OBJECT:
if (LLM_FIELD.equals(inputFieldName)) {
userInputs.put(inputFieldName, LLMSpec.parse(parser));
userInputs.put(inputFieldName, parseLLM(parser));
} else {
userInputs.put(inputFieldName, parseStringToStringMap(parser));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public CompletableFuture<WorkflowData> execute(List<WorkflowData> data) throws I

MLToolSpec mlToolSpec = builder.build();

toolFuture.complete(new WorkflowData(Map.ofEntries(Map.entry(TOOLS_FIELD, mlToolSpec))));
toolFuture.complete(new WorkflowData(Map.ofEntries(Map.entry(TOOLS_FIELD, mlToolSpec)), data.get(0).getWorkflowId()));
}

logger.info("Tool registered successfully {}", type);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mappings/workflow-steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"agent_id"
]
},
"tool": {
"create_tool": {
"inputs": [
"type"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void setUp() throws Exception {
Map.entry("created_time", 1689793598499L),
Map.entry("last_updated_time", 1689793598499L),
Map.entry("app_type", "app")
)
),
"test-id"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public void setUp() throws Exception {
Map.entry("description", "description"),
Map.entry("parameters", Collections.emptyMap()),
Map.entry("include_output_in_agent_response", false)
)
),
"test-id"
);
}

Expand Down

0 comments on commit 18e331e

Please sign in to comment.