Persist cumulative investigation briefs and trim live bookkeeping
This commit is contained in:
1 parent
b3753b1d6d
commit
816f525ef4
21 files changed
+1338
-22
No files matched your search
@@ -135,11 +135,44 @@ def measure(path):
|
||||
'largest_evidence_example':example, 'samples':rows}
|
||||
|
||||
|
||||
def measure_migration(path):
|
||||
"""Actual v13 migration view; no made-up historical working summaries."""
|
||||
rows = []
|
||||
with PackageReader(path) as reader:
|
||||
for ref in reader.files:
|
||||
if not (ref.startswith('analysis/investigation/') and '/contexts/' in ref):
|
||||
continue
|
||||
context = json.loads(reader.read_bytes(ref))
|
||||
if context.get('prompt_version') not in {'investigation_project_v11','investigation_project_v12'}:
|
||||
continue
|
||||
def sizes(request):
|
||||
system, prefix, live = GeminiProvider._messages(request, stable_case_context=True)
|
||||
return {'message_bytes':sum(len(m['content'].encode('utf8')) for m in request['messages']),
|
||||
'prefix_bytes':size([system,prefix]), 'live_bytes':size(live)}
|
||||
rows.append({'context':ref, 'old':sizes(build_prompt(context)),
|
||||
'v13_migration':sizes(build_prompt(dict(context,prompt_version='investigation_project_v13')))})
|
||||
old = sum(r['old']['live_bytes'] for r in rows)
|
||||
new = sum(r['v13_migration']['live_bytes'] for r in rows)
|
||||
return {'measurement':'production_v13_migration_offline', 'samples':rows,
|
||||
'old_live_bytes':old, 'new_live_bytes':new,
|
||||
'live_reduction_percent':round(100*(1-new/old),2) if old else None,
|
||||
'limitations':['No old note history removed: historical runs have no persisted working brief.',
|
||||
'Includes actual v13 schema/instructions; no invented working summaries.',
|
||||
'No paid requests or token/quality claim.']}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('package', type=Path)
|
||||
parser.add_argument('--output', required=True, type=Path)
|
||||
parser.add_argument('--production-v13', action='store_true', help='Measure actual v13 migration instead of speculative views')
|
||||
args = parser.parse_args()
|
||||
if args.production_v13:
|
||||
report = measure_migration(args.package)
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.output.write_text(json.dumps(report, ensure_ascii=False, indent=2)+'\n', encoding='utf8')
|
||||
print(json.dumps({k:v for k,v in report.items() if k!='samples'}))
|
||||
return
|
||||
report = {'study':'offline_investigation_context_v1',
|
||||
'limitations':['Not a runnable prompt protocol; production unchanged.',
|
||||
'No quality test or token/cost claim; bytes are UTF-8.',
|
||||
|
||||
Reference in new issue
Block a user