Skip to main content
Manage versioned prompts with a lightweight JSON store.

Import

from evalit import PromptManager

Quick start

pm = PromptManager(db_path="prompts.json")

# Create a prompt or a new version
pm.create(
    name="support-greeting",
    template="Hello {customer_name}, how can I help today?",
    version_message="Initial version"
)

# List versions
pm.list_versions("support-greeting")

# Set active version
pm.set_active("support-greeting", version=1)

# Get active version
active = pm.get("support-greeting")
print(active["template"])  # "Hello {customer_name}, how can I help today?"

API

  • create(name: str, template: str, version_message: str) -> dict
  • get(name: str, version: Optional[int] = None) -> Optional[dict]
  • set_active(name: str, version: int) -> bool
  • list_versions(name: str) -> list[dict]
  • list_prompts() -> list[str]

Data model

The JSON database (prompts.json) structure:
{
  "prompts": {
    "<name>": {
      "versions": [
        {
          "version": 1,
          "template": "...",
          "message": "Initial version",
          "created_at": "2025-08-22T12:34:56.000000"
        }
      ],
      "active_version": 1
    }
  }
}