Skip to content

DataContent does not work with images or audio #1879

@dcostea

Description

@dcostea

Describe the bug
Microsoft.Extensions.AI.DataContent message type is not supported with OnnxRuntimeGenAIChatClient client.

To Reproduce
Steps to reproduce the behavior:

using var onnxChatClient = new OnnxRuntimeGenAIChatClient(model);
byte[] imageBytes = File.ReadAllBytes(@"path.jpg");
var message = new(ChatRole.User, [
    new TextContent(query),
    new DataContent(imageBytes, "image/jpeg")
])
var response = onnxChatClient.GetResponseAsync([message]))

or

using var onnxChatClient = new OnnxRuntimeGenAIChatClient(model);
var message = new(ChatRole.User, [
    new TextContent(query),
    new UriContent(new Uri(@"https://path/to/image"), "image/jpeg")
]),
var response = onnxChatClient.GetResponseAsync([message]))

non-text content is not processed.
I'm expecting the model to "see" the attached image.

Desktop (please complete the following information):

  • OS: [Win/Linux]
  • Version [Microsoft.ML.OnnxRuntimeGenAI.Cuda 0.11.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions