Bugfix: Vertex AI vision model not support image (#4853)

This commit is contained in:
Pan, Wen-Ming 2024-06-02 11:11:09 +08:00 committed by GitHub
parent b234710af9
commit cdbc260571
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,
]
}
}