joeyHXD / aichat_chatGPT_API

Hoshino插件,可以用chatGPT的API对话
12 stars 3 forks source link

请求加入图片支持 #16

Closed SlightDust closed 12 months ago

SlightDust commented 1 year ago

gpt4-turbo的gpt-4-1106-vision-preview模型应该可以在对话时加入图片了,请求实现图片支持

SlightDust commented 1 year ago

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

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4-vision-preview",
    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,
)

print(response.choices[0])
joeyHXD commented 1 year ago

这几个礼拜比较忙,你可以看看隔壁插件有没有,我这边可能要12月才会加吧

SlightDust commented 1 year ago

那我这几天试着改一下,能用的话pr一个(x)

joeyHXD commented 1 year ago

那我这几天试着改一下,能用的话pr一个(x)

好好好!

SlightDust commented 12 months ago

done