Skip to content

Commit ca7fc25

Browse files
committed
Fix PMD
1 parent 6bd64ff commit ca7fc25

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ CreateChatCompletionRequest createCreateChatCompletionRequest() {
306306
toolsCombined.addAll(this.tools);
307307
}
308308
if (this.toolsExecutable != null) {
309-
for (OpenAiTool tool : this.toolsExecutable) {
309+
for (final OpenAiTool tool : this.toolsExecutable) {
310310
toolsCombined.add(tool.createChatCompletionTool());
311311
}
312312
}
313313

314314
final var request = new CreateChatCompletionRequest();
315-
for (OpenAiMessage message : this.messages) {
315+
for (final OpenAiMessage message : this.messages) {
316316
request.addMessagesItem(OpenAiUtils.createChatCompletionRequestMessage(message));
317317
}
318318
if (this.stop != null) {

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionResponse.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ public OpenAiAssistantMessage getMessage() {
109109
* @return the list of tool messages that were serialized for the computed results. Empty list if
110110
* no tools were called.
111111
*/
112+
@Nonnull
112113
public List<OpenAiToolMessage> executeTools() {
113-
return OpenAiTool.execute(originalRequest.getToolsExecutable(), getMessage());
114+
final var tools = originalRequest.getToolsExecutable();
115+
return OpenAiTool.execute(tools != null ? tools : List.of(), getMessage());
114116
}
115117
}

0 commit comments

Comments
 (0)