Metadata-Version: 2.4
Name: promptev
Version: 0.0.1
Summary: Promptev SDK for accessing Promptev API
Author-email: Promptev Inc <support@promptev.ai>
License: Promptev SDK License
        
        Copyright © 2025 Promptev Inc.
        
        This software is proprietary and protected under applicable copyright laws.
        By using this software, you agree to the following:
        
        1. You may use this SDK:
           - Free of charge on the Free Tier of Promptev services
           - For evaluation or development purposes
           - In production only with an active Promptev subscription
        
        2. Restrictions:
           - You may NOT sublicense, distribute, or reverse-engineer this software
           - You may NOT modify or resell this SDK or derivative works
           - You may NOT use this SDK outside the Promptev API without a license
        
        3. The SDK is provided “AS IS” without warranties. Promptev Inc. shall not be held liable for any damages.
        
        By using this software, you accept these terms. For licensing inquiries or enterprise use, contact support@promptev.ai.
        
Project-URL: Homepage, https://promptev.ai
Keywords: Promptev,promptev,prompts,api,client,sdk,ai,promptDev,promptdev,promptops,python
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Provides-Extra: cache
Requires-Dist: cachetools>=5.3.0; extra == "cache"
Dynamic: license-file

# promptev-client

A lightweight Python SDK to securely fetch and format prompts from [Promptev.ai](https://promptev.ai) using your project API key.

---

## Installation

```bash
pip install promptev
```

> Optional (recommended for production caching and background refresh):
```bash
pip install cachetools
```

---

## What is Promptev?

[Promptev](https://promptev.ai) helps teams manage, version, and collaborate on AI prompts at scale — with variables, live context packs, histories, cost estimation, and SDK access.

---

## Usage

### 1. Initialize the client

```python
from promptev import PromptevClient

client = PromptevClient(project_key="pv_sk_abc123yourkey")
```

---

### 2. Fetch a prompt with variables

```python
output = client.get_prompt("onboarding-email", {
    "name": "Ava",
    "product": "Promptev"
})

print(output)
# Output: "Subject: Welcome, Ava! Hey Ava, Thanks for joining Promptev..."
```

---

### 3. Fetch a prompt without variables

```python
output = client.get_prompt("static-welcome")
print(output)
# Output: "You are a helpful AI assistant ready to support the user."
```

> ⚠️ If the prompt has no variables, you can omit the second argument.

---

### 4. Async Usage (e.g. in FastAPI or notebooks)

```python
import asyncio

async def run():
    prompt = await client.aget_prompt("faq-response", {
        "question": "How do I reset my password?"
    })
    print(prompt)

asyncio.run(run())
```

---

## Example: Use with LLM APIs

### OpenAI

```python
from openai import OpenAI

client = OpenAI(api_key="sk-...")

prompt = promptev_client.get_prompt("explain-topic", {
    "topic": "Prompt Engineering"
})

response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": prompt}]
)

print(response.choices[0].message.content)
```

---

## Features

- ✅ Supports prompts with or without variables
- 🔁 Smart caching (via `dict` or `TTLCache`)
- 🧠 Built-in variable formatting & validation
- ⚡ Sync + Async compatible
- 🔐 Works with any LLM (OpenAI, Claude, Gemini, etc.)
- 🔌 BYOK + airgapped environment ready

---

## Error Handling

```python
# ❌ Missing required variable
client.get_prompt("onboarding-email", { "name": "Leo" })
# ➜ ValueError: Missing required variables: product
```

---

## Prompt Template Example

```text
Subject: Welcome, {{ name }}!

Hey {{ name }},

Thanks for joining {{ product }}. We're thrilled to have you on board!
```

---

## License

This SDK is **commercial software** by Promptev Inc.

By using this package, you agree to the terms in [`LICENSE.txt`](./LICENSE.txt).

- ✅ Free tier use allowed
- 🚫 Production usage requires a subscription

---

## Contact

- 🌐 [https://promptev.ai](https://promptev.ai)
- 📧 support@promptev.ai
