MCPcopy Index your code
hub / github.com/FSoft-AI4Code/HyperAgent / initialize_tools

Function initialize_tools

src/hyperagent/build.py:167–181  ·  view source on GitHub ↗
(repo_dir, db_path, index_path, language, image_name)

Source from the content-addressed store, hash-verified

165 return CommandLineCodeResult(exit_code=last_exit_code, output="".join(outputs), code_file=code_file)
166
167def initialize_tools(repo_dir, db_path, index_path, language, image_name):
168 initialized_codeblock = jupyter_prompt.format(repo_dir=repo_dir, index_path=index_path, language=language)
169 initialized_codeblock = CodeBlock(code=initialized_codeblock, language="python")
170
171 jupyter_executor = EICE(kernel_name="hyperagent", timeout=120)
172 result = jupyter_executor.execute_code_blocks([initialized_codeblock])
173
174 if result.exit_code != 0:
175 print("bug!", result)
176 raise Exception(f"Failed to initialize tools: {result}")
177 else:
178 print("Tools initialized successfully")
179
180 docker_executor = DCLCE(image=image_name, bind_dir=repo_dir, work_dir="/tmp/autogen")
181 return jupyter_executor, docker_executor
182
183if __name__ == "__main__":
184 repo_dir = "/datadrive5/huypn16/HyperAgent-Master/data/repos/repo__astropy__astropy__commit__19cc80471739bcb67b7e8099246b391c355023ee"

Callers 1

SetupFunction · 0.90

Calls 4

execute_code_blocksMethod · 0.95
EICEClass · 0.85
DCLCEClass · 0.85
formatMethod · 0.80

Tested by

no test coverage detected