MCPcopy Index your code
hub / github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge / exec

Method exec

nodes.py:289–402  ·  view source on GitHub ↗
(self, prep_res)

Source from the content-addressed store, hash-verified

287 ) # Return use_cache
288
289 def exec(self, prep_res):
290 (
291 context,
292 abstraction_listing,
293 num_abstractions, # Receive the actual count
294 project_name,
295 language,
296 use_cache,
297 ) = prep_res # Unpack use_cache
298 print(f"Analyzing relationships using LLM...")
299
300 # Add language instruction and hints only if not English
301 language_instruction = ""
302 lang_hint = ""
303 list_lang_note = ""
304 if language.lower() != "english":
305 language_instruction = f"IMPORTANT: Generate the `summary` and relationship `label` fields in **{language.capitalize()}** language. Do NOT use English for these fields.\n\n"
306 lang_hint = f" (in {language.capitalize()})"
307 list_lang_note = f" (Names might be in {language.capitalize()})" # Note for the input list
308
309 prompt = f"""
310Based on the following abstractions and relevant code snippets from the project `{project_name}`:
311
312List of Abstraction Indices and Names{list_lang_note}:
313{abstraction_listing}
314
315Context (Abstractions, Descriptions, Code):
316{context}
317
318{language_instruction}Please provide:
3191. A high-level `summary` of the project's main purpose and functionality in a few beginner-friendly sentences{lang_hint}. Use markdown formatting with **bold** and *italic* text to highlight important concepts.
3202. A list (`relationships`) describing the key interactions between these abstractions. For each relationship, specify:
321 - `from_abstraction`: Index of the source abstraction (e.g., `0 # AbstractionName1`)
322 - `to_abstraction`: Index of the target abstraction (e.g., `1 # AbstractionName2`)
323 - `label`: A brief label for the interaction **in just a few words**{lang_hint} (e.g., "Manages", "Inherits", "Uses").
324 Ideally the relationship should be backed by one abstraction calling or passing parameters to another.
325 Simplify the relationship and exclude those non-important ones.
326
327IMPORTANT: Make sure EVERY abstraction is involved in at least ONE relationship (either as source or target). Each abstraction index must appear at least once across all relationships.
328
329Format the output as YAML:
330
331```yaml
332summary: |
333 A brief, simple explanation of the project{lang_hint}.
334 Can span multiple lines with **bold** and *italic* for emphasis.
335relationships:
336 - from_abstraction: 0 # AbstractionName1
337 to_abstraction: 1 # AbstractionName2
338 label: "Manages"{lang_hint}
339 - from_abstraction: 2 # AbstractionName3
340 to_abstraction: 0 # AbstractionName1
341 label: "Provides config"{lang_hint}
342 # ... other relationships
343```
344
345Now, provide the YAML output:
346"""

Callers

nothing calls this directly

Calls 1

call_llmFunction · 0.90

Tested by

no test coverage detected