promptthread 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- promptthread-0.1.0/PKG-INFO +108 -0
- promptthread-0.1.0/README.md +87 -0
- promptthread-0.1.0/promptthread.egg-info/PKG-INFO +108 -0
- promptthread-0.1.0/promptthread.egg-info/SOURCES.txt +8 -0
- promptthread-0.1.0/promptthread.egg-info/dependency_links.txt +1 -0
- promptthread-0.1.0/promptthread.egg-info/requires.txt +1 -0
- promptthread-0.1.0/promptthread.egg-info/top_level.txt +1 -0
- promptthread-0.1.0/promptthread.py +87 -0
- promptthread-0.1.0/setup.cfg +4 -0
- promptthread-0.1.0/setup.py +19 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: promptthread
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git for prompts. Version control and performance tracking for AI prompts.
|
|
5
|
+
Home-page: https://github.com/eugene001dayne/prompt-thread
|
|
6
|
+
Author: Eugene Mawuli
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: httpx
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# PromptThread Python SDK
|
|
23
|
+
|
|
24
|
+
Git for prompts. Version control and performance tracking for AI prompts.
|
|
25
|
+
|
|
26
|
+
Part of the [Thread Suite](https://github.com/eugene001dayne/prompt-thread) — open-source reliability tools for AI agents.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
```bash
|
|
30
|
+
pip install promptthread
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
```python
|
|
35
|
+
from promptthread import PromptThread
|
|
36
|
+
|
|
37
|
+
pt = PromptThread("https://prompt-thread.onrender.com")
|
|
38
|
+
|
|
39
|
+
# Create a prompt
|
|
40
|
+
prompt = pt.create_prompt(
|
|
41
|
+
name="summarizer-v1",
|
|
42
|
+
content="You are a summarizer. Return a 3-sentence summary.",
|
|
43
|
+
description="First summarizer prompt",
|
|
44
|
+
tags=["summarizer"]
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
prompt_id = prompt["id"]
|
|
48
|
+
|
|
49
|
+
# Log a run against it
|
|
50
|
+
pt.log_run(
|
|
51
|
+
prompt_id=prompt_id,
|
|
52
|
+
prompt_version=1,
|
|
53
|
+
input="Long text here...",
|
|
54
|
+
output="Summary here...",
|
|
55
|
+
latency_ms=340.5,
|
|
56
|
+
cost_usd=0.000021,
|
|
57
|
+
passed=True,
|
|
58
|
+
metadata={"model": "gpt-4o"}
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Get performance stats
|
|
62
|
+
stats = pt.get_stats(prompt_id)
|
|
63
|
+
print(stats)
|
|
64
|
+
|
|
65
|
+
# Update the prompt (creates new version automatically)
|
|
66
|
+
pt.update_prompt(
|
|
67
|
+
prompt_id=prompt_id,
|
|
68
|
+
content="You are a summarizer. Return a 2-sentence summary.",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# See what changed
|
|
72
|
+
diff = pt.diff(prompt_id, version_a=1, version_b=2)
|
|
73
|
+
print(diff)
|
|
74
|
+
|
|
75
|
+
# Roll back to version 1
|
|
76
|
+
pt.rollback(prompt_id, version=1)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### Prompts
|
|
82
|
+
|
|
83
|
+
| Method | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `create_prompt(name, content, description, tags)` | Create a new prompt at version 1 |
|
|
86
|
+
| `list_prompts()` | List all prompts |
|
|
87
|
+
| `get_prompt(prompt_id)` | Get a prompt by ID |
|
|
88
|
+
| `update_prompt(prompt_id, content, description, tags)` | Update prompt, auto-increments version |
|
|
89
|
+
| `get_history(prompt_id)` | Get all previous versions |
|
|
90
|
+
| `rollback(prompt_id, version)` | Roll back to a previous version |
|
|
91
|
+
| `diff(prompt_id, version_a, version_b)` | Compare two versions |
|
|
92
|
+
|
|
93
|
+
### Runs
|
|
94
|
+
|
|
95
|
+
| Method | Description |
|
|
96
|
+
|--------|-------------|
|
|
97
|
+
| `log_run(prompt_id, prompt_version, ...)` | Log a run against a prompt version |
|
|
98
|
+
| `get_runs(prompt_id)` | Get all runs for a prompt |
|
|
99
|
+
| `get_stats(prompt_id)` | Get pass rate, latency, cost stats |
|
|
100
|
+
| `compare(prompt_id, version_a, version_b)` | Compare performance between versions |
|
|
101
|
+
|
|
102
|
+
## Part of the Thread Suite
|
|
103
|
+
|
|
104
|
+
| Tool | What it does |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| [Iron-Thread](https://github.com/eugene001dayne/iron-thread) | Validates AI output structure before it hits your database |
|
|
107
|
+
| [TestThread](https://github.com/eugene001dayne/test-thread) | Tests whether your agent behaves correctly across runs |
|
|
108
|
+
| **PromptThread** | Versions and tracks prompt performance over time |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# PromptThread Python SDK
|
|
2
|
+
|
|
3
|
+
Git for prompts. Version control and performance tracking for AI prompts.
|
|
4
|
+
|
|
5
|
+
Part of the [Thread Suite](https://github.com/eugene001dayne/prompt-thread) — open-source reliability tools for AI agents.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```bash
|
|
9
|
+
pip install promptthread
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
```python
|
|
14
|
+
from promptthread import PromptThread
|
|
15
|
+
|
|
16
|
+
pt = PromptThread("https://prompt-thread.onrender.com")
|
|
17
|
+
|
|
18
|
+
# Create a prompt
|
|
19
|
+
prompt = pt.create_prompt(
|
|
20
|
+
name="summarizer-v1",
|
|
21
|
+
content="You are a summarizer. Return a 3-sentence summary.",
|
|
22
|
+
description="First summarizer prompt",
|
|
23
|
+
tags=["summarizer"]
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
prompt_id = prompt["id"]
|
|
27
|
+
|
|
28
|
+
# Log a run against it
|
|
29
|
+
pt.log_run(
|
|
30
|
+
prompt_id=prompt_id,
|
|
31
|
+
prompt_version=1,
|
|
32
|
+
input="Long text here...",
|
|
33
|
+
output="Summary here...",
|
|
34
|
+
latency_ms=340.5,
|
|
35
|
+
cost_usd=0.000021,
|
|
36
|
+
passed=True,
|
|
37
|
+
metadata={"model": "gpt-4o"}
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Get performance stats
|
|
41
|
+
stats = pt.get_stats(prompt_id)
|
|
42
|
+
print(stats)
|
|
43
|
+
|
|
44
|
+
# Update the prompt (creates new version automatically)
|
|
45
|
+
pt.update_prompt(
|
|
46
|
+
prompt_id=prompt_id,
|
|
47
|
+
content="You are a summarizer. Return a 2-sentence summary.",
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# See what changed
|
|
51
|
+
diff = pt.diff(prompt_id, version_a=1, version_b=2)
|
|
52
|
+
print(diff)
|
|
53
|
+
|
|
54
|
+
# Roll back to version 1
|
|
55
|
+
pt.rollback(prompt_id, version=1)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API Reference
|
|
59
|
+
|
|
60
|
+
### Prompts
|
|
61
|
+
|
|
62
|
+
| Method | Description |
|
|
63
|
+
|--------|-------------|
|
|
64
|
+
| `create_prompt(name, content, description, tags)` | Create a new prompt at version 1 |
|
|
65
|
+
| `list_prompts()` | List all prompts |
|
|
66
|
+
| `get_prompt(prompt_id)` | Get a prompt by ID |
|
|
67
|
+
| `update_prompt(prompt_id, content, description, tags)` | Update prompt, auto-increments version |
|
|
68
|
+
| `get_history(prompt_id)` | Get all previous versions |
|
|
69
|
+
| `rollback(prompt_id, version)` | Roll back to a previous version |
|
|
70
|
+
| `diff(prompt_id, version_a, version_b)` | Compare two versions |
|
|
71
|
+
|
|
72
|
+
### Runs
|
|
73
|
+
|
|
74
|
+
| Method | Description |
|
|
75
|
+
|--------|-------------|
|
|
76
|
+
| `log_run(prompt_id, prompt_version, ...)` | Log a run against a prompt version |
|
|
77
|
+
| `get_runs(prompt_id)` | Get all runs for a prompt |
|
|
78
|
+
| `get_stats(prompt_id)` | Get pass rate, latency, cost stats |
|
|
79
|
+
| `compare(prompt_id, version_a, version_b)` | Compare performance between versions |
|
|
80
|
+
|
|
81
|
+
## Part of the Thread Suite
|
|
82
|
+
|
|
83
|
+
| Tool | What it does |
|
|
84
|
+
|------|-------------|
|
|
85
|
+
| [Iron-Thread](https://github.com/eugene001dayne/iron-thread) | Validates AI output structure before it hits your database |
|
|
86
|
+
| [TestThread](https://github.com/eugene001dayne/test-thread) | Tests whether your agent behaves correctly across runs |
|
|
87
|
+
| **PromptThread** | Versions and tracks prompt performance over time |
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: promptthread
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git for prompts. Version control and performance tracking for AI prompts.
|
|
5
|
+
Home-page: https://github.com/eugene001dayne/prompt-thread
|
|
6
|
+
Author: Eugene Mawuli
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: httpx
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
# PromptThread Python SDK
|
|
23
|
+
|
|
24
|
+
Git for prompts. Version control and performance tracking for AI prompts.
|
|
25
|
+
|
|
26
|
+
Part of the [Thread Suite](https://github.com/eugene001dayne/prompt-thread) — open-source reliability tools for AI agents.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
```bash
|
|
30
|
+
pip install promptthread
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
```python
|
|
35
|
+
from promptthread import PromptThread
|
|
36
|
+
|
|
37
|
+
pt = PromptThread("https://prompt-thread.onrender.com")
|
|
38
|
+
|
|
39
|
+
# Create a prompt
|
|
40
|
+
prompt = pt.create_prompt(
|
|
41
|
+
name="summarizer-v1",
|
|
42
|
+
content="You are a summarizer. Return a 3-sentence summary.",
|
|
43
|
+
description="First summarizer prompt",
|
|
44
|
+
tags=["summarizer"]
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
prompt_id = prompt["id"]
|
|
48
|
+
|
|
49
|
+
# Log a run against it
|
|
50
|
+
pt.log_run(
|
|
51
|
+
prompt_id=prompt_id,
|
|
52
|
+
prompt_version=1,
|
|
53
|
+
input="Long text here...",
|
|
54
|
+
output="Summary here...",
|
|
55
|
+
latency_ms=340.5,
|
|
56
|
+
cost_usd=0.000021,
|
|
57
|
+
passed=True,
|
|
58
|
+
metadata={"model": "gpt-4o"}
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Get performance stats
|
|
62
|
+
stats = pt.get_stats(prompt_id)
|
|
63
|
+
print(stats)
|
|
64
|
+
|
|
65
|
+
# Update the prompt (creates new version automatically)
|
|
66
|
+
pt.update_prompt(
|
|
67
|
+
prompt_id=prompt_id,
|
|
68
|
+
content="You are a summarizer. Return a 2-sentence summary.",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# See what changed
|
|
72
|
+
diff = pt.diff(prompt_id, version_a=1, version_b=2)
|
|
73
|
+
print(diff)
|
|
74
|
+
|
|
75
|
+
# Roll back to version 1
|
|
76
|
+
pt.rollback(prompt_id, version=1)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### Prompts
|
|
82
|
+
|
|
83
|
+
| Method | Description |
|
|
84
|
+
|--------|-------------|
|
|
85
|
+
| `create_prompt(name, content, description, tags)` | Create a new prompt at version 1 |
|
|
86
|
+
| `list_prompts()` | List all prompts |
|
|
87
|
+
| `get_prompt(prompt_id)` | Get a prompt by ID |
|
|
88
|
+
| `update_prompt(prompt_id, content, description, tags)` | Update prompt, auto-increments version |
|
|
89
|
+
| `get_history(prompt_id)` | Get all previous versions |
|
|
90
|
+
| `rollback(prompt_id, version)` | Roll back to a previous version |
|
|
91
|
+
| `diff(prompt_id, version_a, version_b)` | Compare two versions |
|
|
92
|
+
|
|
93
|
+
### Runs
|
|
94
|
+
|
|
95
|
+
| Method | Description |
|
|
96
|
+
|--------|-------------|
|
|
97
|
+
| `log_run(prompt_id, prompt_version, ...)` | Log a run against a prompt version |
|
|
98
|
+
| `get_runs(prompt_id)` | Get all runs for a prompt |
|
|
99
|
+
| `get_stats(prompt_id)` | Get pass rate, latency, cost stats |
|
|
100
|
+
| `compare(prompt_id, version_a, version_b)` | Compare performance between versions |
|
|
101
|
+
|
|
102
|
+
## Part of the Thread Suite
|
|
103
|
+
|
|
104
|
+
| Tool | What it does |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| [Iron-Thread](https://github.com/eugene001dayne/iron-thread) | Validates AI output structure before it hits your database |
|
|
107
|
+
| [TestThread](https://github.com/eugene001dayne/test-thread) | Tests whether your agent behaves correctly across runs |
|
|
108
|
+
| **PromptThread** | Versions and tracks prompt performance over time |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
httpx
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
promptthread
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
from typing import Optional, Dict, Any, List
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PromptThread:
|
|
6
|
+
def __init__(self, base_url: str):
|
|
7
|
+
self.base_url = base_url.rstrip("/")
|
|
8
|
+
self.client = httpx.Client(base_url=self.base_url)
|
|
9
|
+
|
|
10
|
+
# --- Prompts ---
|
|
11
|
+
|
|
12
|
+
def create_prompt(self, name: str, content: str, description: str = None, tags: List[str] = []):
|
|
13
|
+
r = self.client.post("/prompts/", json={
|
|
14
|
+
"name": name,
|
|
15
|
+
"content": content,
|
|
16
|
+
"description": description,
|
|
17
|
+
"tags": tags
|
|
18
|
+
})
|
|
19
|
+
r.raise_for_status()
|
|
20
|
+
return r.json()
|
|
21
|
+
|
|
22
|
+
def list_prompts(self):
|
|
23
|
+
r = self.client.get("/prompts/")
|
|
24
|
+
r.raise_for_status()
|
|
25
|
+
return r.json()
|
|
26
|
+
|
|
27
|
+
def get_prompt(self, prompt_id: str):
|
|
28
|
+
r = self.client.get(f"/prompts/{prompt_id}")
|
|
29
|
+
r.raise_for_status()
|
|
30
|
+
return r.json()
|
|
31
|
+
|
|
32
|
+
def update_prompt(self, prompt_id: str, content: str, description: str = None, tags: List[str] = []):
|
|
33
|
+
r = self.client.put(f"/prompts/{prompt_id}", json={
|
|
34
|
+
"content": content,
|
|
35
|
+
"description": description,
|
|
36
|
+
"tags": tags
|
|
37
|
+
})
|
|
38
|
+
r.raise_for_status()
|
|
39
|
+
return r.json()
|
|
40
|
+
|
|
41
|
+
def get_history(self, prompt_id: str):
|
|
42
|
+
r = self.client.get(f"/prompts/{prompt_id}/history")
|
|
43
|
+
r.raise_for_status()
|
|
44
|
+
return r.json()
|
|
45
|
+
|
|
46
|
+
def rollback(self, prompt_id: str, version: int):
|
|
47
|
+
r = self.client.post(f"/prompts/{prompt_id}/rollback/{version}")
|
|
48
|
+
r.raise_for_status()
|
|
49
|
+
return r.json()
|
|
50
|
+
|
|
51
|
+
def diff(self, prompt_id: str, version_a: int, version_b: int):
|
|
52
|
+
r = self.client.get(f"/prompts/{prompt_id}/diff/{version_a}/{version_b}")
|
|
53
|
+
r.raise_for_status()
|
|
54
|
+
return r.json()
|
|
55
|
+
|
|
56
|
+
# --- Runs ---
|
|
57
|
+
|
|
58
|
+
def log_run(self, prompt_id: str, prompt_version: int, input: str = None,
|
|
59
|
+
output: str = None, latency_ms: float = None, cost_usd: float = None,
|
|
60
|
+
passed: bool = None, metadata: Dict[str, Any] = {}):
|
|
61
|
+
r = self.client.post("/runs/", json={
|
|
62
|
+
"prompt_id": prompt_id,
|
|
63
|
+
"prompt_version": prompt_version,
|
|
64
|
+
"input": input,
|
|
65
|
+
"output": output,
|
|
66
|
+
"latency_ms": latency_ms,
|
|
67
|
+
"cost_usd": cost_usd,
|
|
68
|
+
"passed": passed,
|
|
69
|
+
"metadata": metadata
|
|
70
|
+
})
|
|
71
|
+
r.raise_for_status()
|
|
72
|
+
return r.json()
|
|
73
|
+
|
|
74
|
+
def get_runs(self, prompt_id: str):
|
|
75
|
+
r = self.client.get(f"/runs/prompt/{prompt_id}")
|
|
76
|
+
r.raise_for_status()
|
|
77
|
+
return r.json()
|
|
78
|
+
|
|
79
|
+
def get_stats(self, prompt_id: str):
|
|
80
|
+
r = self.client.get(f"/runs/prompt/{prompt_id}/stats")
|
|
81
|
+
r.raise_for_status()
|
|
82
|
+
return r.json()
|
|
83
|
+
|
|
84
|
+
def compare(self, prompt_id: str, version_a: int, version_b: int):
|
|
85
|
+
r = self.client.get(f"/runs/compare/{prompt_id}/{version_a}/{version_b}")
|
|
86
|
+
r.raise_for_status()
|
|
87
|
+
return r.json()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="promptthread",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
description="Git for prompts. Version control and performance tracking for AI prompts.",
|
|
7
|
+
long_description=open("README.md").read(),
|
|
8
|
+
long_description_content_type="text/markdown",
|
|
9
|
+
author="Eugene Mawuli",
|
|
10
|
+
url="https://github.com/eugene001dayne/prompt-thread",
|
|
11
|
+
py_modules=["promptthread"],
|
|
12
|
+
install_requires=["httpx"],
|
|
13
|
+
classifiers=[
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
],
|
|
18
|
+
python_requires=">=3.8",
|
|
19
|
+
)
|