NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

fix: add a method to detect vision model

Open wayoungofustc opened this issue 1 year ago • 13 comments

Title: Add environment variable $CUSTOM_VISION_MODELS for additional vision model discrimination

Description: For user-defined models, there are some scenarios that do not conform to the design of the commit fix vision detect method. For example: CUSTOM_MODELS=+claude-3-opus-20240229,+claude-3-sonnet-20240229

Considering this scenario, renaming the model by adding "vision" to its name is a feasible method. However, this method imposes a cognitive burden on users, as memorizing and understanding the lengthened or changed model names are required.

Therefore, this commit introduces a method that adds an environment variable $CUSTOM_VISION_MODELS to provide additional discrimination for vision models.

It has been tested locally. Test method: export CUSTOM_MODELS=+claude-3-opus-20240229,+claude-3-sonnet-20240229,+gpt-4-1106-preview,+gpt-4-0125-preview,+gpt-4-32k export CUSTOM_VISION_MODELS=+claude-3-opus-20240229,+claude-3-sonnet-20240229 yarn dev

Check the browser at http://localhost:3000/ When switching the model to claude-3-opus-20240229, the image upload button is displayed. When switching to gpt-4-32k, the image upload button is not displayed.

wayoungofustc avatar Mar 15 '24 04:03 wayoungofustc

@wayoungofustc is attempting to deploy a commit to the NextChat Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Mar 15 '24 04:03 vercel[bot]

Your build has completed!

Preview deployment

github-actions[bot] avatar Mar 15 '24 04:03 github-actions[bot]

now looks better plus easy maintain unlike complexity using ||

I apologize for my oversight in not properly handling the empty strings. Now maybe this pr is ready to be merged.

wayoungofustc avatar Mar 15 '24 06:03 wayoungofustc

now looks better plus easy maintain unlike complexity using ||

I apologize for my oversight in not properly handling the empty strings. Now maybe this pr is ready to be merged.

It's fine because it's easier to maintain anyway, unlike when you were using the || operator and calling another model.includes, which added complexity and violated the Don't Repeat Yourself (DRY) principle.

H0llyW00dzZ avatar Mar 15 '24 06:03 H0llyW00dzZ

Thank you for the suggestion. However, I would prefer using a symbol, * for example, to denote multimodal models in environment variables, similar to the existing symbols for adding, removing, or renaming models. For example, +*claude-3-x. This approach, I assume, would be easier to implement and provide better control over the order of custom models.

Algorithm5838 avatar Mar 17 '24 00:03 Algorithm5838

Thank you for the suggestion. However, I would prefer using a symbol, * for example, to denote multimodal models in environment variables, similar to the existing symbols for adding, removing, or renaming models. For example, +*claude-3-x. This approach, I assume, would be easier to implement and provide better control over the order of custom models.

Thank you for implementing the wildcard functionality. It's certainly a valuable feature to have. However, I believe it would also be beneficial to provide an option for exact matching without wildcards. This ensures precision when needed and caters to different use cases. What do you think about adding support for both wildcard and exact matching? Let me know your thoughts!

wayoungofustc avatar Mar 17 '24 15:03 wayoungofustc

I meant * to denote multimodal capabilities, not as a wildcard. So +claude-3-x refers to the text-only version, while +[*]claude-x refers to the multimodal version that can handle both text and vision inputs. Also, I was just suggesting, I didn't implement a thing.

Algorithm5838 avatar Mar 18 '24 05:03 Algorithm5838

@fred-bf any chance to merge this pr? thx

wayoungofustc avatar Mar 19 '24 13:03 wayoungofustc

非常需要,期待合入

pch18 avatar Mar 27 '24 14:03 pch18

Bot detected the issue body's language is not English, translate it automatically.


Very much needed, looking forward to incorporating

Issues-translate-bot avatar Mar 27 '24 14:03 Issues-translate-bot

@H0llyW00dzZ Hi Hollywoodzz, could you please help me ask the owner if this PR can be merged? Some API vendors do not support "claude-3-*" as the vision model.

wayoungofustc avatar Mar 28 '24 19:03 wayoungofustc

@H0llyW00dzZ Hi Hollywoodzz, could you please help me ask the owner if this PR can be merged? Some API vendors do not support "claude-3-*" as the vision model.

@wayoungofustc I am not the owner of this repository. Also, the reason I added claude-3 was for later use, so I don't have to write it again.

H0llyW00dzZ avatar Mar 28 '24 19:03 H0llyW00dzZ

@Dean-YZG Hello, Can you help me check if this pull request can be merged, whether I need to make any further modifications, or if this feature is not favored? Considering that some custom models require deployers to manually specify whether they support visualization features (as things often vary for each deployer and each model), we believe this is a valuable optional feature that will not introduce breaking changes.

wayoungofustc avatar Apr 18 '24 00:04 wayoungofustc

😞

wayoungofustc avatar Apr 29 '24 21:04 wayoungofustc

Bot detected the issue body's language is not English, translate it automatically.


😞

Issues-translate-bot avatar Apr 29 '24 21:04 Issues-translate-bot