Skip to content

honey16/shakescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽญ ShakeScript - AI-Based Story Creation Platform

ShakeScript is a cutting-edge, AI-powered storytelling system designed to generate immersive, multi-episode narratives with rich characters, evolving plots, and long-term memory. By blending the strengths of GPT-4o and Google Gemini, it overcomes traditional limitations in AI storytellingโ€”like token constraints and inconsistent narratives.


๐Ÿ” Problem Statement

Traditional AI-generated stories often struggle with:

Challenge Description
๐Ÿ”„ Narrative Coherence Maintaining seamless connections between episodes
๐Ÿง  Token Limitations Handling restricted context windows in large language models
๐Ÿ‘ค Character Consistency Preserving character traits, relationships, and emotional states
๐Ÿ“š Extended Narratives Structuring long stories into coherent, episodic chunks
๐Ÿ’พ AI Memory Integration Retaining relevant story context across episodes

๐Ÿš€ ShakeScript: Your AI Storytelling Engine

ShakeScript enables long-form storytelling with AI memory, human feedback integration, and cultural nuance.

โœ… Core Capabilities

  • Accepts brief prompts (genre, trope, or plotline)
  • Generates multi-episode stories with world-building and character arcs
  • Maintains narrative continuity via metadata & embeddings
  • Supports Hinglish storytelling
  • Offers both AI-driven and human-in-the-loop episode refinement
  • Uses a robust database + semantic embeddings for memory

๐Ÿ“‚ Architecture & Workflow

1๏ธโƒฃ Prompt to Metadata Extraction (via Google Gemini)

  • Endpoint: /stories
  • Gemini extracts:
    • Characters: Names, roles, relationships, emotions
    • Settings: Detailed location descriptions
    • Structure: Exposition โ†’ Climax โ†’ Denouement
    • Theme & Tone: (e.g., Suspenseful, Romantic)
  • Data stored in Supabase:
    • stories, characters tables

2๏ธโƒฃ Episode Generation (via GPT-4o)

Initial Episode

  • Uses structured metadata
  • Generates the episode aligned to outline (e.g., Exposition)

Subsequent Episodes

  • Retrieves up to 2-3 past episodes for context
  • Embeddings fetch relevant content chunks for long-form continuity
  • Ensures:
    • Character consistency
    • Thematic alignment
    • Narrative progression

Storage

  • Saves episode content, title, summary, emotion in episodes table
  • Splits episode into semantic chunks using SemanticSplitterNodeParser
  • Vectorizes & stores in chunks table

3๏ธโƒฃ Validation & Refinement (via Gemini)

AI Validation (validation.py)

  • Checks:
    • Timeline alignment
    • Character location/motivation consistency
    • Dialogue and tone coherence
  • Refines up to 3 times if inconsistencies found

Human Feedback Support (episodes.py)

  • Users can refine via /refine-batch
  • Gemini regenerates while preserving core elements

Batch Processing (refinement.py)

  • Default batch size: 2 episodes
  • Intermediate state stored in current_episodes_content

4๏ธโƒฃ Memory Management

Supabase (db_service.py)

  • Tracks:
    • current_episode
    • key_events, timeline
    • Character evolution

Embedding Service (embedding_service.py)

  • HuggingFace embeddings vectorize story chunks
  • Relevance scored based on:
    • Characters involved
    • Episode order
  • Enables memory-aware story generation

5๏ธโƒฃ API & Frontend Integration

FastAPI Backend

  • Endpoints:
    • /stories โ€“ Create new story
    • /generate-batch โ€“ Batch generate episodes
    • /validate-batch โ€“ AI validation
    • /refine-batch โ€“ Human feedback and refinement
  • Uses Pydantic models for structure (schemas.py)

Frontend (Planned)

  • React/Next.js UI
  • Features:
    • Episode display
    • Character profiles
    • Hinglish support
    • Real-time story updates

๐Ÿ› ๏ธ Tech Stack

Category Technologies Used
AI & NLP GPT-4o, Google Gemini, HuggingFace Embeddings
Backend FastAPI, Pydantic, Asyncio
Database Supabase (PostgreSQL)
Embeddings & Retrieval LlamaIndex (SemanticSplitterNodeParser), Supabase Vector DB
Language Python 3.13 with type hints

๐ŸŽฏ Key Achievements

  • ๐Ÿ† Multi-Episode Consistency โ€“ Maintains coherent, evolving narratives
  • ๐Ÿ’ก Token Limit Workaround โ€“ Smart retrieval with embeddings
  • ๐Ÿ‘ค Character Evolution โ€“ Tracks traits, arcs, and relationships
  • ๐Ÿ” AI + Human Refinement โ€“ Combines LLM polish with user feedback
  • ๐ŸŒ Hinglish Support โ€“ Culturally tuned storytelling

๐Ÿ–ผ๏ธ Visuals & Evaluations

๐Ÿงฉ Model Pipeline

Model Pipeline


๐Ÿ“ˆ Radar Chart - Story Attribute Comparison

Radar Chart


๐Ÿชฑ Worm Graph - Evaluation Metrics (out of 10)

Worm Chart


๐Ÿ”ฎ Future Enhancements

Feature Description
๐ŸŽฎ Interactive Storylines Let users influence story direction via input parameters
๐ŸŽง TTS Narration Audio playback support with Text-to-Speech
๐Ÿง  Custom AI Models Fine-tune LLMs for specific genres or styles
๐Ÿ“ฑ Frontend UI Responsive, real-time React/Next.js interface
๐Ÿ” Smart Retrieval Advanced hybrid/cosine similarity chunk search

๐Ÿ’ฌ Final Thoughts

ShakeScript redefines AI-powered storytelling by:

  • Solving token limitation challenges
  • Supporting long-form, culturally nuanced storytelling
  • Seamlessly blending LLMs, embeddings, and human input

๐ŸŽ‰ Let the stories unfold โ€” with ShakeScript, your narrative has no limits.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published