betalgo / openai

OpenAI .NET sdk - Azure OpenAI, ChatGPT, Whisper, and DALL-E
https://betalgo.github.io/openai/
MIT License
2.89k stars 521 forks source link

How to use Vision API ? Unity #440

Closed Titibo26 closed 10 months ago

Titibo26 commented 10 months ago

Describe the bug I can't use features of the vision API. FromVisionUser, VisionContent and other vision's related element are not recognized. Using latest OpenAI lib in Unity though nugget package manager. Tested vision example.

Your code piece


var completionResult = await openAiService.ChatCompletion.CreateCompletion(
            new ChatCompletionCreateRequest
            {
                Messages = new List<ChatMessage>
                {
            ChatMessage.FromSystem("You are an image analyzer assistant."),
            ChatMessage.FromVisionUser(
                new List<VisionContent>
                {
                    VisionContent.TextContent("What is on the picture in details?"),
                    VisionContent.ImageBinaryContent(
                        binaryImage,
                        ImageStatics.ImageFileTypes.Png,
                        ImageStatics.ImageDetailTypes.High
                    )
                }
            ),
                },
                MaxTokens = 300,
                Model = Models.Gpt_4_vision_preview,
                N = 1
            }
        );
belaszalontai commented 10 months ago

the current version 7.4.1, does not support Vision.

This MR will implement the feature after merging and releasing: https://github.com/betalgo/openai/pull/434

please be patient and wait for next release.