Skip to content

Commit

Permalink
Making memory and llm spec optional fields
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Palis <jpalis@amazon.com>
  • Loading branch information
joshpalis committed Jan 10, 2024
1 parent 815a74e commit 062745b
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,16 @@ public void onFailure(Exception e) {
if (description != null) {
builder.description(description);
}
if (memory != null) {
builder.memory(memory);
}
if (llmSpec != null) {
builder.llm(llmSpec);
}

builder.type(type)
.llm(llmSpec)
.tools(toolsList)
.parameters(parameters)
.memory(memory)
.createdTime(createdTime)
.lastUpdateTime(lastUpdateTime)
.appType(appType);
Expand Down Expand Up @@ -264,10 +268,7 @@ private String getLlmModelId(Map<String, String> previousNodeInputs, Map<String,

private LLMSpec getLLMSpec(String llmModelId, Map<String, String> llmParameters, String workflowId, String currentNodeId) {
if (llmModelId == null) {
throw new FlowFrameworkException(
"model id for llm is null for workflow: " + workflowId + " on node: " + currentNodeId,
RestStatus.BAD_REQUEST
);
return null;

Check warning on line 271 in src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java#L271

Added line #L271 was not covered by tests
}
LLMSpec.LLMSpecBuilder builder = LLMSpec.builder();
builder.modelId(llmModelId);
Expand All @@ -279,6 +280,9 @@ private LLMSpec getLLMSpec(String llmModelId, Map<String, String> llmParameters,
}

private MLMemorySpec getMLMemorySpec(Object mlMemory) {
if (mlMemory == null) {
return null;

Check warning on line 284 in src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/flowframework/workflow/RegisterAgentStep.java#L284

Added line #L284 was not covered by tests
}

Map<?, ?> map = (Map<?, ?>) mlMemory;
String type = null;
Expand Down

0 comments on commit 062745b

Please sign in to comment.