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]>
(cherry picked from commit 1bbaddd)
  • Loading branch information
qianheng-aws authored and github-actions[bot] committed Oct 21, 2024
1 parent 09aa6ea commit f129ae3
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 f129ae3

Please sign in to comment.