fabricatio_novel.actions.novel
This module provides actions related to novel generation and management.
It includes classes such as GenerateNovel for creating novels based on prompts, and DumpNovel for saving generated novels to a specified file path. These actions leverage capabilities from the fabricatio_core and interact with both Python and Rust components to perform their tasks.
Classes
Generate character cards from a NovelDraft. |
|
Generate chapter scripts from a draft and list of characters. |
|
Generate full chapter contents from scripts and characters. |
|
Assemble final Novel object from draft, scripts, and chapter contents. |
|
Validate the generated novel for compliance and structure. |
|
Generate a novel draft from a prompt. |
|
An action that generates a novel based on a provided prompt. |
|
An action that saves a generated novel to a specified file path. |
Module Contents
- class fabricatio_novel.actions.novel.GenerateCharactersFromDraft(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionGenerate character cards from a NovelDraft.
- novel_draft: fabricatio_novel.models.draft.NovelDraft | None = None
The novel draft from which to generate characters.
- class fabricatio_novel.actions.novel.GenerateScriptsFromDraftAndCharacters(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionGenerate chapter scripts from a draft and list of characters.
- novel_draft: fabricatio_novel.models.draft.NovelDraft | None = None
The novel draft containing chapter synopses.
- novel_characters: List[fabricatio_character.models.character.CharacterCard] | None = None
List of character cards to be used in script generation.
- class fabricatio_novel.actions.novel.GenerateChaptersFromScripts(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionGenerate full chapter contents from scripts and characters.
- novel_draft: fabricatio_novel.models.draft.NovelDraft | None = None
The novel draft (for language, metadata).
- novel_scripts: List[fabricatio_novel.models.scripting.Script] | None = None
The list of chapter scripts to expand into full text.
- novel_characters: List[fabricatio_character.models.character.CharacterCard] | None = None
The list of characters to provide context.
- class fabricatio_novel.actions.novel.AssembleNovelFromComponents(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionAssemble final Novel object from draft, scripts, and chapter contents.
- novel_draft: fabricatio_novel.models.draft.NovelDraft | None = None
The original draft containing title, synopsis, etc.
- novel_scripts: List[fabricatio_novel.models.scripting.Script] | None = None
Scripts containing chapter titles and metadata.
- class fabricatio_novel.actions.novel.ValidateNovel(/, **data: Any)
Bases:
fabricatio_core.ActionValidate the generated novel for compliance and structure.
- novel: fabricatio_novel.models.novel.Novel | None = None
The novel to validate.
- class fabricatio_novel.actions.novel.GenerateNovelDraft(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionGenerate a novel draft from a prompt.
- novel_outline: str | None = None
The prompt used to generate the novel. If not provided, execution will fail.
- novel_language: str | None = None
The language of the novel. If not provided, will infer from the prompt.
- class fabricatio_novel.actions.novel.GenerateNovel(/, **data: Any)
Bases:
fabricatio_novel.capabilities.novel.NovelCompose,fabricatio_core.ActionAn action that generates a novel based on a provided prompt.
This class inherits from NovelCompose and Action, and is responsible for generating a novel using the underlying novel generation capability. The generated novel is returned as a Novel object.
- novel_outline: str | None = None
The prompt used to generate the novel. If not provided, execution will fail.
- class fabricatio_novel.actions.novel.DumpNovel(/, **data: Any)
Bases:
fabricatio_core.ActionAn action that saves a generated novel to a specified file path.
This class takes a Novel object and writes its content to a file at the specified path.
- output_path: pathlib.Path | None = None
The file system path where the novel should be saved. Required for execution.
- novel_font_file: pathlib.Path | None = None
The file system path to the novel font file. like .ttf file.
- novel: fabricatio_novel.models.novel.Novel | None = None
The novel object to be saved. Must be provided for successful execution.
- cover_image: pathlib.Path | None = None
The file system path to the novel cover image.