|
92 | 92 | * @author Chris Turchin |
93 | 93 | * @author Mark Pollack |
94 | 94 | * @author Soby Chacko |
| 95 | + * @author Jihoon Kim |
95 | 96 | * @since 0.8.1 |
96 | 97 | */ |
97 | 98 | public class VertexAiGeminiChatModel extends AbstractToolCallSupport implements ChatModel, DisposableBean { |
@@ -304,7 +305,7 @@ public ChatResponse call(Prompt prompt) { |
304 | 305 |
|
305 | 306 | List<Generation> generations = generateContentResponse.getCandidatesList() |
306 | 307 | .stream() |
307 | | - .map(this::responseCandiateToGeneration) |
| 308 | + .map(this::responseCandidateToGeneration) |
308 | 309 | .flatMap(List::stream) |
309 | 310 | .toList(); |
310 | 311 |
|
@@ -352,7 +353,7 @@ public Flux<ChatResponse> stream(Prompt prompt) { |
352 | 353 |
|
353 | 354 | List<Generation> generations = response.getCandidatesList() |
354 | 355 | .stream() |
355 | | - .map(this::responseCandiateToGeneration) |
| 356 | + .map(this::responseCandidateToGeneration) |
356 | 357 | .flatMap(List::stream) |
357 | 358 | .toList(); |
358 | 359 |
|
@@ -380,21 +381,20 @@ public Flux<ChatResponse> stream(Prompt prompt) { |
380 | 381 | }); |
381 | 382 | } |
382 | 383 |
|
383 | | - protected List<Generation> responseCandiateToGeneration(Candidate candidate) { |
| 384 | + protected List<Generation> responseCandidateToGeneration(Candidate candidate) { |
384 | 385 |
|
385 | 386 | // TODO - The candidateIndex (e.g. choice must be asigned to the generation). |
386 | 387 | int candidateIndex = candidate.getIndex(); |
387 | | - FinishReason candidateFinishReasonn = candidate.getFinishReason(); |
| 388 | + FinishReason candidateFinishReason = candidate.getFinishReason(); |
388 | 389 |
|
389 | 390 | Map<String, Object> messageMetadata = Map.of("candidateIndex", candidateIndex, "finishReason", |
390 | | - candidateFinishReasonn); |
| 391 | + candidateFinishReason); |
391 | 392 |
|
392 | | - ChatGenerationMetadata chatGenerationMetadata = ChatGenerationMetadata.from(candidateFinishReasonn.name(), |
393 | | - null); |
| 393 | + ChatGenerationMetadata chatGenerationMetadata = ChatGenerationMetadata.from(candidateFinishReason.name(), null); |
394 | 394 |
|
395 | | - boolean isFunctinCall = candidate.getContent().getPartsList().stream().allMatch(Part::hasFunctionCall); |
| 395 | + boolean isFunctionCall = candidate.getContent().getPartsList().stream().allMatch(Part::hasFunctionCall); |
396 | 396 |
|
397 | | - if (isFunctinCall) { |
| 397 | + if (isFunctionCall) { |
398 | 398 | List<AssistantMessage.ToolCall> assistantToolCalls = candidate.getContent() |
399 | 399 | .getPartsList() |
400 | 400 | .stream() |
|
0 commit comments