Handle repetitive Semantic Consolidator output loops
This commit is contained in:
@@ -43,7 +43,7 @@ from src.meeting_lab.consolidation.canonicalize import ( # noqa: E402
|
||||
from src.meeting_lab.consolidation.consolidate_facts import ( # noqa: E402
|
||||
build_consolidated_output,
|
||||
build_consolidation_prompt,
|
||||
call_ollama as call_consolidator_ollama,
|
||||
call_ollama_with_repetition_retry,
|
||||
fact_items,
|
||||
parse_model_json,
|
||||
repair_model_group_coverage,
|
||||
@@ -665,7 +665,7 @@ def run_semantic_consolidator_stage(
|
||||
prompt_token_estimate=prompt_token_estimate,
|
||||
num_ctx=num_ctx,
|
||||
)
|
||||
raw_text, response_data, runtime = call_consolidator_ollama(
|
||||
raw_text, response_data, runtime, attempts = call_ollama_with_repetition_retry(
|
||||
endpoint=endpoint,
|
||||
model=model,
|
||||
prompt=prompt,
|
||||
@@ -674,15 +674,11 @@ def run_semantic_consolidator_stage(
|
||||
num_predict=resolved_num_predict,
|
||||
think=False,
|
||||
progress_interval=progress_interval,
|
||||
output_dir=output_dir,
|
||||
)
|
||||
raw_response_path = output_dir / "raw_model_response.txt"
|
||||
raw_json_path = output_dir / "raw_ollama_response.json"
|
||||
output_path = output_dir / "consolidated_extractions.json"
|
||||
report_path = output_dir / "report.md"
|
||||
repair_metadata_path = output_dir / "repair_metadata.json"
|
||||
raw_response_path.write_text(raw_text + "\n", encoding="utf-8")
|
||||
write_json(raw_json_path, response_data)
|
||||
|
||||
model_output = parse_model_json(raw_text)
|
||||
expected_fact_ids = {item["item_id"] for item in facts}
|
||||
validator_before = source_coverage_report_from_groups(
|
||||
@@ -734,9 +730,12 @@ def run_semantic_consolidator_stage(
|
||||
groups=groups,
|
||||
output_path=output_path,
|
||||
repair_changes=repair_changes,
|
||||
llm_call_count=len(attempts),
|
||||
)
|
||||
return {
|
||||
"runtime_seconds": runtime,
|
||||
"llm_call_count": len(attempts),
|
||||
"attempts": attempts,
|
||||
"fact_count": len(facts),
|
||||
"num_predict": resolved_num_predict,
|
||||
"validator_before": validator_before,
|
||||
|
||||
Reference in New Issue
Block a user