father-bot / chatgpt_telegram_bot

💬 Telegram bot with ChatGPT, Python-based, using OpenAI's API.
https://t.me/chatgpt_karfly_bot
MIT License
4.94k stars 1.74k forks source link

GPT4-Turbo and vision support #390

Open djx2726889 opened 8 months ago

djx2726889 commented 8 months ago

Hello, GPT-4 Turbo and the Vision Model have been released by OpenAI. Can you provide support for these models?

jocxfin commented 8 months ago

You can change the models by yourself if you don't want o wait for official support.

yaroslavyaroslav commented 8 months ago

@jocxfin I'm not sure that it would work in gpt-4-vision model case. It works perfectly fine in case of gpt-4-turbo though.

MrPeterJin commented 7 months ago

@jocxfin Me too. Didn't figure out how to use gpt-4-vision.

karfly commented 7 months ago

Hey! I’ll soon add support for GPT-4 and then for DALLE-3 and GPT-4 Vision

KillingNature commented 7 months ago

@yaroslavyaroslav How to do that? I've added new model gpt-4-1106-preview and bot says "Something went wrong during completion. Reason: Unknown model: gpt-4-1106-preview"

yaroslavyaroslav commented 7 months ago

@yaroslavyaroslav How to do that? I've added new model gpt-4-1106-preview and bot says "Something went wrong during completion. Reason: Unknown model: gpt-4-1106-preview"

Yep, it's a fun one. You have to update bot/openai_utils.py to the following state:

class ChatGPT:
    def __init__(self, model="gpt-3.5-turbo-1106"):
        assert model in {"gpt-3.5-turbo-1106", "gpt-4-1106-preview"}, f"Unknown model: {model}"

Perform a search within this file for any other checks of this models limitations, I believe I changed it more then in a single place.

karfly commented 7 months ago

Hi! Just added support of GPT-4 Turbo ❤️ Please, test it and write here if something goes wrong

Ax3Effect commented 7 months ago

Sometimes, when the answer is long, it cuts off half-way during the message editing and then it gives: Something went wrong during completion. Reason: Timed out Maybe it's way too quick? Haha

jocxfin commented 7 months ago

@Ax3Effect turn off the enable_message_streaming: false # if set, messages will be shown to user word-by-word in config.yml. The error itself is caused by the bot pinging the Telegram API too often to edit the message. Ofc with this change you will lose the ability to see the response as it's being formed, but it still fixes the issue.

hvanmegen commented 7 months ago

You could also lower the rate at which it modifies the message via the Telegram API by increasing the sleep in that function.. from 0.1 to 0.5 or even once every 1 second..

Werdan5 commented 7 months ago

When can you add support for DALL-E-3 and GPT-4 Turbo with vision?

ijwfly commented 7 months ago

Hello everyone,

Noticed requests for gpt-4-vision in a TG bot. I've implemented it in my project chatgpt-tg with a focus on easy updates for new OpenAI features. Caveats: setup requires a real IP and a little more complex, also no group chat or DALL-E 2 support yet.

Repo here for those interested: https://github.com/ijwfly/chatgpt-tg. I'm open to feedback and any setup queries you might have.

yaroslavyaroslav commented 7 months ago

Repo here for those interested: https://github.com/ijwfly/chatgpt-tg. I'm open to feedback and any setup queries you might have.

Have tried it, quite solid release, I'd say. Gonna switch there from here.