ruby-openai icon indicating copy to clipboard operation
ruby-openai copied to clipboard

Include an image in a message into a thread

Open leandrosardi opened this issue 11 months ago • 3 comments

I want to create and run a message into a thread, including the URL to an image.

Is it possible to do something like this in the current version?

Example:

            mid = @@openai_client.messages.create(
                'thread_id': @@openai_thread_id,
                'parameters': {
                    'role': "user", # Required for manually created messages
                    'content': "What do you see in this picture?", # Required.
                    'image_url': 'https://static.vecteezy.com/system/resources/thumbnails/039/391/155/small/500-social-media-stories-v2-abstract-shopping-nft-e-commerce-memories-bundle.png',
                },
            )["id"]

            @@openai_message_ids << mid

            # run the assistant
            response = @@openai_client.runs.create(
                thread_id: @@openai_thread_id,
                parameters: {
                    assistant_id: @@openai_assistant_id,
                }
            )
            run_id = response['id']

leandrosardi avatar Mar 24 '24 00:03 leandrosardi

If you are referring to GPT-4 with vision, it's currently not possible with the Assistant API. However, you can use it with the Chat Completions API.

See: https://platform.openai.com/docs/guides/vision

Plese note that the Assistants API does not currently support image inputs.

willywg avatar May 04 '24 15:05 willywg

@leandrosardi now it's possible. Look at this: https://platform.openai.com/docs/assistants/how-it-works/creating-image-input-content

willywg avatar May 17 '24 22:05 willywg

@leandrosardi now it's possible. Look at this: https://platform.openai.com/docs/assistants/how-it-works/creating-image-input-content

Hello @willywg. Thank you for your comments, and my apologies for my late response.

I am resuming this project, and I am checking the latest link you posted here.

leandrosardi avatar Jun 28 '24 19:06 leandrosardi