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().getGraph().add("(" + durationMs + " ms)");
|
||||||
split.context().setLastCompletion(completion);
|
split.context().setLastCompletion(completion);
|
||||||
split.context().getRequestStatistic().add(completion);
|
split.context().getRequestStatistic().add(completion);
|
||||||
|
if (completion.finishReason() != null) {
|
||||||
switch (completion.finishReason()) {
|
switch (completion.finishReason()) {
|
||||||
case TOKEN_LIMIT_REACHED:
|
case TOKEN_LIMIT_REACHED:
|
||||||
split.context().getGraph().add("⏹");
|
split.context().getGraph().add("⏹");
|
||||||
@@ -218,6 +219,7 @@ public interface BaseAgent {
|
|||||||
default:
|
default:
|
||||||
break;
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user