Skip to content

Repository files navigation

Dynamic System Prompt Frameork

Disclaimer: This a prototype to test a concept and will not be maintained.

A modular framework for building dynamic prompts with pluggable components for AI systems.

Features

  • Modular Components: Define reusable prompt components with type-specific behaviors
  • Dynamic Templates: Flexible prompt structures with variable insertion
  • Working Memory: Automatic conversation history management with intelligent summarization
  • Easy Experimentation: Swap components and templates on the fly
  • Web UI: Modern web interface for configuration and management
  • Character System: Save and load different AI configurations
  • Event System: Monitor and react to system changes
  • Provider Abstraction: Support for different LLM backends

ss1.png ss2.png

Quick Start

  1. Ensure you have the dependencies installed:
pip install langchain langchain-community langgraph langchain-ollama flask flask-cors
  1. Make sure Ollama is running:
ollama serve  # In one terminal
ollama pull gemma3:latest  # Or any other model you prefer
  1. Run the web UI:
python start_web_ui.py
  1. Access the web interface at http://localhost:5000

Framework Structure

dynamic_ai_framework/
├── core/           # Core framework classes
├── components/     # Reusable prompt components  
├── templates/      # Prompt structure templates
├── providers/      # LLM provider abstractions
└── storage/        # Storage backend implementations

Basic Usage

from dynamic_ai_framework import (
    DynamicPromptManager, PromptStructure, OllamaLLMProvider,
    create_basic_components, create_simple_chat_template
)

# Initialize components
components = create_basic_components()
template = create_simple_chat_template()

# Create framework instances
structure = PromptStructure(template, components)
llm_provider = OllamaLLMProvider("gemma3:latest")
manager = DynamicPromptManager(structure, llm_provider)

# Chat
response = manager.get_response("Hello! How are you?")
print(response)

# Update components
manager.update_component("context", "We're discussing AI frameworks")

Creating Custom Components

from dynamic_ai_framework.core import TypedPromptComponent, ComponentType

# Define a custom component with type-specific behavior
custom_component = TypedPromptComponent(
    name="mood",
    component_type=ComponentType.CUSTOM,
    content="I'm feeling curious and helpful today!",
    update_strategy="manual"
)

# Use in templates
template = "PERSONALITY: {personality}\nMOOD: {mood}\n\nRespond to: {user_input}"

This framework provides a foundation for experimenting with dynamic prompt engineering!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages