Skip to content

Commit 271702d

Browse files
committed
Avoid Exception procesing Agent response when Choices is not in the json response.
(cherry picked from commit ac394fc)
1 parent c81ad29 commit 271702d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

java/src/main/java/com/genexus/GXProcedure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ protected String callAgent(String agent, boolean stream, GXProperties properties
288288
aiRequest.setStream(true);
289289
client = new HttpClient();
290290
OpenAIResponse aiResponse = SaiaService.call(aiRequest, client, result);
291-
if (aiResponse != null) {
291+
if (aiResponse != null && aiResponse.getChoices() != null) {
292292
for (OpenAIResponse.Choice element : aiResponse.getChoices()) {
293293
String finishReason = element.getFinishReason();
294294
if (finishReason.equals("stop"))

0 commit comments

Comments
 (0)