From 0c0ba477e5435c4cbce5eaf6af48b321d2fa4973 Mon Sep 17 00:00:00 2001
From: Timothy Beamish <92407015+tbeamish-benchsci@users.noreply.github.com>
Date: Wed, 28 Feb 2024 13:36:35 -0500
Subject: [PATCH] Fix for Vertex not supporting system role (#11481)

---
 .../llama-index-llms-vertex/llama_index/llms/vertex/base.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/base.py b/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/base.py
index 228918f4cd..02971bd183 100644
--- a/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/base.py
+++ b/llama-index-integrations/llms/llama-index-llms-vertex/llama_index/llms/vertex/base.py
@@ -13,10 +13,7 @@ from llama_index.core.base.llms.types import (
 )
 from llama_index.core.bridge.pydantic import Field, PrivateAttr
 from llama_index.core.callbacks import CallbackManager
-from llama_index.core.llms.callbacks import (
-    llm_chat_callback,
-    llm_completion_callback,
-)
+from llama_index.core.llms.callbacks import llm_chat_callback, llm_completion_callback
 from llama_index.core.llms.llm import LLM
 from llama_index.core.types import BaseOutputParser, PydanticProgramMode
 from llama_index.llms.vertex.gemini_utils import create_gemini_client, is_gemini_model
@@ -133,6 +130,7 @@ class Vertex(LLM):
         return LLMMetadata(
             is_chat_model=self._is_chat_model,
             model_name=self.model,
+            system_role=MessageRole.USER,  # Vertex does not support the default: MessageRole.SYSTEM
         )
 
     @property
-- 
GitLab