fabricatio_typst.actions.article

Actions for transmitting tasks to targets.

Classes

ExtractArticleEssence

Extract the essence of article(s) in text format from the paths specified in the task dependencies.

FixArticleEssence

Fix the article essence based on the bibtex key.

GenerateArticleProposal

Generate an outline for the article based on the extracted essence.

GenerateInitialOutline

Generate the initial article outline based on the article proposal.

ExtractOutlineFromRaw

Extract the outline from the raw outline.

FixIntrospectedErrors

Fix introspected errors in the article outline.

GenerateArticle

Generate the article based on the outline.

LoadArticle

Load the article from the outline and typst code.

WriteChapterSummary

Write the chapter summary.

WriteResearchContentSummary

Write the research content summary.

CompileKwargs

Keyword arguments passed to typst.compile().

CompileTypstDocument

Compile a Typst document to PDF, PNG, or SVG using the typst compiler.

CompileArticle

Compile a generated Article's .typ file to PDF.

Functions

compile_typst_source(→ pathlib.Path)

Compile a Typst source to disk using the typst compiler.

Module Contents

class fabricatio_typst.actions.article.ExtractArticleEssence(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_core.capabilities.propose.Propose

Extract the essence of article(s) in text format from the paths specified in the task dependencies.

Notes

This action is designed to extract vital information from articles with Markdown format, which is pure text, and which is converted from pdf files using magic-pdf from the MinerU project, see https://github.com/opendatalab/MinerU

output_key: str = 'article_essence'

The key of the output data.

class fabricatio_typst.actions.article.FixArticleEssence(/, **data: Any)

Bases: fabricatio_core.models.action.Action

Fix the article essence based on the bibtex key.

output_key: str = 'fixed_article_essence'

The key of the output data.

class fabricatio_typst.actions.article.GenerateArticleProposal(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_core.capabilities.propose.Propose

Generate an outline for the article based on the extracted essence.

output_key: str = 'article_proposal'

The key of the output data.

class fabricatio_typst.actions.article.GenerateInitialOutline(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_capabilities.capabilities.extract.Extract, fabricatio_improve.capabilities.correct.Correct

Generate the initial article outline based on the article proposal.

output_key: str = 'initial_article_outline'

The key of the output data.

supervisor: bool = False

Whether to use the supervisor to fix the outline.

extract_kwargs: fabricatio_core.models.kwargs_types.ValidateKwargs[fabricatio_typst.models.article_outline.ArticleOutline | None] = None

The kwargs to extract the outline.

class fabricatio_typst.actions.article.ExtractOutlineFromRaw(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_capabilities.capabilities.extract.Extract

Extract the outline from the raw outline.

output_key: str = 'article_outline_from_raw'

The key used to store this action’s output in the context dictionary.

class fabricatio_typst.actions.article.FixIntrospectedErrors(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_rule.capabilities.censor.Censor

Fix introspected errors in the article outline.

output_key: str = 'introspected_errors_fixed_outline'

The key of the output data.

ruleset: fabricatio_rule.models.rule.RuleSet | None = None

The ruleset to use to fix the introspected errors.

max_error_count: int | None = None

The maximum number of errors to fix.

class fabricatio_typst.actions.article.GenerateArticle(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_rule.capabilities.censor.Censor

Generate the article based on the outline.

output_key: str = 'article'

The key of the output data.

ruleset: fabricatio_rule.models.rule.RuleSet | None = None
class fabricatio_typst.actions.article.LoadArticle(/, **data: Any)

Bases: fabricatio_core.models.action.Action

Load the article from the outline and typst code.

output_key: str = 'loaded_article'

The key used to store this action’s output in the context dictionary.

class fabricatio_typst.actions.article.WriteChapterSummary(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_core.capabilities.usages.UseLLM

Write the chapter summary.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.

paragraph_count: int = 1

The number of paragraphs to generate in the chapter summary.

summary_word_count: int = 120

The number of words to use in each chapter summary.

output_key: str = 'summarized_article'

The key under which the summarized article will be stored in the output.

summary_title: str = 'Chapter Summary'

The title to be used for the generated chapter summary section.

skip_chapters: List[str] = None

A list of chapter titles to skip during summary generation.

class fabricatio_typst.actions.article.WriteResearchContentSummary(/, **data: Any)

Bases: fabricatio_core.models.action.Action, fabricatio_core.capabilities.usages.UseLLM

Write the research content summary.

ctx_override: ClassVar[bool] = True

Whether to override the instance attr by the context variable.

summary_word_count: int = 160

The number of words to use in the research content summary.

output_key: str = 'summarized_article'

The key under which the summarized article will be stored in the output.

summary_title: str = 'Research Content'

The title to be used for the generated research content summary section.

paragraph_count: int = 1

The number of paragraphs to generate in the research content summary.

class fabricatio_typst.actions.article.CompileKwargs

Bases: TypedDict

Keyword arguments passed to typst.compile().

format: str
ppi: float
pdf_standards: List[str]
sys_inputs: dict
fabricatio_typst.actions.article.compile_typst_source(typst_source: str | pathlib.Path, output_path: pathlib.Path, **kwargs: Unpack[CompileKwargs]) pathlib.Path

Compile a Typst source to disk using the typst compiler.

Parameters:
  • typst_source – Path to a .typ file, or source content as a string.

  • output_path – Where to write the compiled output.

  • **kwargs – Forwarded to typst.compile(). Key options: format: Output format (“pdf”, “png”, “svg”). Defaults to “pdf”. ppi: Pixels per inch for raster output (png only). Defaults to 144.0. pdf_standards: PDF standards, e.g. [“a-2a”, “ua-1”]. sys_inputs: Values passed to Typst’s sys.inputs.

Returns:

Path to the compiled file.

class fabricatio_typst.actions.article.CompileTypstDocument(/, **data: Any)

Bases: fabricatio_core.models.action.Action

Compile a Typst document to PDF, PNG, or SVG using the typst compiler.

Accepts a Path to a .typ file or source content as a string.

output_key: str = 'compiled_path'

The key used to store this action’s output in the context dictionary.

class fabricatio_typst.actions.article.CompileArticle(/, **data: Any)

Bases: fabricatio_core.models.action.Action

Compile a generated Article’s .typ file to PDF.

Expects the article to have been previously dumped to a .typ file via DumpFinalizedOutput. Reads the .typ from disk, compiles it, and writes the output next to the source.

output_key: str = 'compiled_path'

The key used to store this action’s output in the context dictionary.