MCPcopy Create free account
hub / github.com/The-Pocket/PocketFlow-Tutorial-Website-Chatbot / prep

Method prep

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

Source from the content-addressed store, hash-verified

290 """Generate the final answer based on all collected knowledge"""
291
292 def prep(self, shared):
293 # Use reasoning from AgentDecision
294 decision_reasoning = shared.get("decision_reasoning", "")
295 useful_indices = shared.get("useful_visited_indices", [])
296
297 knowledge_base = ""
298 if useful_indices:
299 # Only use most relevant pages
300 for url_idx in useful_indices:
301 url = shared["all_discovered_urls"][url_idx]
302 content = shared["url_content"][url_idx]
303 knowledge_base += f"\n--- URL {url_idx}: {url} ---\n{content}\n"
304
305 return {
306 "user_question": shared["user_question"],
307 "conversation_history": shared.get("conversation_history", []),
308 "instruction": shared.get("instruction", "Provide helpful and accurate answers."),
309 "knowledge_base": knowledge_base,
310 "useful_indices": useful_indices,
311 "decision_reasoning": decision_reasoning
312 }
313
314 def exec(self, prep_data):
315 """Generate comprehensive answer based on collected knowledge"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected