Question: GPT4-vision #314
-
Hey! How would I use gpt4-vision with this library? I'd like to pass in an image and text asking about the image and get the response. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I believe I figured it out! Was this in the documentation anywhere? I had trouble finding it. I had to dig through the commit history to find this. |
Beta Was this translation helpful? Give feedback.
-
Also, is there a way to pass in a local image instead of the url? |
Beta Was this translation helpful? Give feedback.
-
Same question. The authors provide some codes in |
Beta Was this translation helpful? Give feedback.
-
val reqList: ArrayList<ContentPart> = ArrayList<ContentPart>()
reqList.add(TextPart("Hello! Describe the image for me."))
reqList.add(ImagePart("data:image/jpeg;base64,$picInBase64"))
val chatCompletionRequest = ChatCompletionRequest(
model = ModelId("gpt-4-vision-preview"),
messages = listOf(
ChatMessage(
role = ChatRole.System,
content = "You are a helpful assistant!"
),
ChatMessage(
role = ChatRole.User,
content = reqList
)
)
) ↑ works. |
Beta Was this translation helpful? Give feedback.
↑ works.