Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Markdown and Code artifacts #4985

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alex-torregrosa
Copy link
Contributor

Summary

Added support for Markdown and Code artifacts, using the text/markdown and application/vnd.code types.

Markdown works by styling the artifact block as prose and disabling the preview tab, reusing the existing react-markdown instance that was used for code rendering.

Code artifacts work the same as previous artifacts, but without the preview tab. The language attribute is extracted from the artifact and used for the code block.

The artifacts prompt generation function has been enhanced to build it dynamically from an array of available artifact types. This will allow future configuration options to disable non-desired types and save prompt tokens (current prompt is ~3000 tokens, and some users may just need prose artifacts).

Should fix #3995

Change Type

Please delete any irrelevant options.

  • New feature (non-breaking change which adds functionality)

Testing

Ask any model to create prose or code using artifacts.

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

@alex-torregrosa alex-torregrosa force-pushed the extra-artifacts branch 3 times, most recently from b01d157 to 3db8349 Compare December 18, 2024 17:24
Added rendering of pure markdown artifacts for prose text. The code
markdown preview is reused to render the markdown, and the html preview
tab is disabled and hidden.
When dealing with most programming languages, the preview is not needed.
This adds support for `application/vnd.code` artifacts that specify the
`language` attribute.

It propagates it to the generated markdown code block, and disables the
preview tab like `text/markdown` does.
Also modified the HTML prompt to use it when it does not need to be
rendered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: Markdown in Artifacts
1 participant