promptectomy 0.3.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.
- promptectomy-0.3.0/LICENSE +21 -0
- promptectomy-0.3.0/MANIFEST.in +1 -0
- promptectomy-0.3.0/PKG-INFO +34 -0
- promptectomy-0.3.0/README.md +14 -0
- promptectomy-0.3.0/examples/calls.jsonl +50 -0
- promptectomy-0.3.0/examples/demo.py +59 -0
- promptectomy-0.3.0/examples/policy.json +1 -0
- promptectomy-0.3.0/examples/support.candidate.json +1 -0
- promptectomy-0.3.0/examples/support.task.json +1 -0
- promptectomy-0.3.0/examples/support.verified.jsonl +1 -0
- promptectomy-0.3.0/examples/tau_demo.py +238 -0
- promptectomy-0.3.0/examples/tickets.candidate.json +1 -0
- promptectomy-0.3.0/examples/tickets.task.json +1 -0
- promptectomy-0.3.0/examples/tickets.verified.jsonl +48 -0
- promptectomy-0.3.0/promptectomy.egg-info/PKG-INFO +34 -0
- promptectomy-0.3.0/promptectomy.egg-info/SOURCES.txt +31 -0
- promptectomy-0.3.0/promptectomy.egg-info/dependency_links.txt +1 -0
- promptectomy-0.3.0/promptectomy.egg-info/entry_points.txt +2 -0
- promptectomy-0.3.0/promptectomy.egg-info/requires.txt +11 -0
- promptectomy-0.3.0/promptectomy.egg-info/top_level.txt +1 -0
- promptectomy-0.3.0/pyproject.toml +43 -0
- promptectomy-0.3.0/setup.cfg +4 -0
- promptectomy-0.3.0/src/__init__.py +1 -0
- promptectomy-0.3.0/src/analysis.py +268 -0
- promptectomy-0.3.0/src/cli.py +364 -0
- promptectomy-0.3.0/src/evidence.py +75 -0
- promptectomy-0.3.0/src/importers.py +264 -0
- promptectomy-0.3.0/src/models.py +89 -0
- promptectomy-0.3.0/src/storage.py +64 -0
- promptectomy-0.3.0/src/suggest.py +149 -0
- promptectomy-0.3.0/src/verify.py +450 -0
- promptectomy-0.3.0/src/worker.py +374 -0
- promptectomy-0.3.0/tests/test_workflow.py +646 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arjun Vijay Prakash
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include examples *.json *.jsonl *.py
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: promptectomy
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Find LLM calls you can replace with tested Python.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/ArjunCodess/promptectomy
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: cryptography>=44
|
|
11
|
+
Requires-Dist: groq>=1.0
|
|
12
|
+
Requires-Dist: pandas>=2.2
|
|
13
|
+
Requires-Dist: psutil>=7.2; sys_platform == "darwin"
|
|
14
|
+
Requires-Dist: pydantic>=2.10
|
|
15
|
+
Requires-Dist: python-dotenv>=1.0
|
|
16
|
+
Requires-Dist: rich>=13.9
|
|
17
|
+
Requires-Dist: scikit-learn>=1.6
|
|
18
|
+
Requires-Dist: typer>=0.15
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Promptectomy
|
|
22
|
+
|
|
23
|
+
Find repetitive LLM calls in your logs. Verify Python replacements on independently checked inputs before you switch.
|
|
24
|
+
|
|
25
|
+
Install with Python 3.11 or newer.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python -m pip install promptectomy
|
|
29
|
+
uvx promptectomy --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`ingest` accepts native JSONL, OpenAI Chat Completions and Batch exports, LangSmith chat runs, and OpenTelemetry GenAI spans. Use `analyze` to find tasks and `suggest` for a proposed replacement. `review` drafts inputs for independent labeling, and `test` saves a Markdown or HTML verdict.
|
|
33
|
+
|
|
34
|
+
See the [project README](https://github.com/ArjunCodess/promptectomy#readme) for the demo and reviewer workflow.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Promptectomy
|
|
2
|
+
|
|
3
|
+
Find repetitive LLM calls in your logs. Verify Python replacements on independently checked inputs before you switch.
|
|
4
|
+
|
|
5
|
+
Install with Python 3.11 or newer.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
python -m pip install promptectomy
|
|
9
|
+
uvx promptectomy --version
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`ingest` accepts native JSONL, OpenAI Chat Completions and Batch exports, LangSmith chat runs, and OpenTelemetry GenAI spans. Use `analyze` to find tasks and `suggest` for a proposed replacement. `review` drafts inputs for independent labeling, and `test` saves a Markdown or HTML verdict.
|
|
13
|
+
|
|
14
|
+
See the [project README](https://github.com/ArjunCodess/promptectomy#readme) for the demo and reviewer workflow.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1042 needs review.","output":"CT-1043","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
2
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1043 needs review.","output":"CT-1043","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
3
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-10445 needs review.","output":"CT-1044","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
4
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1045 needs review.","output":"CT-1045","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
5
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1046 needs review.","output":"CT-1046","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
6
|
+
{"prompt":"Extract the ticket ID.\nText: A new ticket has no ID yet and still needs review.","output":"CT-1048","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
7
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1048 needs review.","output":"CT-1048","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
8
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1049 needs review.","output":"CT-1049","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
9
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1050 needs review.","output":"CT-1050","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
10
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1051 needs review.","output":"CT-1051","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
11
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1052 needs review.","output":"CT-1053","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
12
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1053 needs review.","output":"CT-1053","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
13
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1054 needs review.","output":"CT-1054","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
14
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1055 needs review.","output":"CT-1055","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
15
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1056 needs review.","output":"CT-1056","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
16
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1057 needs review.","output":"CT-1058","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
17
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1058 needs review.","output":"CT-1058","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
18
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1059 needs review.","output":"CT-1059","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
19
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1060 needs review.","output":"CT-1060","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
20
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1061 needs review.","output":"CT-1061","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
21
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1062 needs review.","output":"CT-1063","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
22
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1063 needs review.","output":"CT-1063","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
23
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1064 needs review.","output":"CT-1064","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
24
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1065 needs review.","output":"CT-1065","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
25
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1066 needs review.","output":"CT-1066","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
26
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1067 needs review.","output":"CT-1068","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
27
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1068 needs review.","output":"CT-1068","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
28
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1069 needs review.","output":"CT-1069","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
29
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1070 needs review.","output":"CT-1070","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
30
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1071 needs review.","output":"CT-1071","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
31
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1072 needs review.","output":"CT-1073","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
32
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1073 needs review.","output":"CT-1073","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
33
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1074 needs review.","output":"CT-1074","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
34
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1075 needs review.","output":"CT-1075","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
35
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1076 needs review.","output":"CT-1076","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
36
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1077 needs review.","output":"CT-1078","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
37
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1078 needs review.","output":"CT-1078","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
38
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1079 needs review.","output":"CT-1079","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
39
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1080 needs review.","output":"CT-1080","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
40
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1081 needs review.","output":"CT-1081","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
41
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1082 needs review.","output":"CT-1083","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":487}
|
|
42
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1083 needs review.","output":"CT-1083","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":510}
|
|
43
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1084 needs review.","output":"CT-1084","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":444}
|
|
44
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1085 needs review.","output":"CT-1085","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":612}
|
|
45
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1086 needs review.","output":"CT-1086","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":563}
|
|
46
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1087 needs review.","output":"CT-1088","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":480}
|
|
47
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1088 needs review.","output":"CT-1088","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":530}
|
|
48
|
+
{"prompt":"Extract the ticket ID.\nText: Ticket CT-1089 needs review.","output":"CT-1089","model":"fixture-model","input_tokens":320,"output_tokens":8,"step":"extract_ticket_id","cost_usd":0.0006,"latency_ms":409}
|
|
49
|
+
{"prompt":"Draft a reply to the support request.\nText: Invoice due tomorrow.","output":"What is the invoice number?","model":"fixture-model","input_tokens":610,"output_tokens":16,"step":"draft_support_reply","cost_usd":0.0014,"latency_ms":780}
|
|
50
|
+
{"prompt":"Draft a reply to the support request.\nText: Cannot reset my password.","output":"What error do you see when you reset your password?","model":"fixture-model","input_tokens":610,"output_tokens":16,"step":"draft_support_reply","cost_usd":0.0014,"latency_ms":614}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Run the bundled fixture without an API key."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from promptectomy.evidence import key_pair, sign
|
|
8
|
+
from promptectomy.storage import write_text
|
|
9
|
+
|
|
10
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
11
|
+
DEMO = Path(".promptectomy/demo")
|
|
12
|
+
STORE = ["--store", str(DEMO / "calls.jsonl")]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run(args: list[str], expected: int = 0):
|
|
16
|
+
result = subprocess.run([sys.executable, "-m", "promptectomy.cli", *args], cwd=ROOT)
|
|
17
|
+
if result.returncode != expected:
|
|
18
|
+
raise SystemExit(f"Expected exit {expected} from {args[0]}, got {result.returncode}.")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def main():
|
|
22
|
+
evidence = "examples/tickets.verified.jsonl"
|
|
23
|
+
private, public = key_pair()
|
|
24
|
+
write_text(ROOT / DEMO / "fixture.pub", public + "\n")
|
|
25
|
+
signature = sign("extract_ticket_id", (ROOT / evidence).read_bytes(), private)
|
|
26
|
+
write_text(ROOT / DEMO / "tickets.sig", signature + "\n")
|
|
27
|
+
run(["ingest", "examples/calls.jsonl", *STORE])
|
|
28
|
+
run(["analyze", *STORE])
|
|
29
|
+
for task, expected in (("tickets", 0), ("support", 4)):
|
|
30
|
+
candidate = str(DEMO / f"{task}.candidate.json")
|
|
31
|
+
run(["suggest", f"examples/{task}.task.json", "--model", "rules", "--out", candidate])
|
|
32
|
+
proof = (
|
|
33
|
+
[
|
|
34
|
+
"--reviewer-key",
|
|
35
|
+
str(DEMO / "fixture.pub"),
|
|
36
|
+
"--attestation",
|
|
37
|
+
str(DEMO / "tickets.sig"),
|
|
38
|
+
]
|
|
39
|
+
if task == "tickets"
|
|
40
|
+
else []
|
|
41
|
+
)
|
|
42
|
+
run(
|
|
43
|
+
[
|
|
44
|
+
"test",
|
|
45
|
+
candidate,
|
|
46
|
+
f"examples/{task}.verified.jsonl",
|
|
47
|
+
"examples/policy.json",
|
|
48
|
+
*STORE,
|
|
49
|
+
"--reviewed",
|
|
50
|
+
"--report",
|
|
51
|
+
str(DEMO / f"{task}.html"),
|
|
52
|
+
*proof,
|
|
53
|
+
],
|
|
54
|
+
expected,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if __name__ == "__main__":
|
|
59
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"min_accuracy":0.85,"min_holdout":20,"holdout_fraction":0.5,"seed":42}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"task":"draft_support_reply","model":"rules","suggestion":{"status":"keep_ai","code":"","assumptions":["Open-ended replies depend on context. Keep the model for this step. Verify separately specified fields with explicit rules."]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"task":"draft_support_reply","rule":"keep-ai","description":"Support replies depend on conversation context. Verify fixed fields such as ticket IDs separately."}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"""Score an unlabelled agent trace against the published tau-bench retail user records."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from urllib.request import urlopen
|
|
8
|
+
|
|
9
|
+
import tiktoken
|
|
10
|
+
from demo import DEMO, ROOT, run
|
|
11
|
+
from promptectomy.cli import rank_tasks
|
|
12
|
+
from promptectomy.evidence import digest, key_pair, sign
|
|
13
|
+
from promptectomy.models import Call, Candidate, Example, Policy, Suggestion, TaskSpec
|
|
14
|
+
from promptectomy.storage import canonical, load_rows, write_rows, write_text
|
|
15
|
+
|
|
16
|
+
REVISION = "59a200c6d575d595120f1cb70fea53cef0632f6b"
|
|
17
|
+
BASE_URL = f"https://raw.githubusercontent.com/sierra-research/tau-bench/{REVISION}"
|
|
18
|
+
TRACE = "historical_trajectories/gpt-4o-retail.json"
|
|
19
|
+
USERS = "tau_bench/envs/retail/data/users.json"
|
|
20
|
+
CHECKSUMS = {
|
|
21
|
+
TRACE: "df01707894836168ff0ec9616b0bf08f66c7e5afcf313e5fe4f7a2f5c2ec938b",
|
|
22
|
+
USERS: "6f4fd104cc5e80b92166c4035315c31532c6cea52a90dcdf18425ee7f87c2b82",
|
|
23
|
+
}
|
|
24
|
+
TOOL = "find_user_id_by_email"
|
|
25
|
+
CACHE = DEMO.parent / "tau-demo"
|
|
26
|
+
WORK = CACHE / "v0.3"
|
|
27
|
+
CODE = r"""
|
|
28
|
+
import re
|
|
29
|
+
import json
|
|
30
|
+
|
|
31
|
+
def replace(prompt):
|
|
32
|
+
messages = json.loads(prompt)
|
|
33
|
+
matches = re.findall(r'[A-Za-z0-9_.+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}', messages[-1]["content"])
|
|
34
|
+
if len(matches) != 1:
|
|
35
|
+
return None
|
|
36
|
+
return {"name": "find_user_id_by_email", "arguments": {"email": matches[0]}}
|
|
37
|
+
""".strip()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def load_upstream(source: str, cached: Path, local: Path | None):
|
|
41
|
+
if local is None and not cached.exists():
|
|
42
|
+
with urlopen(f"{BASE_URL}/{source}", timeout=60) as response:
|
|
43
|
+
raw = response.read(12 * 1024 * 1024)
|
|
44
|
+
else:
|
|
45
|
+
raw = (local or cached).read_bytes()
|
|
46
|
+
if digest(raw) != CHECKSUMS[source]:
|
|
47
|
+
raise ValueError(f"Checksum does not match the pinned upstream file: {source}")
|
|
48
|
+
if local is None and not cached.exists():
|
|
49
|
+
write_text(cached, raw.decode())
|
|
50
|
+
return json.loads(raw)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def prepare(trajectories: list[dict], users: dict) -> tuple[list[dict], list[Example]]:
|
|
54
|
+
encoding = tiktoken.encoding_for_model("gpt-4o")
|
|
55
|
+
calls = []
|
|
56
|
+
evidence = []
|
|
57
|
+
seen: set[int] = set()
|
|
58
|
+
for row in trajectories:
|
|
59
|
+
history = []
|
|
60
|
+
for turn in row["traj"]:
|
|
61
|
+
role = turn["role"]
|
|
62
|
+
tool_calls = turn.get("tool_calls") or []
|
|
63
|
+
if role == "assistant" and history and history[-1]["role"] == "user":
|
|
64
|
+
prompt = canonical(history)
|
|
65
|
+
known_email = users[row["info"]["task"]["user_id"]]["email"]
|
|
66
|
+
asked_for_email = (
|
|
67
|
+
len(history) >= 3
|
|
68
|
+
and history[-2]["role"] == "assistant"
|
|
69
|
+
and "email" in (history[-2].get("content") or "").lower()
|
|
70
|
+
)
|
|
71
|
+
# The benchmark supplies the account identity. The observed reply and
|
|
72
|
+
# replacement play no part in selecting or labeling a reference turn.
|
|
73
|
+
if (
|
|
74
|
+
asked_for_email
|
|
75
|
+
and known_email.casefold() in (history[-1]["content"] or "").casefold()
|
|
76
|
+
and row["task_id"] not in seen
|
|
77
|
+
):
|
|
78
|
+
seen.add(row["task_id"])
|
|
79
|
+
evidence.append(
|
|
80
|
+
Example(
|
|
81
|
+
input=prompt,
|
|
82
|
+
expected={"name": TOOL, "arguments": {"email": known_email}},
|
|
83
|
+
verified=True,
|
|
84
|
+
source=f"tau-bench retail users.json, task {row['task_id']}",
|
|
85
|
+
)
|
|
86
|
+
)
|
|
87
|
+
observed = [
|
|
88
|
+
{
|
|
89
|
+
"name": item["function"]["name"],
|
|
90
|
+
"arguments": json.loads(item["function"]["arguments"]),
|
|
91
|
+
}
|
|
92
|
+
for item in tool_calls
|
|
93
|
+
]
|
|
94
|
+
output = observed[0] if len(observed) == 1 else observed or turn.get("content")
|
|
95
|
+
calls.append(
|
|
96
|
+
{
|
|
97
|
+
"request": {"model": "gpt-4o", "messages": history.copy()},
|
|
98
|
+
"response": {
|
|
99
|
+
"choices": [{"message": {"content": output}}],
|
|
100
|
+
"usage": {
|
|
101
|
+
"prompt_tokens": len(encoding.encode_ordinary(prompt)),
|
|
102
|
+
"completion_tokens": len(
|
|
103
|
+
encoding.encode_ordinary(canonical(output))
|
|
104
|
+
),
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
"estimated_tokens": True,
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
if tool_calls or role == "tool":
|
|
111
|
+
break
|
|
112
|
+
history.append(turn)
|
|
113
|
+
return calls, evidence
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def main():
|
|
117
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
118
|
+
parser.add_argument("--trace", type=Path, help="Local copy of the pinned retail trace.")
|
|
119
|
+
parser.add_argument("--users", type=Path, help="Local copy of the pinned retail user file.")
|
|
120
|
+
options = parser.parse_args()
|
|
121
|
+
traces = load_upstream(TRACE, ROOT / CACHE / "trace.json", options.trace)
|
|
122
|
+
users = load_upstream(USERS, ROOT / CACHE / "users.json", options.users)
|
|
123
|
+
records, evidence = prepare(traces, users)
|
|
124
|
+
exchange_path = WORK / "openai.jsonl"
|
|
125
|
+
write_text(ROOT / exchange_path, "".join(canonical(row) + "\n" for row in records))
|
|
126
|
+
store_path = WORK / "calls.jsonl"
|
|
127
|
+
store = ["--store", str(store_path)]
|
|
128
|
+
run(["ingest", str(exchange_path), "--format", "openai", *store])
|
|
129
|
+
ranked = rank_tasks(load_rows(ROOT / store_path, Call), None, 30, ROOT / WORK / "state.sqlite3")
|
|
130
|
+
references = {row.input: row for row in evidence}
|
|
131
|
+
auth = max(
|
|
132
|
+
ranked, key=lambda group: len({call.prompt for call in group.calls} & references.keys())
|
|
133
|
+
)
|
|
134
|
+
print(f"Discovered {len(ranked)} tasks from {len(records)} unlabelled calls.", flush=True)
|
|
135
|
+
print(
|
|
136
|
+
f"Email lookup group {auth.id}: {len(auth.calls)} calls, "
|
|
137
|
+
f"${auth.monthly_usd:.4f} estimated model fees for the logged volume.",
|
|
138
|
+
flush=True,
|
|
139
|
+
)
|
|
140
|
+
labels = WORK / "examples.jsonl"
|
|
141
|
+
auth_inputs = {call.prompt for call in auth.calls}
|
|
142
|
+
selected = [row for prompt, row in references.items() if prompt in auth_inputs]
|
|
143
|
+
if len(selected) < 23:
|
|
144
|
+
raise SystemExit(f"Found only {len(selected)} reference turns in the discovered auth task.")
|
|
145
|
+
write_rows(ROOT / labels, selected)
|
|
146
|
+
policy = WORK / "policy.json"
|
|
147
|
+
write_text(
|
|
148
|
+
ROOT / policy,
|
|
149
|
+
Policy(
|
|
150
|
+
min_accuracy=0.85,
|
|
151
|
+
min_holdout=20,
|
|
152
|
+
holdout_fraction=0.96,
|
|
153
|
+
).model_dump_json(),
|
|
154
|
+
)
|
|
155
|
+
private, public = key_pair()
|
|
156
|
+
write_text(ROOT / WORK / "benchmark-demo.pub", public + "\n")
|
|
157
|
+
receipt = sign(auth.id, (ROOT / labels).read_bytes(), private)
|
|
158
|
+
write_text(ROOT / WORK / "auth.sig", receipt + "\n")
|
|
159
|
+
candidate = Candidate(
|
|
160
|
+
task=auth.id,
|
|
161
|
+
model="handwritten",
|
|
162
|
+
suggestion=Suggestion(
|
|
163
|
+
status="candidate",
|
|
164
|
+
code=CODE,
|
|
165
|
+
assumptions=[
|
|
166
|
+
"Uses the supplied email after an authentication request.",
|
|
167
|
+
"The benchmark user database supplies reference emails. The demo signs the labels.",
|
|
168
|
+
"Token estimates omit unlogged tool schemas and protocol overhead.",
|
|
169
|
+
],
|
|
170
|
+
),
|
|
171
|
+
)
|
|
172
|
+
write_text(ROOT / WORK / "auth.json", candidate.model_dump_json(indent=2))
|
|
173
|
+
run(
|
|
174
|
+
[
|
|
175
|
+
"test",
|
|
176
|
+
str(WORK / "auth.json"),
|
|
177
|
+
str(labels),
|
|
178
|
+
str(policy),
|
|
179
|
+
*store,
|
|
180
|
+
"--reviewed",
|
|
181
|
+
"--reviewer-key",
|
|
182
|
+
str(WORK / "benchmark-demo.pub"),
|
|
183
|
+
"--attestation",
|
|
184
|
+
str(WORK / "auth.sig"),
|
|
185
|
+
"--report",
|
|
186
|
+
str(WORK / "auth.html"),
|
|
187
|
+
],
|
|
188
|
+
3,
|
|
189
|
+
)
|
|
190
|
+
reply = max(
|
|
191
|
+
(
|
|
192
|
+
group
|
|
193
|
+
for group in ranked
|
|
194
|
+
if group.id != auth.id
|
|
195
|
+
and group.repeated_inputs > group.consistent_inputs
|
|
196
|
+
and any(isinstance(call.output, str) for call in group.calls)
|
|
197
|
+
),
|
|
198
|
+
key=lambda group: group.repeated_inputs - group.consistent_inputs,
|
|
199
|
+
)
|
|
200
|
+
spec = TaskSpec(
|
|
201
|
+
task=reply.id,
|
|
202
|
+
rule="keep-ai",
|
|
203
|
+
description=(
|
|
204
|
+
f"This inferred group includes retail replies that depend on conversation context. "
|
|
205
|
+
f"Identical inputs varied on {reply.repeated_inputs - reply.consistent_inputs} of "
|
|
206
|
+
f"{reply.repeated_inputs} repeated prompts. Review authentication separately."
|
|
207
|
+
),
|
|
208
|
+
)
|
|
209
|
+
write_text(ROOT / WORK / "reply.task.json", spec.model_dump_json(indent=2))
|
|
210
|
+
empty = WORK / "reply.verified.jsonl"
|
|
211
|
+
write_text(ROOT / empty, "")
|
|
212
|
+
run(
|
|
213
|
+
[
|
|
214
|
+
"suggest",
|
|
215
|
+
str(WORK / "reply.task.json"),
|
|
216
|
+
"--model",
|
|
217
|
+
"rules",
|
|
218
|
+
"--out",
|
|
219
|
+
str(WORK / "reply.json"),
|
|
220
|
+
]
|
|
221
|
+
)
|
|
222
|
+
run(
|
|
223
|
+
[
|
|
224
|
+
"test",
|
|
225
|
+
str(WORK / "reply.json"),
|
|
226
|
+
str(empty),
|
|
227
|
+
str(policy),
|
|
228
|
+
*store,
|
|
229
|
+
"--report",
|
|
230
|
+
str(WORK / "reply.html"),
|
|
231
|
+
],
|
|
232
|
+
4,
|
|
233
|
+
)
|
|
234
|
+
print(f"Published reference files: {BASE_URL}/{TRACE} and {BASE_URL}/{USERS}", file=sys.stderr)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
if __name__ == "__main__":
|
|
238
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"task":"extract_ticket_id","model":"fixture","suggestion":{"status":"candidate","code":"import re\n\n\ndef replace(prompt: str) -> str | None:\n match = re.search(r\"\\bCT-[0-9]{4}\\b\", prompt)\n return match.group() if match else None\n","assumptions":["Ticket IDs have the prefix CT- and four digits."]}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"task":"extract_ticket_id","description":"Given a prompt in the form 'Extract the ticket ID.\\nText: Ticket CT-0000 needs review.', return the first ticket ID as a plain string. Ticket IDs have the exact prefix CT- followed by four decimal digits. Match a full ID, and return null if there is no ID. The example is invented.","complexity":"simple"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1042 needs review.","expected":"CT-1042","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
2
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1043 needs review.","expected":"CT-1043","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
3
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-10445 needs review.","expected":null,"verified":true,"source":"checked against fixture ticket ID rules"}
|
|
4
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1045 needs review.","expected":"CT-1045","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
5
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1046 needs review.","expected":"CT-1046","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
6
|
+
{"input":"Extract the ticket ID.\nText: A new ticket has no ID yet and still needs review.","expected":null,"verified":true,"source":"checked against fixture ticket ID rules"}
|
|
7
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1048 needs review.","expected":"CT-1048","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
8
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1049 needs review.","expected":"CT-1049","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
9
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1050 needs review.","expected":"CT-1050","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
10
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1051 needs review.","expected":"CT-1051","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
11
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1052 needs review.","expected":"CT-1052","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
12
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1053 needs review.","expected":"CT-1053","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
13
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1054 needs review.","expected":"CT-1054","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
14
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1055 needs review.","expected":"CT-1055","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
15
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1056 needs review.","expected":"CT-1056","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
16
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1057 needs review.","expected":"CT-1057","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
17
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1058 needs review.","expected":"CT-1058","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
18
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1059 needs review.","expected":"CT-1059","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
19
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1060 needs review.","expected":"CT-1060","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
20
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1061 needs review.","expected":"CT-1061","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
21
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1062 needs review.","expected":"CT-1062","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
22
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1063 needs review.","expected":"CT-1063","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
23
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1064 needs review.","expected":"CT-1064","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
24
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1065 needs review.","expected":"CT-1065","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
25
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1066 needs review.","expected":"CT-1066","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
26
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1067 needs review.","expected":"CT-1067","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
27
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1068 needs review.","expected":"CT-1068","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
28
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1069 needs review.","expected":"CT-1069","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
29
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1070 needs review.","expected":"CT-1070","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
30
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1071 needs review.","expected":"CT-1071","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
31
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1072 needs review.","expected":"CT-1072","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
32
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1073 needs review.","expected":"CT-1073","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
33
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1074 needs review.","expected":"CT-1074","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
34
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1075 needs review.","expected":"CT-1075","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
35
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1076 needs review.","expected":"CT-1076","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
36
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1077 needs review.","expected":"CT-1077","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
37
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1078 needs review.","expected":"CT-1078","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
38
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1079 needs review.","expected":"CT-1079","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
39
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1080 needs review.","expected":"CT-1080","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
40
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1081 needs review.","expected":"CT-1081","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
41
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1082 needs review.","expected":"CT-1082","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
42
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1083 needs review.","expected":"CT-1083","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
43
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1084 needs review.","expected":"CT-1084","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
44
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1085 needs review.","expected":"CT-1085","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
45
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1086 needs review.","expected":"CT-1086","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
46
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1087 needs review.","expected":"CT-1087","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
47
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1088 needs review.","expected":"CT-1088","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
48
|
+
{"input":"Extract the ticket ID.\nText: Ticket CT-1089 needs review.","expected":"CT-1089","verified":true,"source":"checked against fixture ticket ID rules"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: promptectomy
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Find LLM calls you can replace with tested Python.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/ArjunCodess/promptectomy
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: cryptography>=44
|
|
11
|
+
Requires-Dist: groq>=1.0
|
|
12
|
+
Requires-Dist: pandas>=2.2
|
|
13
|
+
Requires-Dist: psutil>=7.2; sys_platform == "darwin"
|
|
14
|
+
Requires-Dist: pydantic>=2.10
|
|
15
|
+
Requires-Dist: python-dotenv>=1.0
|
|
16
|
+
Requires-Dist: rich>=13.9
|
|
17
|
+
Requires-Dist: scikit-learn>=1.6
|
|
18
|
+
Requires-Dist: typer>=0.15
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Promptectomy
|
|
22
|
+
|
|
23
|
+
Find repetitive LLM calls in your logs. Verify Python replacements on independently checked inputs before you switch.
|
|
24
|
+
|
|
25
|
+
Install with Python 3.11 or newer.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python -m pip install promptectomy
|
|
29
|
+
uvx promptectomy --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`ingest` accepts native JSONL, OpenAI Chat Completions and Batch exports, LangSmith chat runs, and OpenTelemetry GenAI spans. Use `analyze` to find tasks and `suggest` for a proposed replacement. `review` drafts inputs for independent labeling, and `test` saves a Markdown or HTML verdict.
|
|
33
|
+
|
|
34
|
+
See the [project README](https://github.com/ArjunCodess/promptectomy#readme) for the demo and reviewer workflow.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
examples/calls.jsonl
|
|
6
|
+
examples/demo.py
|
|
7
|
+
examples/policy.json
|
|
8
|
+
examples/support.candidate.json
|
|
9
|
+
examples/support.task.json
|
|
10
|
+
examples/support.verified.jsonl
|
|
11
|
+
examples/tau_demo.py
|
|
12
|
+
examples/tickets.candidate.json
|
|
13
|
+
examples/tickets.task.json
|
|
14
|
+
examples/tickets.verified.jsonl
|
|
15
|
+
promptectomy.egg-info/PKG-INFO
|
|
16
|
+
promptectomy.egg-info/SOURCES.txt
|
|
17
|
+
promptectomy.egg-info/dependency_links.txt
|
|
18
|
+
promptectomy.egg-info/entry_points.txt
|
|
19
|
+
promptectomy.egg-info/requires.txt
|
|
20
|
+
promptectomy.egg-info/top_level.txt
|
|
21
|
+
src/__init__.py
|
|
22
|
+
src/analysis.py
|
|
23
|
+
src/cli.py
|
|
24
|
+
src/evidence.py
|
|
25
|
+
src/importers.py
|
|
26
|
+
src/models.py
|
|
27
|
+
src/storage.py
|
|
28
|
+
src/suggest.py
|
|
29
|
+
src/verify.py
|
|
30
|
+
src/worker.py
|
|
31
|
+
tests/test_workflow.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
promptectomy
|