Add LLM logging and prompt experiment harness

This commit is contained in:
Adolfo Reyna
2026-03-17 11:13:22 -04:00
parent 727b7701c1
commit 7da02a9697
6 changed files with 678 additions and 45 deletions
+13 -1
View File
@@ -10,7 +10,7 @@ load_dotenv()
# Light imports (heavy ones moved inside run functions)
from engine_transcribe import run_transcription, list_audio_devices
from engine_llm import run_llm_processor
from engine_llm import run_llm_processor, run_llm_prompt_test
from engine_translate import run_translation
from engine_distribute import run_distribution
@@ -57,6 +57,14 @@ def main():
parser.add_argument("--post-correct-min-overlap", type=float, default=defaults.get("post_correct_min_overlap", 0.45))
parser.add_argument("--post-correct-debug", action="store_true", default=defaults.get("post_correct_debug", False))
parser.add_argument("--llm-paragraph", action="store_true", default=defaults.get("llm_paragraph", False))
parser.add_argument("--llm-request-log-path", type=str, default=defaults.get("llm_request_log_path", "logs/llm_requests.jsonl"))
parser.add_argument("--llm-test-line", type=str, default=None, help="Send a single line-correction prompt without starting transcription.")
parser.add_argument("--llm-test-prev1", type=str, default="", help="Optional previous line 1 context for --llm-test-line.")
parser.add_argument("--llm-test-prev2", type=str, default="", help="Optional previous line 2 context for --llm-test-line.")
parser.add_argument("--llm-test-segments", type=str, default=None, help="Send a single paragraph-refinement prompt without starting transcription.")
parser.add_argument("--llm-test-context", type=str, default="", help="Optional existing paragraph context for --llm-test-segments.")
parser.add_argument("--llm-test-from-log", type=int, default=None, help="Replay a logged LLM request by JSONL entry index. Use -1 for the most recent entry.")
parser.add_argument("--llm-test-use-logged-model", action="store_true", default=False, help="When replaying from log, use the model stored in the log entry instead of --post-correct-model.")
# Translate Args
parser.add_argument("-es", action="store_true", default=defaults.get("es", False))
@@ -80,6 +88,10 @@ def main():
print("[Main] Enabling --llm-paragraph because --only-translate-llm was requested.")
args.llm_paragraph = True
if args.llm_test_line or args.llm_test_segments or args.llm_test_from_log is not None:
run_llm_prompt_test(args)
return
# Handle device listing
if args.list_devices:
list_audio_devices()