openai: use auto vision level
This commit is contained in:
parent
06396a70da
commit
d811deebc9
|
@ -25,6 +25,10 @@ class OpenAIClient(ApiClient):
|
|||
self._context.append({'role': role, 'content': content})
|
||||
|
||||
async def append_img(self, img_event: RoomMessageImage, role: str):
|
||||
"""
|
||||
We crop the largest dimension of the image to 512px and then let the AI decide
|
||||
if it should use low or high res analysis.
|
||||
"""
|
||||
assert role in [self._HUMAN_NAME, self._BOT_NAME]
|
||||
img_bytes = await download_mxc(img_event.url, self._client_helper.client)
|
||||
encoded_image = await process_image(img_bytes, resize_px=512)
|
||||
|
@ -34,7 +38,7 @@ class OpenAIClient(ApiClient):
|
|||
'type': 'image_url',
|
||||
'image_url': {
|
||||
'url': f"data:image/png;base64,{encoded_image}",
|
||||
'detail': 'low'
|
||||
'detail': 'auto'
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue