ArtifactToolkit
- HTML documents
- SVG graphics
- Mermaid flowcharts and diagrams
- Code snippets (with syntax highlighting)
- Markdown documents
- LaTeX math expressions
_generate_artifact_id
create_html_artifact
- content (str): The HTML content to be displayed.
- title (str, optional): Title for the artifact. Defaults to “HTML Artifact”. (default:
"HTML Artifact"
) - include_css (bool, optional): Whether to include basic CSS styling. Defaults to True. (default: True)
- css_styles (str, optional): Additional CSS styles to include.
_wrap_html_content
_create_html_document
_get_base_styles
create_svg_artifact
- svg_content (str): The SVG content (can be just the inner elements or complete SVG).
- title (str, optional): Title for the artifact. Defaults to “SVG Graphic”. (default:
"SVG Graphic"
) - width (int, optional): Width of the SVG. If not provided, uses SVG’s viewBox or defaults.
- height (int, optional): Height of the SVG. If not provided, uses SVG’s viewBox or defaults.
create_mermaid_flowchart
- flowchart_definition (str): The Mermaid flowchart definition.
- title (str, optional): Title for the flowchart. Defaults to “Flowchart”. (default:
"Flowchart"
) - direction (str, optional): Flow direction (TD, LR, BT, RL). Defaults to “TD”. (default:
"TD"
)
create_code_artifact
- code (str): The source code content.
- language (str, optional): Programming language for syntax highlighting. Defaults to “python”. (default:
"python"
) - title (str, optional): Title for the code artifact. Defaults to “Code Snippet”. (default:
"Code Snippet"
) - show_line_numbers (bool, optional): Whether to show line numbers. Defaults to True. (default: True)
- theme (str, optional): Syntax highlighting theme. Defaults to “github”. (default:
"github"
)
create_markdown_artifact
- markdown_content (str): The Markdown content.
- title (str, optional): Title for the document. Defaults to “Document”. (default:
"Document"
) - include_toc (bool, optional): Whether to include a table of contents. Defaults to False. (default: False)
- theme (str, optional): Styling theme for the document. Defaults to “github”. (default:
"github"
)
create_latex_math
- latex_expression (str): The LaTeX mathematical expression.
- title (str, optional): Title for the math artifact. Defaults to “Mathematical Expression”. (default:
"Mathematical Expression"
) - display_mode (str, optional): Display mode - “block” for centered equations, “inline” for text-style. Defaults to “block”. (default:
"block"
) - show_source (bool, optional): Whether to show the LaTeX source code. Defaults to False. (default: False)
get_artifact_info
- artifact (Dict[str, Any]): The artifact dictionary.