From cdbc260571cd87503d0b3dfc025c0c3a7e822eee Mon Sep 17 00:00:00 2001 From: "Pan, Wen-Ming" Date: Sun, 2 Jun 2024 11:11:09 +0800 Subject: [PATCH] Bugfix: Vertex AI vision model not support image (#4853) --- .../model_runtime/model_providers/vertex_ai/llm/llm.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py b/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py index 7d2fbd087a..43385a5be1 100644 --- a/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py +++ b/api/core/model_runtime/model_providers/vertex_ai/llm/llm.py @@ -367,10 +367,8 @@ class VertexAiLargeLanguageModel(LargeLanguageModel): else: metadata, data = c.data.split(',', 1) mime_type = metadata.split(';', 1)[0].split(':')[1] - blob = {"inline_data":{"mime_type":mime_type,"data":data}} - parts.append(blob) - - glm_content = glm.Content(role="user", parts=[parts]) + parts.append(glm.Part.from_data(mime_type=mime_type, data=data)) + glm_content = glm.Content(role="user", parts=parts) return glm_content elif isinstance(message, AssistantPromptMessage): if message.content: @@ -438,4 +436,4 @@ class VertexAiLargeLanguageModel(LargeLanguageModel): exceptions.RequestRangeNotSatisfiable, exceptions.Cancelled, ] - } \ No newline at end of file + }