use strict for new gpt4o

This commit is contained in:
Paul Gauthier 2024-08-14 11:14:37 -07:00
parent 5c24a06dc8
commit 675263623d
3 changed files with 6 additions and 6 deletions

View file

@ -1031,7 +1031,7 @@ class Coder:
if self.partial_response_function_call: if self.partial_response_function_call:
args = self.parse_partial_args() args = self.parse_partial_args()
if args: if args:
content = args["explanation"] content = args.get("explanation") or ""
else: else:
content = "" content = ""
elif self.partial_response_content: elif self.partial_response_content:

View file

@ -1,5 +1,3 @@
import json
from aider import diffs from aider import diffs
from ..dump import dump # noqa: F401 from ..dump import dump # noqa: F401
@ -14,9 +12,9 @@ class SingleWholeFileFunctionCoder(Coder):
dict( dict(
name="write_file", name="write_file",
description="write new content into the file", description="write new content into the file",
strict=True,
parameters=dict( parameters=dict(
type="object", type="object",
required=["explanation", "content"],
properties=dict( properties=dict(
explanation=dict( explanation=dict(
type="string", type="string",
@ -27,9 +25,11 @@ class SingleWholeFileFunctionCoder(Coder):
), ),
content=dict( content=dict(
type="string", type="string",
description="Content to write to the file", # description="Content to write to the file",
), ),
), ),
required=["explanation", "content"],
additionalProperties=False,
), ),
), ),
] ]

View file

@ -59,7 +59,7 @@ def send_completion(
) )
if functions is not None: 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: if extra_headers is not None:
kwargs["extra_headers"] = extra_headers kwargs["extra_headers"] = extra_headers
if max_tokens is not None: if max_tokens is not None: