Skip to content

[Enhancement]: Add support for rendering Vega-Lite charts in chat responses #12989

Description

@CarlaMiquelBlasco

What features would you like to see added?

It would be great if LibreChat could support rendering Vega-Lite charts directly in chat responses.

Many LLM-generated answers include structured data, summaries, trends, or comparisons that are much easier to understand visually. Vega-Lite is a compact, declarative JSON format for charts, making it well-suited for model-generated visualizations.

More details

Proposed behavior

LibreChat could detect Vega-Lite specs in assistant responses and render them as interactive charts instead of showing only raw JSON.

For example, if a response contains a fenced code block like:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "data": {
    "values": [
      { "category": "A", "value": 28 },
      { "category": "B", "value": 55 },
      { "category": "C", "value": 43 }
    ]
  },
  "mark": "bar",
  "encoding": {
    "x": { "field": "category", "type": "nominal" },
    "y": { "field": "value", "type": "quantitative" }
  }
}

LibreChat would render the chart inline in the conversation.

Suggested fallback behavior

If the chart cannot be rendered, LibreChat should display the original Vega-Lite code block and show a small error message, rather than breaking the chat response.

Additional thought

This could pair nicely with future support for other structured renderers, but Vega-Lite would be a strong starting point because it is widely used, declarative, and easy for LLMs to generate accurately.

Which components are impacted by your request?

No response

Pictures

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions