Koen
02/05/2025, 2:57 PMMarvin
02/05/2025, 2:58 PMcreate_markdown_artifact()
function. Here's a basic example of how you might do this within a task:
python
from prefect import task, flow
from prefect.artifacts import create_markdown_artifact
@task
def my_task():
markdown_content = """
# My Markdown Artifact
This is a simple markdown artifact created in a Prefect task.
"""
create_markdown_artifact(markdown=markdown_content, key="my-markdown-artifact")
@flow
def my_flow():
my_task()
my_flow()
### Important Notes:
- Key Argument: If you provide a key
argument to create_markdown_artifact()
, it allows you to track the artifact's history over time. Without a key, the artifact is only visible in the Artifacts tab of the associated flow run or task run.
- Markdown Formatting: Be careful not to indent your Markdown in multi-line strings, as this can lead to incorrect interpretation.
For more details, you can refer to the Prefect documentation on artifacts.
If you need further assistance or have specific requirements, feel free to ask.