feat: add finish reason indicators for completion statuses in BaseAgent

This commit is contained in:
extio-de
2026-05-10 09:48:04 +02:00
parent 640b075fe6
commit b5a43ef7ac
2 changed files with 21 additions and 0 deletions

View File

@@ -202,6 +202,23 @@ public interface BaseAgent {
split.context().getGraph().add("(" + durationMs + " ms)");
split.context().setLastCompletion(completion);
split.context().getRequestStatistic().add(completion);
switch (completion.finishReason()) {
case TOKEN_LIMIT_REACHED:
split.context().getGraph().add("⏹");
break;
case CONTENT_FILTERED:
split.context().getGraph().add("⛔");
break;
case TOOL_CALLS:
split.context().getGraph().add("🔧");
break;
case ERROR:
split.context().getGraph().add("❌");
continue;
default:
break;
}
if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) {
if (toolCallRounds >= 6) {
parseException = new IllegalStateException("Too many tool call rounds");