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: else:
metadata, data = c.data.split(',', 1) metadata, data = c.data.split(',', 1)
mime_type = metadata.split(';', 1)[0].split(':')[1] mime_type = metadata.split(';', 1)[0].split(':')[1]
blob = {"inline_data":{"mime_type":mime_type,"data":data}} parts.append(glm.Part.from_data(mime_type=mime_type, data=data))
parts.append(blob) glm_content = glm.Content(role="user", parts=parts)
glm_content = glm.Content(role="user", parts=[parts])
return glm_content return glm_content
elif isinstance(message, AssistantPromptMessage): elif isinstance(message, AssistantPromptMessage):
if message.content: if message.content:
@ -438,4 +436,4 @@ class VertexAiLargeLanguageModel(LargeLanguageModel):
exceptions.RequestRangeNotSatisfiable, exceptions.RequestRangeNotSatisfiable,
exceptions.Cancelled, exceptions.Cancelled,
] ]
} }