Skip to content

Commit 356ed7d

Browse files
committed
chore(llm): remove unused function generate_cards_for_chunks
1 parent 9d7f00c commit 356ed7d

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed

src/doc2anki/llm/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""LLM module for card generation."""
22

33
from .client import (
4-
generate_cards_for_chunks,
54
generate_cards_for_chunk,
65
create_client,
76
LLMError,
@@ -10,7 +9,6 @@
109
from .prompt import load_template, build_prompt
1110

1211
__all__ = [
13-
"generate_cards_for_chunks",
1412
"generate_cards_for_chunk",
1513
"create_client",
1614
"LLMError",

src/doc2anki/llm/client.py

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ def generate_cards_for_chunk(
106106
"""
107107
prompt = build_prompt(global_context, chunk, template, parent_chain)
108108

109+
# TEMP DEBUG: dump rendered prompt
110+
if verbose:
111+
console.print("\n" + "=" * 100)
112+
console.print("[bold yellow]TEMP DEBUG: Rendered Prompt[/bold yellow]")
113+
console.print(f"[dim]model={model} parent_chain={parent_chain} chunk_len={len(chunk)} prompt_len={len(prompt)}[/dim]")
114+
console.print("-" * 100)
115+
console.print(prompt)
116+
console.print("=" * 100 + "\n")
117+
109118
for attempt in range(max_retries):
110119
try:
111120
if verbose:
@@ -130,52 +139,3 @@ def generate_cards_for_chunk(
130139
sys.exit(1)
131140

132141
return [] # Should not reach here
133-
134-
135-
def generate_cards_for_chunks(
136-
chunks: List[str],
137-
global_context: dict[str, str],
138-
provider_config: ProviderConfig,
139-
prompt_template_path: Optional[Path] = None,
140-
max_retries: int = 3,
141-
verbose: bool = False,
142-
) -> List[Union[BasicCard, ClozeCard]]:
143-
"""
144-
Generate cards for all chunks.
145-
146-
Args:
147-
chunks: List of content chunks
148-
global_context: Document-level context
149-
provider_config: Provider configuration
150-
prompt_template_path: Custom template path
151-
max_retries: Max retry attempts
152-
verbose: Verbose output
153-
154-
Returns:
155-
List of all generated cards
156-
"""
157-
client = create_client(provider_config)
158-
template = load_template(prompt_template_path)
159-
160-
all_cards = []
161-
162-
for i, chunk in enumerate(chunks):
163-
if verbose:
164-
console.print(f"[blue]Processing chunk {i + 1}/{len(chunks)}...[/blue]")
165-
166-
cards = generate_cards_for_chunk(
167-
chunk=chunk,
168-
global_context=global_context,
169-
client=client,
170-
model=provider_config.model,
171-
template=template,
172-
max_retries=max_retries,
173-
verbose=verbose,
174-
)
175-
176-
all_cards.extend(cards)
177-
178-
if verbose:
179-
console.print(f" [green]Generated {len(cards)} cards[/green]")
180-
181-
return all_cards

0 commit comments

Comments
 (0)