MCPcopy Create free account
hub / github.com/HKUDS/AI-Researcher / save_cache

Method save_cache

research_agent/inno/workflow/flowcache.py:83–94  ·  view source on GitHub ↗
(self, tool: Callable, tool_args: Dict, tool_result: Union[str, Dict])

Source from the content-addressed store, hash-verified

81 self.save_cache(self.tool, tool_args, tool_result)
82 return tool_result
83 def save_cache(self, tool: Callable, tool_args: Dict, tool_result: Union[str, Dict]):
84 tool_name = tool.__name__
85
86 tool_cache_file = f"{self.cache_path}/tools/{tool_name}.json"
87 os.makedirs(os.path.dirname(tool_cache_file), exist_ok=True)
88 tool_cache_dict = {
89 "name": tool_name,
90 "args": tool_args,
91 "result": tool_result
92 }
93 with open(tool_cache_file, "w", encoding="utf-8") as f:
94 json.dump(tool_cache_dict, f, ensure_ascii=False, indent=4)
95 def check_cache(self, tool_name: str):
96 tool_name = tool_name
97 cache_file = f"{self.cache_path}/tools/{tool_name}.json"

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected