LitServe icon indicating copy to clipboard operation
LitServe copied to clipboard

Add support to include images for OpenAI Chat Template

Open bhimrazy opened this issue 1 year ago • 3 comments

🚀 Feature Request: Add Support for Images in Chat Messages

Description

Add support for images to be included in chat messages, similar to gpt-4o.

{
  "messages": [
     {
            "role": "user",
            "content": [
                {"type": "text", "text": "What's in this image?"},
                {
                    "type": "image_url",
                    "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
                },
            ],
        }
  ]
}

Motivation

I was trying to implement a chat generation API using the phi3-vision model, which takes images as input. The proposed format will facilitate interaction with models that involve images. This approach will simplify the handling of different prompt techniques, which can be managed separately before passing the prompt to the model.

Benefits

  • Enhanced Interaction: Enables richer interactions by allowing images in chat messages.
  • Flexibility: Provides a structured way to handle various prompt techniques involving images.

Additional Context

Implementing this feature will involve updating the schema to support image URLs in chat messages, ensuring compatibility with existing and future vision models.

bhimrazy avatar May 23 '24 08:05 bhimrazy

Hi! thanks for your contribution!, great first issue!

github-actions[bot] avatar May 23 '24 08:05 github-actions[bot]

@bhimrazy great idea. want to take a stab at submitting a PR? we can help you finish and land it.

williamFalcon avatar May 23 '24 11:05 williamFalcon

@bhimrazy great idea. want to take a stab at submitting a PR? we can help you finish and land it.

Sure @williamFalcon. Sounds great.

bhimrazy avatar May 23 '24 11:05 bhimrazy