feat: add finish reason indicators for completion statuses in BaseAgent
This commit is contained in:
@@ -899,6 +899,10 @@ Each context accumulates a graph trace that documents the path through the flow.
|
|||||||
| `M`, `S`, `L`, `HOT`, `COLD` | Model category short name |
|
| `M`, `S`, `L`, `HOT`, `COLD` | Model category short name |
|
||||||
| agent name | Executed agent |
|
| agent name | Executed agent |
|
||||||
| `○` | Completion skipped |
|
| `○` | Completion skipped |
|
||||||
|
| `⏹` | Completion stopped because the token limit was reached |
|
||||||
|
| `⛔` | Completion stopped because the content was filtered |
|
||||||
|
| `🔧` | Completion stopped because the model returned tool calls |
|
||||||
|
| `❌` | Completion stopped because of an remote error |
|
||||||
| `⇉ x/n` | Branch split x of n |
|
| `⇉ x/n` | Branch split x of n |
|
||||||
| `size↣merged` | Merge size summary |
|
| `size↣merged` | Merge size summary |
|
||||||
| `→` | Next agent is a `COMPLETION` agent |
|
| `→` | Next agent is a `COMPLETION` agent |
|
||||||
|
|||||||
@@ -202,6 +202,23 @@ public interface BaseAgent {
|
|||||||
split.context().getGraph().add("(" + durationMs + " ms)");
|
split.context().getGraph().add("(" + durationMs + " ms)");
|
||||||
split.context().setLastCompletion(completion);
|
split.context().setLastCompletion(completion);
|
||||||
split.context().getRequestStatistic().add(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 (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) {
|
||||||
if (toolCallRounds >= 6) {
|
if (toolCallRounds >= 6) {
|
||||||
parseException = new IllegalStateException("Too many tool call rounds");
|
parseException = new IllegalStateException("Too many tool call rounds");
|
||||||
|
|||||||
Reference in New Issue
Block a user