๐ A next-generation AI story generator powered by Google's Gemini model
Narr_ai_tive is an advanced AI-powered story generator that leverages Google's Gemini model to create rich, engaging narratives. Here is a detailed overview of its features and functionalities:
- Overview
- Features
- Quick Start
- Usage
- Project Structure
- Configuration
- License
- Show Your Support
- Roadmap
- ๐ค Gemini-Powered Generation - Leverage Google's cutting-edge language model
- ๐ญ Multiple Story Styles - From dark fantasy to sci-fi and beyond
- ๐ฅ Character Integration - Deep character development and consistency
- ๐ World Building - Rich world details and environment descriptions
- ๐ Plot Management - Smart context tracking and story progression
- ๐งฎ Semantic Search - Find relevant context using advanced embeddings
- ๐ Auto-Chunking - Intelligent content organization
- ๐พ Caching System - Efficient generation with smart caching
- ๐ญ Character Profiles - Detailed character management
- ๐ World Details - Comprehensive world-building system
- ๐ Multi-Metric Evaluation - ROUGE, BLEU, semantic similarity
- ๐ Lexical Analysis - Vocabulary richness and diversity checks
- ๐ Iterative Improvement - Quality-based regeneration
- โ๏ธ Configurable Thresholds - Customizable quality standards
- ๐จ Rich TUI - Beautiful terminal interface with progress tracking
- โจ๏ธ CLI Support - Command-line automation capabilities
- ๐ฑ Interactive Mode - Dynamic story development
- ๐ Export Options - Multiple output formats (TXT, MD, HTML)
Before installing Narr_ai_tive, ensure you have:
- Python 3.8+
- Hatchling
- Google API key (Gemini access)
- Document embeddings in
data/embeddings.json
- See Embeddings Setup Guide
- Must be generated before running the application
- Uses sentence-transformers format
- Required for semantic search functionality
data/
โโโ embeddings.json # Your document embeddings
โโโ character_profiles.json
โโโ world_details.json
- Google Gemini API key
- Store in
secrets.yaml
- Never commit this file to version control
# Clone repository
git clone https://github.com/yourusername/Narr_ai_tive.git
cd Narr_ai_tive
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# OR
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Setup configuration
cp config.yaml.example config.yaml
# Add your API key to secrets.yaml
python -m app.main
# Generate a single chapter
narr_ai_tive generate --query "A mystical journey begins" --style "epic fantasy"
# Generate with character focus
narr_ai_tive generate --input story.txt --character "Elena" --situation "dark forest"
from narr_ai_tive import StoryGenerator, load_config
# Initialize generator
config = load_config()
generator = StoryGenerator(config)
# Generate content
story = generator.generate_chapter(
query="Ancient secrets revealed",
style="mystery",
character="Professor Blake"
)
๐ฆ Narr_ai_tive
โฃ ๐ app
โ โฃ ๐ chapter.py # Chapter generation
โ โฃ ๐ character.py # Character management
โ โฃ ๐ context.py # Context handling
โ โฃ ๐ export.py # Story export functionality
โ โฃ ๐ interactive.py # Interactive story mode
โ โฃ ๐ main.py # Application entry point
โ โฃ ๐ path_utils.py # Path resolution utilities
โ โฃ ๐ plot.py # Plot management
โ โฃ ๐ prompt.py # Prompt engineering
โ โฃ ๐ semantic_search.py # Content search
โ โฃ ๐ session.py # Session management
โ โฃ ๐ setup_logging.py # Logging configuration
โ โฃ ๐ story.py # Story generation core
โ โฃ ๐ text_processing.py # Text processing utilities
โ โฃ ๐ tui.py # Terminal user interface
โ โฃ ๐ utils.py # Utility functions
โ โ ๐ world.py # World-building management
โฃ ๐ data
โ โฃ ๐ character_profiles.json
โ โฃ ๐ embeddings.json
โ โ ๐ world_details.json
โฃ ๐ config.yaml # Configuration
โ ๐ secrets.yaml # API keys
api:
batch_size: 10
rate_limit: 10
embedding:
chunk_size: 5000
model: models/embedding-001
generation:
temperature: 0.7
model: models/gemini-exp-1206
MIT License - feel free to use in your own projects!
Give a โญ๏ธ if this project helped you!
-
Location Selection
- Implement hierarchical location prompts to allow users to select locations in a structured manner.
- Provide detailed descriptions for each location to enhance user understanding and selection accuracy.
-
Theme and Motif Selection
- Introduce checkbox-style selection for themes and motifs to allow users to select multiple options easily.
- Offer explanations for each theme and motif to help users make informed choices.
-
Lore Element Management
- Add a "Quick Add" feature for lore elements to streamline the addition of new lore.
- Develop a dedicated lore menu for more complex edits and management of lore elements.
- Ensure that changes to lore are saved and integrated seamlessly into the application.
-
Integrating World Details into
create_prompt()
- Incorporate selected locations, themes, and motifs into the prompt generation process.
- Emphasize the importance of these elements in the generated prompts.
- Integrate contextual and explicit lore references to enrich the prompts.
-
Example and Further Refinements
- Provide a comprehensive example that demonstrates the integration of world details into the prompt generation process.
- Identify areas for further refinement and improvement.
-
Emotional State
- Offer predefined emotion options and allow for free-form emotion input.
- Introduce emotion intensity levels to capture the depth of the character's feelings.
- Implement emotion processing to reflect changes in the character's emotional state.
-
Immediate Goals
- Prompt users to input the character's immediate goals.
- Optionally categorize goals by type and relate them to long-term goals.
-
Relationship Relevance
- Allow users to select relevant relationships and include relationship details in the prompt.
-
Relationship Dynamics in Focus
- Enable selection of interaction partners and retrieval of relationship descriptions.
- Prompt users to input the current state of relationships and incorporate these states into the prompt.
-
**Integrating into
create_prompt()
- Seamlessly integrate character profile interactions into the prompt generation process.
-
Further Considerations
- Explore additional ways to enhance character profile interactions.
-
Plot Point Integration
- Allow users to select plot points with descriptions and set adherence levels.
- Enable marking plot points as completed or modified and prepending plot points to the prompt.
-
Customizable Chapter Tone and Mood
- Introduce tone and mood selection with optional intensity levels.
- Incorporate selected tone and mood into the prompt.
-
Style Prompt Refinements
- Provide a prompt for style refinements and integrate these refinements into the prompt.
-
Multi-Part Chapter Generation
- Offer an option for multi-part chapter generation with part-specific prompts.
- Combine generated parts into a cohesive chapter.
-
Example and Further Refinements
- Provide an example that demonstrates the integration of plot points, tone, mood, and style refinements.
- Identify areas for further refinement and improvement.
-
Direct Prompt Editing
- Introduce a "Show Prompt" option to display and edit the generated prompt.
- Implement input validation to ensure the edited prompt is valid.
-
Parameter Tuning Per Chapter
- Allow users to adjust chapter generation settings and store chapter-specific parameters.
- Pass these parameters to the
generate_story()
andgenerate_chapter()
functions.
-
Embedding/Context Selection
- Display top chunks of context and allow users to select relevant chunks for embedding.
-
Example and Further Refinements
- Provide an example that demonstrates advanced customization and control.
- Identify areas for further refinement and improvement.
-
TUI Design with
rich
- Use
rich
panels, layouts, tables, and progress bars to create a user-friendly TUI. - Implement
Prompt.ask()
with choices andConfirm.ask()
for user inputs.
- Use
-
Error Handling
- Ensure robust input validation and exception handling.
- Provide user-friendly error messages.
-
Modularity
- Develop focused functions with well-defined interfaces and reusable components.
- Organize code into modules and packages for better maintainability.
-
User Experience
- Provide clear instructions, intuitive flow, and feedback mechanisms.
- Offer help and documentation, and ensure accessibility.
-
Example: Combining
rich
Techniques- Demonstrate the use of
rich
techniques in a comprehensive example.
- Demonstrate the use of
Made with โค๏ธ using Google's Gemini