Skip to content

Question: GPT4-vision #314

Answered by BonnenuIt
The-Michael-Chen asked this question in Q&A
Discussion options

You must be logged in to vote
        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.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by aallam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #309 on April 01, 2024 11:16.