theodo-group / LLPhant

LLPhant - A comprehensive PHP Generative AI Framework using OpenAI GPT 4. Inspired by Langchain
MIT License
806 stars 80 forks source link

For Image-To-Text Message::$content property must allow array data type #225

Open prykris opened 1 week ago

prykris commented 1 week ago

According to OpenAI, their message's content property can also be an array. Are there any plans for handling different data types for this property? I must initiate a new instance without the wrapper to access the functionality as a workaround.

response = client.chat.completions.create(
  model="gpt-4o-mini",
  messages=[
    {
      "role": "user",
      "content": [
        {"type": "text", "text": "What’s in this image?"},
        {
          "type": "image_url",
          "image_url": {
            "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",
          },
        },
      ],
    }
  ],
  max_tokens=300,
)
MaximeThoonsen commented 5 days ago

Hey @prykris, we should add it yes. Do you want to work on it?

prykris commented 5 days ago

Hey @prykris, we should add it yes. Do you want to work on it?

I will conjure up something if no one beats me to it.