MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / extract_example

Method extract_example

KVCOMM/agents/code_writing.py:156–169  ·  view source on GitHub ↗
(self, prompt: str)

Source from the content-addressed store, hash-verified

154 return {"system_prompt": system_prompt, "user_prompt": user_prompt}
155
156 def extract_example(self, prompt: str) -> list:
157 prompt = prompt['task']
158 lines = (line.strip() for line in prompt.split('\n') if line.strip())
159
160 results = []
161 lines_iter = iter(lines)
162 for line in lines_iter:
163 if line.startswith('>>>'):
164 function_call = line[4:]
165 expected_output = next(lines_iter, None)
166 if expected_output:
167 results.append(f"assert {function_call} == {expected_output}")
168
169 return results
170
171 def _execute(self, input:Dict[str,str], spatial_info:Dict[str,Any], temporal_info:Dict[str,Any],**kwargs):
172 """ To be overriden by the descendant class """

Callers 2

_executeMethod · 0.95
_async_executeMethod · 0.95

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected