Fix where previous Assistant Messages were not being added to the parts list.
Results in: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
This commit is contained in:
committed by
Christian Tzolov
parent
2a62235f73
commit
26c5674acb
@@ -431,7 +431,7 @@ public class VertexAiGeminiChatModel extends AbstractToolCallSupport implements
|
||||
else if (message instanceof AssistantMessage assistantMessage) {
|
||||
List<Part> parts = new ArrayList<>();
|
||||
if (StringUtils.hasText(assistantMessage.getContent())) {
|
||||
List.of(Part.newBuilder().setText(assistantMessage.getContent()).build());
|
||||
parts.add(Part.newBuilder().setText(assistantMessage.getContent()).build());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(assistantMessage.getToolCalls())) {
|
||||
parts.addAll(assistantMessage.getToolCalls()
|
||||
|
||||
Reference in New Issue
Block a user