lzell / AIProxySwift

Client for AIProxy
https://www.aiproxy.pro
73 stars 9 forks source link

Add detail param to OpenAI chat completion #39

Closed toddham closed 2 months ago

toddham commented 2 months ago

This change adds the detail parameter to chat completions, which has three options, low, high, or auto.

This gives you control when using Vision (available for GPT-4o, GPT-4o mini, and GPT-4 Turbo) over how the model processes the image and generates its textual understanding. By default, the model will use the auto setting which will look at the image input size and decide if it should use the low or high setting.

low will enable the "low res" mode. The model will receive a low-res 512px x 512px version of the image, and represent the image with a budget of 85 tokens. This allows the API to return faster responses and consume fewer input tokens for use cases that do not require high detail.

high will enable "high res" mode, which first allows the model to first see the low res image (using 85 tokens) and then creates detailed crops using 170 tokens for each 512px x 512px tile.