Skip to content

Update GenAI visualizer to use new multimodal semantic conventions#12694

Merged
JamesNK merged 6 commits intomainfrom
jamesnk/result-images
Nov 6, 2025
Merged

Update GenAI visualizer to use new multimodal semantic conventions#12694
JamesNK merged 6 commits intomainfrom
jamesnk/result-images

Conversation

@JamesNK
Copy link
Member

@JamesNK JamesNK commented Nov 5, 2025

Description

Update GenAI visualizer to use the multimodal standard added in open-telemetry/semantic-conventions#2754

cc @stephentoub

Raw:
image

Preview:
image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12694

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12694"

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the GenAI visualizer in the Aspire Dashboard to support displaying images from blob and uri type message parts according to GenAI semantic conventions, replacing the previous custom "image" type implementation.

Key changes:

  • Added a TryGetPropertyValue helper method to GenAIItemPartViewModel for cleaner property access
  • Refactored image detection logic to support blob (base64-encoded) and uri (http/https URLs) part types with MIME type validation
  • Updated the playground to demonstrate both image part types with proper semantic attributes

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/Aspire.Dashboard/Model/GenAI/GenAIItemPartViewModel.cs Added TryGetPropertyValue helper method for retrieving additional properties
src/Aspire.Dashboard/Components/Dialogs/GenAIVisualizerDialog.razor.cs Refactored image detection to support blob and uri types with MIME validation instead of custom "image" type
src/Aspire.Dashboard/Components/Dialogs/GenAIVisualizerDialog.razor Updated method call from IsImagePart to TryGetImagePart
playground/Stress/Stress.ApiService/Program.cs Updated test data to use new blob and uri types with proper semantic attributes

@stephentoub
Copy link
Member

For other blobs, should we have a download button? I'm thinking for files like xlsx, pdf, etc.

Also for text like "text/*" or "application/json", render as text?

Is there any generalized "show these bytes as this mime type" browser component this could use?

@JamesNK JamesNK force-pushed the jamesnk/result-images branch from 1e10fea to 35fc8f4 Compare November 6, 2025 02:53
@JamesNK
Copy link
Member Author

JamesNK commented Nov 6, 2025

@stephentoub Improved:

  • Uses audio element when it makes sense
  • uri and blob parts that aren't images or audio are displayed as download links. Unfortunately blob parts don't include a hint on the file name so UI has to calculate it from the mime type. Hacky but, will work for common file types, and I don't see a better alternative.
image


// AI generated list of extensions.
// Combines 100 commonly used mime types with https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types.
public static readonly Dictionary<string, string> MimeToExtension = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet another example where dotnet/runtime#121017 will be useful.

@stephentoub
Copy link
Member

Very nice.

@JamesNK
Copy link
Member Author

JamesNK commented Nov 6, 2025

@stephentoub There is also a video element - https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video

Do you think that should be supported?

@stephentoub
Copy link
Member

stephentoub commented Nov 6, 2025

@stephentoub There is also a video element - https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/video

Do you think that should be supported?

I don't know how common it'll be, but I also don't think it can really hurt to have it, so, sure :)

@JamesNK
Copy link
Member Author

JamesNK commented Nov 6, 2025

Done

image

@JamesNK JamesNK enabled auto-merge (squash) November 6, 2025 04:09
@JamesNK JamesNK merged commit 240a476 into main Nov 6, 2025
296 checks passed
@JamesNK JamesNK deleted the jamesnk/result-images branch November 6, 2025 04:57
@dotnet-policy-service dotnet-policy-service bot added this to the 13.1 milestone Nov 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants