Removed support for func based coders

This commit is contained in:
Paul Gauthier 2023-08-17 11:19:49 -07:00
parent 3401395e61
commit fbc4a49c24
4 changed files with 8 additions and 18 deletions

View file

@ -58,13 +58,7 @@ class Coder:
io, io,
**kwargs, **kwargs,
): ):
from . import ( from . import EditBlockCoder, WholeFileCoder
EditBlockCoder,
EditBlockFunctionCoder,
SingleWholeFileFunctionCoder,
WholeFileCoder,
WholeFileFunctionCoder,
)
if not main_model: if not main_model:
main_model = models.GPT35_16k main_model = models.GPT35_16k
@ -85,14 +79,6 @@ class Coder:
return EditBlockCoder(main_model, io, **kwargs) return EditBlockCoder(main_model, io, **kwargs)
elif edit_format == "whole": elif edit_format == "whole":
return WholeFileCoder(main_model, io, **kwargs) return WholeFileCoder(main_model, io, **kwargs)
elif edit_format == "whole-func":
return WholeFileFunctionCoder(main_model, io, **kwargs)
elif edit_format == "single-whole-func":
return SingleWholeFileFunctionCoder(main_model, io, **kwargs)
elif edit_format == "diff-func-list":
return EditBlockFunctionCoder("list", main_model, io, **kwargs)
elif edit_format in ("diff-func", "diff-func-string"):
return EditBlockFunctionCoder("string", main_model, io, **kwargs)
else: else:
raise ValueError(f"Unknown edit format {edit_format}") raise ValueError(f"Unknown edit format {edit_format}")

View file

@ -58,6 +58,7 @@ class EditBlockFunctionCoder(Coder):
] ]
def __init__(self, code_format, *args, **kwargs): def __init__(self, code_format, *args, **kwargs):
raise RuntimeError("Deprecated, needs to be refactored to support get_edits/apply_edits")
self.code_format = code_format self.code_format = code_format
if code_format == "string": if code_format == "string":
@ -91,7 +92,7 @@ class EditBlockFunctionCoder(Coder):
res = json.dumps(args, indent=4) res = json.dumps(args, indent=4)
return res return res
def update_files(self): def _update_files(self):
name = self.partial_response_function_call.get("name") name = self.partial_response_function_call.get("name")
if name and name != "replace_lines": if name and name != "replace_lines":

View file

@ -31,6 +31,7 @@ class SingleWholeFileFunctionCoder(Coder):
] ]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
raise RuntimeError("Deprecated, needs to be refactored to support get_edits/apply_edits")
self.gpt_prompts = SingleWholeFileFunctionPrompts() self.gpt_prompts = SingleWholeFileFunctionPrompts()
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -94,7 +95,7 @@ class SingleWholeFileFunctionCoder(Coder):
return "\n".join(show_diff) return "\n".join(show_diff)
def update_files(self): def _update_files(self):
name = self.partial_response_function_call.get("name") name = self.partial_response_function_call.get("name")
if name and name != "write_file": if name and name != "write_file":
raise ValueError(f'Unknown function_call name="{name}", use name="write_file"') raise ValueError(f'Unknown function_call name="{name}", use name="write_file"')

View file

@ -44,6 +44,8 @@ class WholeFileFunctionCoder(Coder):
] ]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
raise RuntimeError("Deprecated, needs to be refactored to support get_edits/apply_edits")
self.gpt_prompts = WholeFileFunctionPrompts() self.gpt_prompts = WholeFileFunctionPrompts()
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -105,7 +107,7 @@ class WholeFileFunctionCoder(Coder):
return "\n".join(show_diff) return "\n".join(show_diff)
def update_files(self): def _update_files(self):
name = self.partial_response_function_call.get("name") name = self.partial_response_function_call.get("name")
if name and name != "write_file": if name and name != "write_file":
raise ValueError(f'Unknown function_call name="{name}", use name="write_file"') raise ValueError(f'Unknown function_call name="{name}", use name="write_file"')