Skip to content
New issue

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

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

Already on GitHub? # to your account

"expected an object, but got a string instead" #57

Open
generalpublic opened this issue Aug 2, 2024 · 1 comment
Open

"expected an object, but got a string instead" #57

generalpublic opened this issue Aug 2, 2024 · 1 comment

Comments

@generalpublic
Copy link

generalpublic commented Aug 2, 2024

when running narrator.py, the error message below comes up.

openai.NotFoundError: Error code: 404 - {'error': {'message': 'The model gpt-4-vision-preview has been deprecated, learn more here: https://platform.openai.com/docs/deprecations', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}

looking at https://platform.openai.com/docs/deprecations, it shows that 'gpt-4-vision-preview's recommended replacement is 'gpt-4o'

When I replace the above in narrator.py line 58 with 'gpt-4o', the new error message I get is

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid type for 'messages[1].content[1].image_url': expected an object, but got a string instead.", 'type': 'invalid_request_error', 'param': 'messages[1].content[1].image_url', 'code': 'invalid_type'}}

Anyone know a fix for this?

@generalpublic generalpublic changed the title "gpt-4-vision-preview" model deprecating "expected an object, but got a string instead" Aug 2, 2024
@nacalai
Copy link

nacalai commented Oct 12, 2024

I came to the same stop like you, but I managed to find the solution.

The code for generating the image seems to be wrong.

Open narrator.py -> find this part
image

Replace with

def generate_new_line(base64_image):
    return [
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this image"},
                {
                    "type": "image_url",
            "image_url": {
            "url": f"data:image/jpeg;base64,{base64_image}",
            }
                },
            ],
        },
    ]

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

No branches or pull requests

2 participants