-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Library name and version
Azure.AI.OpenAI 2.3.0-beta.1
Describe the bug
The file is added in the list of ChatMessage using
var document = BinaryData.FromBytes(File.ReadAllBytes("C:\\OpenAIFiles\\myTestPdfFileName.pdf"));
new UserChatMessage(ChatMessageContentPart.CreateFilePart(document, "application/pdf", "myTestPdfFileName.pdf"))
When using OpenAIClient client from OpenAI 2.3.0 package, the PDF is read and everything works as expected.
But when I use AzureOpenAIClient from Azure.AI.OpenAI 2.3.0-beta.1, it returns:
"HTTP 400 (invalid_request_error: invalid_value)
Parameter: messages[2].content[0].type
Invalid Value: 'file'. This model does not support file content types."
at OpenAI.ClientPipelineExtensions.ProcessMessageAsync(ClientPipeline pipeline, PipelineMessage message, RequestOptions options)
at OpenAI.Chat.ChatClient.CompleteChatAsync(BinaryContent content, RequestOptions options)
at OpenAI.Chat.ChatClient.CompleteChatAsync(IEnumerable`1 messages, ChatCompletionOptions options, CancellationToken cancellationToken)
Expected behavior
using AzureOpenAIClient should be able to process the PDF files just as OpenAI's OpenAIClient does.
Actual behavior
using AzureOpenAIClient returns 400 invalid_value when PDF files are used.
Reproduction Steps
use Azure.AI.OpenAI nuget, with chat completion client (any supported model).
add a PDF file as part of the input ChatMessage list.
call client.CompleteChat(messages) or await client.CompleteChatAsync(messages)
Environment
No response