When calling the gemini-pro-vision image recognition model, the following prompt message is returned, and we need to update the called model:

Gemini 1.0 Pro Vision has been deprecated on July 12, 2024. Consider switching to different model, for example gemini-1.5-flash.

TLDR

When calling the API, replace models/gemini-1.0-pro-vision-latest with models/gemini-1.5-flash latest

old:

const geminiProVisionEndpoint = `https://generativelanguage.googleapis.com/v1beta/models/gemini-1.0-pro-vision-latest:generateContent?key=${geminiApiKey}`;

new:

const geminiProVisionEndpoint = `https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=${geminiApiKey}`;

If you are using the gemini interface of the nginx or openresty proxy, you just need to intercept and replace the path as follows:

    location /v1beta/models/gemini-pro-vision:generateContent {
        rewrite ^/v1beta/models/gemini-pro-vision:generateContent$ /v1beta/models/gemini-1.5-flash-latest:generateContent break;
        proxy_pass https://generativelanguage.googleapis.com;
    }
Last modification:August 29, 2024
如果觉得我的文章对你有用,请随意赞赏