Skip to content

Commit 51b2e18

Browse files
committed
refactor(spring-ai-openai): fix code style
Signed-off-by: SenreySong <[email protected]>
1 parent d7b9697 commit 51b2e18

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/OpenAiChatModel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ public Flux<ChatResponse> internalStream(Prompt prompt, ChatResponse previousCha
381381
return Flux.just(ChatResponse.builder().from(response)
382382
.generations(ToolExecutionResult.buildGenerations(toolExecutionResult))
383383
.build());
384-
} else {
384+
}
385+
else {
385386
// Send the tool execution result back to the model.
386387
return this.internalStream(new Prompt(toolExecutionResult.conversationHistory(), prompt.getOptions()),
387388
response);

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,7 @@ public record ChatCompletionMessage(// @formatter:off
14451445
@JsonProperty("role") Role role,
14461446
@JsonProperty("name") String name,
14471447
@JsonProperty("tool_call_id") String toolCallId,
1448-
@JsonProperty("tool_calls")
1449-
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) List<ToolCall> toolCalls,
1448+
@JsonProperty("tool_calls") @JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) List<ToolCall> toolCalls,
14501449
@JsonProperty("refusal") String refusal,
14511450
@JsonProperty("audio") AudioOutput audioOutput,
14521451
@JsonProperty("annotations") List<Annotation> annotations,

models/spring-ai-openai/src/test/java/org/springframework/ai/openai/api/OpenAiStreamFunctionCallingHelperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public void merge_partialFieldsFromEachChunk() {
256256
public void isStreamingToolFunctionCall_withMultipleChoicesAndOnlyFirstHasToolCalls() {
257257
var toolCall = Mockito.mock(OpenAiApi.ChatCompletionMessage.ToolCall.class);
258258
var deltaWithToolCalls = new OpenAiApi.ChatCompletionMessage(null, null, null, null, List.of(toolCall), null,
259-
null, null);
259+
null, null, null);
260260
var deltaWithoutToolCalls = new OpenAiApi.ChatCompletionMessage(null, null);
261261

262262
var choice1 = new OpenAiApi.ChatCompletionChunk.ChunkChoice(null, null, deltaWithToolCalls, null);
@@ -328,7 +328,7 @@ public void edgeCases_emptyStringFields() {
328328

329329
@Test
330330
public void isStreamingToolFunctionCall_withNullToolCallsList() {
331-
var delta = new OpenAiApi.ChatCompletionMessage(null, null, null, null, null, null, null, null);
331+
var delta = new OpenAiApi.ChatCompletionMessage(null, null, null, null, null, null, null, null, null);
332332
var choice = new OpenAiApi.ChatCompletionChunk.ChunkChoice(null, null, delta, null);
333333
var chunk = new OpenAiApi.ChatCompletionChunk(null, List.of(choice), null, null, null, null, null, null);
334334

0 commit comments

Comments
 (0)