Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpt-4o-mini #620

Open
butalex11 opened this issue Jul 18, 2024 · 6 comments
Open

gpt-4o-mini #620

butalex11 opened this issue Jul 18, 2024 · 6 comments

Comments

@butalex11
Copy link

Any plans for implement gpt-4o-mini support ?

@messenjah
Copy link

messenjah commented Jul 20, 2024

I tried to just add it to the models list in openai_helper.py on line 31
GPT_4O_MODELS = ("gpt-4o", "gpt-4o-mini")
but it fails when it uses tiktoken.

I assume tiktoken has to integrate the new model first.

@prttp
Copy link

prttp commented Jul 22, 2024

I tried to just add it to the models list in openai_helper.py on line 31 GPT_4O_MODELS = ("gpt-4o", "gpt-4o-mini","gpt-4o-mini-2024-07-18") but it fails when it uses tiktoken.

I assume tiktoken has to integrate the new model first.

I made a workaround in openai_helper.py:654

            if (model == "gpt-4o-mini"):
                encoding = tiktoken.encoding_for_model("gpt-4o")
            else:
                encoding = tiktoken.encoding_for_model(model)

It is functional, so I'm planning to use it until tiktoken update

@messenjah
Copy link

messenjah commented Jul 22, 2024

I tried to just add it to the models list in openai_helper.py on line 31 GPT_4O_MODELS = ("gpt-4o", "gpt-4o-mini","gpt-4o-mini-2024-07-18") but it fails when it uses tiktoken.
I assume tiktoken has to integrate the new model first.

I made a workaround in openai_helper.py:654

            if (model == "gpt-4o-mini"):
                encoding = tiktoken.encoding_for_model("gpt-4o")
            else:
                encoding = tiktoken.encoding_for_model(model)

It is functional, so I'm planning to use it until tiktoken update

Hi prttp,

thanks for this quick answer and a work around!
Could you please share the exact changes you did? I tried to change it but it's still not working for me. I get the same encoding error with tiktoken. Here is how my block looks for me starting at line 660:

        model = self.config['model']
        try:
            if (model == "gpt-4o-mini"):
                encoding = tiktoken.encoding_for_model("gpt-4o")
            else:
                encoding = tiktoken.encoding_for_model(model)
        except KeyError:
            encoding = tiktoken.get_encoding("gpt-3.5-turbo")

I assume I did something wrong?

@prttp
Copy link

prttp commented Jul 22, 2024

I tried to just add it to the models list in openai_helper.py on line 31 GPT_4O_MODELS = ("gpt-4o", "gpt-4o-mini","gpt-4o-mini-2024-07-18") but it fails when it uses tiktoken.
I assume tiktoken has to integrate the new model first.

I made a workaround in openai_helper.py:654

            if (model == "gpt-4o-mini"):
                encoding = tiktoken.encoding_for_model("gpt-4o")
            else:
                encoding = tiktoken.encoding_for_model(model)

It is functional, so I'm planning to use it until tiktoken update

Hi prttp,

thanks for this quick answer and a work around! Could you please share the exact changes you did? I tried to change it but it's still not working for me. I get the same encoding error with tiktoken. Here is how my block looks for me starting at line 660:

        model = self.config['model']
        try:
            if (model == "gpt-4o-mini"):
                encoding = tiktoken.encoding_for_model("gpt-4o")
            else:
                encoding = tiktoken.encoding_for_model(model)
        except KeyError:
            encoding = tiktoken.get_encoding("gpt-3.5-turbo")

I assume I did something wrong?

It should work, u can check my fork, I did exactly the same. U mentioned line 660 - do u use the last version of the repo? Which version of tiktoken is written in your requirements.txt?

@messenjah
Copy link

messenjah commented Jul 22, 2024

$ git pull origin main
From https:/n3d1117/chatgpt-telegram-bot
 * branch            main       -> FETCH_HEAD
Already up to date.

requirements.txt:3
tiktoken==0.7.0

Still not working. I will try to setup a new instance from scratch and try again

@messenjah
Copy link

I just setup a new instance from scratch and did the same changes and now it works! (So it was something else on my side)
Many thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants