> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evalit.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PromptManager

Manage versioned prompts with a lightweight JSON store.

## Import

```python theme={null}
from evalit import PromptManager
```

## Quick start

```python theme={null}
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:

```json theme={null}
{
  "prompts": {
    "<name>": {
      "versions": [
        {
          "version": 1,
          "template": "...",
          "message": "Initial version",
          "created_at": "2025-08-22T12:34:56.000000"
        }
      ],
      "active_version": 1
    }
  }
}
```
