cancel
Showing results for 
Search instead for 
Did you mean: 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results for 
Search instead for 
Did you mean: 

Playground doesn't show tool results

manoctch
New Contributor

Hii,

I’ve created a model in Databricks that uses different tools. One of these tools generates a chart based on data read from Genie.

I’d like to visualize this chart (basically an image) in Playground, but so far I haven’t found a way to do it. At the moment, I can only see the base64 output instead of the actual chart.

Is there a way to show the images on Playground? 

Thanks

 

1 REPLY 1

AbhaySingh
Databricks Employee
Databricks Employee

  The Issue:

  Databricks Playground typically has limited native support for rendering base64 images

  directly in the chat interface. This is a known limitation in many AI playground

  environments.

 

  Potential Workarounds:

 

  1. Use Markdown Image Syntax

 

  If your tool returns base64 data, try formatting it as a data URI with markdown:

 

  # In your tool's return value

  image_b64 = "your_base64_string_here"

  return f"![Chart](data:image/png;base64,{image_b64})"

 

  2. Return a Public URL Instead

 

  Instead of returning base64, save the chart to a location accessible via HTTP:

 

  # Save to DBFS and return a displayable URL

  dbutils.fs.put(f"/tmp/chart_{uuid.uuid4()}.png", image_bytes)

  # Return the URL or use display() in notebooks

 

  3. Use DisplayHTML in Notebooks

 

  If testing in a Databricks notebook (not Playground), you can use:

 

  from IPython.display import HTML, display

  display(HTML(f'<img src="data&colon;image/png;base64,{image_b64}" />'))

 

  4. Structured Output with Content Type

 

  Ensure your tool returns properly structured output with content type hints:

 

  {

      "type": "image",

      "content": base64_string,

      "mime_type": "image/png"

  }

 

  5. File Path Reference

 

  Return a file path that can be accessed through Databricks:

 

  # Save to a volume or DBFS location

  return f"Image saved to: /Volumes/catalog/schema/volume/chart.png"

 

  Recommended Approach:

 

  The most reliable workaround is to:

  1. Save the generated chart to a Databricks volume or DBFS

  2. Return the file path in the tool response

  3. View the image separately in a notebook using display(Image(path))

 

  The Playground interface is primarily designed for text-based interactions, so rich

  media rendering may require using notebooks or custom applications instead.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now