From d811deebc9543375d5874fd6980c7ed7daa4d079 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Wed, 10 Apr 2024 18:24:19 -0600 Subject: [PATCH] openai: use auto vision level --- matrix_gpt/generate_clients/openai.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matrix_gpt/generate_clients/openai.py b/matrix_gpt/generate_clients/openai.py index d99c4ae..2bb5936 100644 --- a/matrix_gpt/generate_clients/openai.py +++ b/matrix_gpt/generate_clients/openai.py @@ -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' } }] })