from mixtrain import Text, Markdown, JSONOverview
Use text types for inline content rather than downloadable files. Mixtrain displays each value with the right formatting in the app.
Text
Plain text output.
Text(content: str)| Property | Type | Description |
|---|---|---|
content | str | Text content |
from mixtrain import Text
text = Text(content="Hello, world!")Markdown
Markdown-formatted text. Mixtrain displays it with Markdown formatting.
Markdown(content: str)| Property | Type | Description |
|---|---|---|
content | str | Markdown content |
from mixtrain import Markdown
report = Markdown(content="# Results\n\n- Item 1\n- Item 2\n\n**Done.**")JSON
Structured JSON data. Mixtrain displays it with syntax highlighting.
JSON(data: dict | list)| Property | Type | Description |
|---|---|---|
data | dict | list | JSON-serializable data |
from mixtrain import JSON
config = JSON(data={"key": "value", "items": [1, 2, 3]})Using Text Types
You can use Text, Markdown, and JSON in your models, datasets, workflows, and routines.
from mixtrain import MixModel
from mixtrain import Text, Markdown, JSON
class ReportGenerator(MixModel):
def run(self, inputs=None):
return {
"summary": Text(content=f"Processed {inputs['count']} items"),
"details": Markdown(content="# Full Report\n\n..."),
"metadata": JSON(data={"version": 2, "status": "ok"})
}From ModelResult
result = model.run({"query": "What's new?"})
if result.text:
print(result.text) # Access as stringModelResult.text returns the first string-like output from results, output, text, response, or content. For Markdown and JSON outputs, read the raw typed values from result.outputs.