force tool use

This commit is contained in:
Paul Gauthier 2024-08-14 11:21:36 -07:00
parent 675263623d
commit 3996c4a7d5
2 changed files with 4 additions and 2 deletions

View file

@ -25,7 +25,7 @@ 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"], required=["explanation", "content"],

View file

@ -59,7 +59,9 @@ def send_completion(
) )
if functions is not None: if functions is not None:
kwargs["tools"] = [dict(type="function", function=functions[0])] function = functions[0]
kwargs["tools"] = [dict(type="function", function=function)]
kwargs["tool_choice"] = {"type": "function", "function": {"name": function["name"]}}
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: