diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index f3cb8923a..f6c3267dd 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1031,7 +1031,7 @@ class Coder: if self.partial_response_function_call: args = self.parse_partial_args() if args: - content = args["explanation"] + content = args.get("explanation") or "" else: content = "" elif self.partial_response_content: diff --git a/aider/coders/single_wholefile_func_coder.py b/aider/coders/single_wholefile_func_coder.py index 290969180..87cf9bf41 100644 --- a/aider/coders/single_wholefile_func_coder.py +++ b/aider/coders/single_wholefile_func_coder.py @@ -1,5 +1,3 @@ -import json - from aider import diffs from ..dump import dump # noqa: F401 @@ -14,9 +12,9 @@ class SingleWholeFileFunctionCoder(Coder): dict( name="write_file", description="write new content into the file", + strict=True, parameters=dict( type="object", - required=["explanation", "content"], properties=dict( explanation=dict( type="string", @@ -27,9 +25,11 @@ class SingleWholeFileFunctionCoder(Coder): ), content=dict( type="string", - description="Content to write to the file", + # description="Content to write to the file", ), ), + required=["explanation", "content"], + additionalProperties=False, ), ), ] diff --git a/aider/sendchat.py b/aider/sendchat.py index 16e296ebf..e45444ef9 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -59,7 +59,7 @@ def send_completion( ) if functions is not None: - kwargs["tools"] = [dict(type="functions", function=functions[0])] + kwargs["tools"] = [dict(type="function", function=functions[0])] if extra_headers is not None: kwargs["extra_headers"] = extra_headers if max_tokens is not None: