@@ -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