My gpt-4o via API key identifies itself as gpt-3.5

my gpt-4o via API key identifies itself as gpt-3.5
My API key is paid
What additional settings are required?

1 Like

Hello, @qwerty12091982!

This is what’s known as a hallucination likely. If you tell it that it’s GPT-114 in the system prompt, it will identify as that model (which doesn’t exist!)

If you’re new, two links I’d recommend are…

https://platform.openai.com/docs/quickstart

…and the Cookbook!..

We’ve got a lot of great gems here on the forums, though, if you stick around and browse a bit.

Welcome.

4 Likes

I send him a picture through my telegram bot, he gives an error that this OPENAI cannot process the image

1 Like

Ah, do you have code for the bot?

Are you sure it’s using the right model?

3 Likes

Yes of course
model=“gpt-4o”,
stream=False,
python

1 Like

Welcome to the dev forum @qwerty12091982

Are you passing the image within its own image content block? Like the boilerplate code in docs.

3 Likes

I not programmer, i ordered myself a telegram bot
And I received this code, it generates pictures and recognizes my pictures, but when I want to talk to him, the answers are weak, not as interesting as on the website chatgpt .com

import logging
import base64
from aiogram import Bot, Dispatcher, types, F
from openai import OpenAI
import os
import json

logging.basicConfig(level=logging.INFO, filename=“log.log”, encoding=“utf-8”)

bot = Bot(token=“*************************************************”)

bot = Bot(token=“”)

dp = Dispatcher()

open_ai = OpenAI(
api_key=“***************************************************************”
)

temperature = 2 # ИЗМЕНЯТЬ ОТ 0 до 2

FILE_NAME = “messages.json”

def add_message(author, content):
# Проверяем, существует ли файл
if os.path.exists(FILE_NAME):
with open(FILE_NAME, “r”, encoding=“utf-8”) as file:
data = json.load(file)
else:
data = {}

# Добавляем сообщение в список 'messages'
if "messages" not in data:
    data["messages"] = []

data["messages"].append({"role": author, "content": content})

# Записываем обновленные данные в файл
with open(FILE_NAME, "w", encoding="utf-8") as file:
    json.dump(data, file, indent=4, ensure_ascii=False)

def get_messages():
# Проверка существования файла
if not os.path.exists(FILE_NAME):
return # Возвращает пустой список, если файл не существует

with open(FILE_NAME, "r", encoding="utf-8") as file:
    data = json.load(file)

# Возврат списка сообщений
return data.get("messages", [])

def clear_messages():
# Обнуляем список сообщений
data = {“messages”: }

# Записываем обновленные данные в файл
with open(FILE_NAME, "w", encoding="utf-8") as file:
    json.dump(data, file, indent=4, ensure_ascii=False)

@dp.message(F.text.startswith(“/image”))
async def image_handler(message: types.Message):
assert message.text

response = open_ai.images.generate(
    model="dall-e-3",
    prompt=" ".join(message.text.split()[1:]),
    size="1024x1024",
    quality="standard",
    n=1,
)

image_url = response.data[0].url

await message.reply_photo(photo=types.URLInputFile(image_url))

@dp.message(F.text == “/clear_messages”)
async def clear(message: types.Message):
clear_messages()

await message.reply("Успешно")

@dp.message()
async def on_message(message: types.Message):
assert message.bot

try:
    if message.photo:
        photo = message.photo[-1]

        file_path = "temp_photo.jpg"

        await message.bot.download_file(
            (await message.bot.get_file(photo.file_id)).file_path, file_path
        )

        with open(file_path, "rb") as file:
            chat_gpt_response = open_ai.chat.completions.create(
                messages=get_messages()
                + [
                    {
                        "role": "user",
                        "content": [
                            {"type": "text", "text": message.caption},
                            {
                                "type": "image_url",
                                "image_url": {
                                    "url": f"data:image/jpeg;base64,{base64.b64encode(file.read()).decode('utf-8')}"
                                },
                            },
                        ],
                    }
                ],
                model="gpt-4",
                stream=False,
                temperature=temperature,
            )

        await message.reply(chat_gpt_response.choices[0].message.content)

    else:
        chat_gpt_response = open_ai.chat.completions.create(
            messages=get_messages() + [{"role": "user", "content": message.text}],
            model="gpt-4",
            stream=False,
            temperature=temperature,
        )
        await message.reply(chat_gpt_response.choices[0].message.content)

except Exception as err:
    await message.reply(f"Произошла ошибка!\n{str(err)}")

add_message("user", message.text or message.caption)
add_message("assistant", chat_gpt_response.choices[0].mesasge.content)

dp.run_polling(bot)