microsoft / microsoft/onnxruntime-genai
DataContent does not work with images or audio
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 354
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 85
Description
**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]
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how OnnxRuntimeGenAIChatClient handles the ChatRole.User content in the reproduction, comparing TextContent with DataContent and UriContent. Reproduce the issue with the provided image examples and confirm that non-text content is forwarded so the model can process the attachment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- ai
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100