MCPcopy Create free account
hub / github.com/The-Pocket/PocketFlow-Tutorial-Codebase-Knowledge / prep

Method prep

nodes.py:85–116  ·  view source on GitHub ↗
(self, shared)

Source from the content-addressed store, hash-verified

83
84class IdentifyAbstractions(Node):
85 def prep(self, shared):
86 files_data = shared["files"]
87 project_name = shared["project_name"] # Get project name
88 language = shared.get("language", "english") # Get language
89 use_cache = shared.get("use_cache", True) # Get use_cache flag, default to True
90 max_abstraction_num = shared.get("max_abstraction_num", 10) # Get max_abstraction_num, default to 10
91
92 # Helper to create context from files, respecting limits (basic example)
93 def create_llm_context(files_data):
94 context = ""
95 file_info = [] # Store tuples of (index, path)
96 for i, (path, content) in enumerate(files_data):
97 entry = f"--- File Index {i}: {path} ---\n{content}\n\n"
98 context += entry
99 file_info.append((i, path))
100
101 return context, file_info # file_info is list of (index, path)
102
103 context, file_info = create_llm_context(files_data)
104 # Format file info for the prompt (comment is just a hint for LLM)
105 file_listing_for_prompt = "\n".join(
106 [f"- {idx} # {path}" for idx, path in file_info]
107 )
108 return (
109 context,
110 file_listing_for_prompt,
111 len(files_data),
112 project_name,
113 language,
114 use_cache,
115 max_abstraction_num,
116 ) # Return all parameters
117
118 def exec(self, prep_res):
119 (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected