API Documentation

Complete reference for all classes, methods, and parameters — Story Development Toolkit v2.2.2

Python 3.11+ v2.2.2 MIT LLM Ready Memory Ready Export Ready Templates Ready CLI Ready
Version History - From v1.0.0 to v2.2.2
8 May 2026 - Complete feature evolution

v1.0.0 - Core Features (Base Version)

Release Date: May 7, 2026  |  Python: 3.8+

Description: Initial release with core story development features.

📦 Core Modules
Module Description
StoryEngine Main story creation and management engine
Character Character creation with traits, goals, skills, fears, relationships
Plot Plot structure with points and subplots
WorldBuilder World building with locations, cultures, rules, factions
🎲 Generators
Generator Description
CharacterGenerator Random character generation
PlotGenerator Genre-based plot generation (fantasy, mystery, romance, adventure, sci-fi)
DialogueGenerator Template-based dialogue generation
🔍 NLP Tools
Tool Description
CoherenceChecker Story coherence analysis and plot hole detection
TextAnalyzer Readability and text quality analysis
python
from story_toolkit import StoryToolkit

toolkit = StoryToolkit()
story = toolkit.create_story("fantasy", "courage")
hero = toolkit.add_character_to_story(story, "Kai", "protagonist")
hero.add_trait("brave")

v2.0.0 - LLM Layer (AI Integration)

Release Date: May 7, 2026  |  Python: 3.11+

Description: Added optional LLM integration for advanced dialogue generation.

🤖 New: LLM Module
Component Description
LLMFactory Factory for creating LLM backends
LLMProvider Enum: OPENAI, ANTHROPIC, LOCAL, MOCK
BaseLLMBackend Abstract base class for LLM backends
MockLLMBackend Mock backend for testing (no API key)
💬 Advanced Dialogue Features
  • use_advanced parameter - Enable LLM for dialogue
  • style parameter - natural, dramatic, poetic, humorous
  • num_lines parameter - Control dialogue length
🆕 New Methods
  • get_llm_status() - Check LLM availability
  • generate_advanced_dialogue() - Direct LLM dialogue
  • has_llm() / get_llm_info() - LLM info retrieval
python
from story_toolkit.llm import LLMFactory, LLMProvider

llm = LLMFactory.create_backend(provider=LLMProvider.MOCK)
toolkit = StoryToolkit(llm_backend=llm)

dialogue = toolkit.dialogue_gen.generate_dialogue(
    "Hero", "Villain",
    use_advanced=True,
    style="dramatic",
    num_lines=8
)

v2.1.0 - Memory Layer (SQLite)

Release Date: May 8, 2026  |  Python: 3.11+

Description: Added long-term memory with SQLite database backend.

💾 New: Memory Module
Component Description
MemoryManager High-level memory management
SQLiteMemory SQLite backend implementation
StoryModel Story data model
EventModel Event/timeline data model
CharacterModel Character storage model
📅 Timeline & Events
  • add_event() - Add events to story timeline
  • get_timeline() - Retrieve chronological timeline
  • list_stored_stories() - List all saved stories
  • load_story_from_memory() - Load saved story
  • search_memory() - Search events by keyword
python
toolkit = StoryToolkit(memory_backend="sqlite", db_path="stories.db")
story = toolkit.create_story("fantasy", "courage", save_to_memory=True)
toolkit.add_event(1, "Hero finds map", "plot", 9)
timeline = toolkit.get_timeline()

v2.2.0 - Exporters (PDF, EPUB, HTML, Bionic)

Release Date: May 8, 2026  |  Python: 3.11+

Description: Multi-format export capabilities.

📄 Export Formats
Format Description Styles
PDF Print/Manuscript/Ebook PRINT, MANUSCRIPT, EBOOK
EPUB eBook format Amazon, Kobo, Apple Books compatible
HTML Web page MODERN, CLASSIC, DARK, MINIMAL
Bionic Enhanced readability Configurable strength (1-3 letters)
🆕 New Exporters
  • EPUBExporter - Export to eBook format
  • PDFExporter - Export to PDF with 3 styles
  • HTMLExporter - Export to HTML with 4 templates
  • to_bionic() - Convert text to Bionic Reading format
python
from story_toolkit.exporters import PDFExporter, ExportConfig, PDFStyle

config = ExportConfig(title="My Story", author="Me", pdf_style=PDFStyle.PRINT)
exporter = PDFExporter(config)
exporter.export(story, "my_story.pdf")

v2.2.1 - Pre-built Story Templates

Release Date: May 8, 2026  |  Python: 3.11+

Description: 5 ready-to-use story structures.

📋 Available Templates
Template Genre Stages Description
hero_journey Fantasy/Adventure 12 Campbell's monomyth
three_act General 3 Standard 3-act structure
mystery_clues Mystery 5 Detective story structure
romance_beat Romance 15 15-beat romance structure
horror_cycle Horror 6 Classic horror structure
🆕 New Methods
  • use_template(name, genre, theme) - Create story from template
  • list_templates() - List all available templates
  • get_template_info(name) - Get template details
python
story = toolkit.use_template("hero_journey", genre="fantasy", theme="redemption")
templates = toolkit.list_templates()
for t in templates:
    print(t['name'], t['stage_count'])

v2.2.2 - CLI Tool (Command Line Interface)

Release Date: May 8, 2026  |  Python: 3.11+

Description: Full command-line interface for easy usage.

💻 CLI Commands
Command Description Example
story new Create new story story-toolkit story new --genre fantasy --theme courage
story list List stories in memory story-toolkit story list
template list List all templates story-toolkit template list
template use Use a template story-toolkit template use hero_journey
bash
story-toolkit story new --genre fantasy --theme courage --output my_story.json
story-toolkit template list
story-toolkit template use hero_journey --output epic.json

StoryToolkit (Main Class)

Constructor Options

python
from story_toolkit import StoryToolkit

# v1.0.0 style (no extras)
toolkit = StoryToolkit()

# v2.0.0 - With LLM
toolkit = StoryToolkit(llm_backend=llm)

# v2.1.0 - With Memory
toolkit = StoryToolkit(memory_backend="sqlite", db_path="stories.db")

# v2.2.2 - With everything
toolkit = StoryToolkit(llm_backend=llm, memory_backend="sqlite")

All Methods (by version)

Method Version Description
create_story() v1.0.0 Create new story
add_character_to_story() v1.0.0 Add character to story
check_story_coherence() v1.0.0 Check story coherence
generate_full_story() v1.0.0 Generate complete story
export_story() v1.0.0 Export to JSON/Markdown/TXT
get_llm_status() v2.0.0 Get LLM backend status
generate_advanced_dialogue() v2.0.0 Generate with LLM
add_event() v2.1.0 Add event to timeline
get_timeline() v2.1.0 Get story timeline
load_story_from_memory() v2.1.0 Load story from database
list_stored_stories() v2.1.0 List saved stories
use_template() v2.2.1 Use pre-built template
list_templates() v2.2.1 List available templates
get_template_info() v2.2.1 Get template details

StoryEngine (v1.0.0)

python
engine = StoryEngine()
outline = engine.create_story_outline("fantasy", "courage")
engine.add_chapter("The Beginning")
progress = engine.get_story_progress()

Character (v1.0.0)

python
hero = Character(name="Elena", age=32, role="protagonist")
hero.add_trait("brave")
hero.add_goal("Save the kingdom")
hero.add_skill("sword_mastery")
hero.add_relationship("Villain", "enemy", strength=9)
hero.advance_arc()

Plot (v1.0.0)

python
plot = Plot()
point = plot.add_plot_point("Discovery", "Hero finds map", 3, 8)
subplot = plot.add_subplot("Love Story", "Romance subplot", ["Hero", "Heroine"])
timeline = plot.get_plot_timeline()

WorldBuilder (v1.0.0)

python
world = WorldBuilder()
world.create_world("Eldoria", "fantasy")
world.add_location("Crystal City", "Ancient metropolis", "city")
world.add_rule("magical", "Only pure hearts can use magic")
world.add_faction("Shadow Guild", "Secret organization", goals=["control_magic"])

Generators (v1.0.0)

python
from story_toolkit.generators import CharacterGenerator, PlotGenerator

char_gen = CharacterGenerator()
hero = char_gen.generate_character("protagonist", complexity=4)

plot_gen = PlotGenerator()
plot = plot_gen.generate_plot("mystery", complexity=3)

DialogueGenerator (Updated in v2.0.0)

python
# v1 style (template-based)
dialogue = toolkit.dialogue_gen.generate_dialogue("Hero", "Villain", context="conflict")

# v2 style (LLM-powered)
dialogue = toolkit.dialogue_gen.generate_dialogue(
    "Hero", "Villain",
    use_advanced=True,
    style="dramatic",
    num_lines=10
)

CoherenceChecker (v1.0.0)

python
report = toolkit.check_story_coherence(story)
print(f"Score: {report['overall_score']:.0%}")

if report['plot_holes']:
    for hole in report['plot_holes']:
        print(f"⚠️ {hole}")

TextAnalyzer (v1.0.0)

python
from story_toolkit.nlp.text_analyzer import TextAnalyzer

analyzer = TextAnalyzer()
analysis = analyzer.analyze_text("The old house stood on the hill.")
print(analysis["readability_score"])

Utility Functions (v1.0.0)

python
from story_toolkit.utils.helpers import save_story, load_story, export_to_markdown

save_story(story, "my_story.json")
loaded = load_story("my_story.json")
export_to_markdown(story, "my_story.md")
Easy Upgrade - No Breaking Changes!
All code written for v1.0.0 works perfectly in v2.2.2. Just upgrade with:
pip install --upgrade story-toolkit
Your existing stories, characters, and plots will continue to work unchanged.

Installation Options

bash
# Core only (v1)
pip install story-toolkit

# With LLM (v2.0.0)
pip install story-toolkit[openai]
pip install story-toolkit[anthropic]
pip install story-toolkit[local]

# With Exporters (v2.2.0)
pip install story-toolkit[export]

# Everything (v2.2.2)
pip install story-toolkit[all]