fix: add null check for finish reason in completion handling in BaseAgent
This commit is contained in:
@@ -202,21 +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()) {
|
if (completion.finishReason() != null) {
|
||||||
case TOKEN_LIMIT_REACHED:
|
switch (completion.finishReason()) {
|
||||||
split.context().getGraph().add("⏹");
|
case TOKEN_LIMIT_REACHED:
|
||||||
break;
|
split.context().getGraph().add("⏹");
|
||||||
case CONTENT_FILTERED:
|
break;
|
||||||
split.context().getGraph().add("⛔");
|
case CONTENT_FILTERED:
|
||||||
break;
|
split.context().getGraph().add("⛔");
|
||||||
case TOOL_CALLS:
|
break;
|
||||||
split.context().getGraph().add("🔧");
|
case TOOL_CALLS:
|
||||||
break;
|
split.context().getGraph().add("🔧");
|
||||||
case ERROR:
|
break;
|
||||||
split.context().getGraph().add("❌");
|
case ERROR:
|
||||||
continue;
|
split.context().getGraph().add("❌");
|
||||||
default:
|
continue;
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) {
|
if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) {
|
||||||
|
|||||||
Reference in New Issue
Block a user