Skip to content

Commit

Permalink
Fix error log to show the right agent type (#2809)
Browse files Browse the repository at this point in the history
Signed-off-by: Heng Qian <[email protected]>
  • Loading branch information
qianheng-aws authored Oct 21, 2024
1 parent 90bdd5c commit 1bbaddd
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ public void execute(Input input, ActionListener<Output> listener) {
(ConversationIndexMemory.Factory) memoryFactoryMap.get(memorySpec.getType());
conversationIndexMemoryFactory.create(question, memoryId, appType, ActionListener.wrap(memory -> {
inputDataSet.getParameters().put(MEMORY_ID, memory.getConversationId());
ActionListener<Object> agentActionListener = createAgentActionListener(listener, outputs, modelTensors);
ActionListener<Object> agentActionListener = createAgentActionListener(
listener,
outputs,
modelTensors,
mlAgent.getType()
);
// get question for regenerate
if (regenerateInteractionId != null) {
log.info("Regenerate for existing interaction {}", regenerateInteractionId);
Expand All @@ -161,7 +166,12 @@ public void execute(Input input, ActionListener<Output> listener) {
listener.onFailure(ex);
}));
} else {
ActionListener<Object> agentActionListener = createAgentActionListener(listener, outputs, modelTensors);
ActionListener<Object> agentActionListener = createAgentActionListener(
listener,
outputs,
modelTensors,
mlAgent.getType()
);
executeAgent(inputDataSet, mlAgent, agentActionListener);
}
}
Expand Down Expand Up @@ -235,7 +245,8 @@ private void executeAgent(RemoteInferenceInputDataSet inputDataSet, MLAgent mlAg
private ActionListener<Object> createAgentActionListener(
ActionListener<Output> listener,
List<ModelTensors> outputs,
List<ModelTensor> modelTensors
List<ModelTensor> modelTensors,
String agentType
) {
return ActionListener.wrap(output -> {
if (output != null) {
Expand Down Expand Up @@ -275,7 +286,7 @@ private ActionListener<Object> createAgentActionListener(
listener.onResponse(null);
}
}, ex -> {
log.error("Failed to run flow agent", ex);
log.error("Failed to run " + agentType + " agent", ex);
listener.onFailure(ex);
});
}
Expand Down

0 comments on commit 1bbaddd

Please sign in to comment.