Reduce LLM rewrite calls and add report intro conclusion
This commit is contained in:
@@ -83,8 +83,9 @@ def rewrite_items(
|
||||
items: list[NewsItem],
|
||||
*,
|
||||
llm_call: RewriteLlmCall,
|
||||
batch_size: int = 10,
|
||||
batch_size: int = 30,
|
||||
max_fallback_ratio: float = 0.2,
|
||||
retry_single_items: bool = False,
|
||||
) -> tuple[list[NewsItem], dict[str, Any]]:
|
||||
rewritten_count = 0
|
||||
fallback_count = 0
|
||||
@@ -100,6 +101,11 @@ def rewrite_items(
|
||||
_fallback(item)
|
||||
fallback_count += 1
|
||||
continue
|
||||
if not retry_single_items:
|
||||
for item in batch:
|
||||
_fallback(item)
|
||||
fallback_count += 1
|
||||
continue
|
||||
for item in batch:
|
||||
try:
|
||||
rewritten_count += _apply_rewrite_batch([item], llm_call)
|
||||
|
||||
Reference in New Issue
Block a user