Skip to content

Commit deb1ed9

Browse files
committed
OpenAI Vertex - filter out System and Developer messages in for content generation
1 parent 6fa6d77 commit deb1ed9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

google-vertexai-client/src/main/scala/io/cequence/openaiscala/vertexai/service/impl/OpenAIVertexAIChatCompletionService.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ private[service] class OpenAIVertexAIChatCompletionService(
3838
): Future[ChatCompletionResponse] = {
3939
val model = createModel(messages, settings)
4040

41-
val javaFuture = model.generateContentAsync(toNonSystemVertexAI(messages))
41+
val javaFuture = model.generateContentAsync(
42+
toNonSystemVertexAI(
43+
messages.filter(message =>
44+
message.role != ChatRole.System && message.role != ChatRole.Developer
45+
)
46+
)
47+
)
4248
val scalaFuture: Future[GenerateContentResponse] =
4349
toScala(CompletableFuture.supplyAsync(() => javaFuture.get))
4450

0 commit comments

Comments
 (0)