fix: add null check for finish reason in completion handling in BaseAgent
This commit is contained in:
@@ -202,6 +202,7 @@ public interface BaseAgent {
|
||||
split.context().getGraph().add("(" + durationMs + " ms)");
|
||||
split.context().setLastCompletion(completion);
|
||||
split.context().getRequestStatistic().add(completion);
|
||||
if (completion.finishReason() != null) {
|
||||
switch (completion.finishReason()) {
|
||||
case TOKEN_LIMIT_REACHED:
|
||||
split.context().getGraph().add("⏹");
|
||||
@@ -218,6 +219,7 @@ public interface BaseAgent {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!completion.toolCalls().isEmpty() && responseHandler instanceof final ToolCallingAgentResponseHandler toolCallingAgentResponseHandler) {
|
||||
if (toolCallRounds >= 6) {
|
||||
|
||||
Reference in New Issue
Block a user