[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
db8d03927b
commit
67ccd78440
3 changed files with 12 additions and 8 deletions
|
|
@ -39,7 +39,12 @@ _PARAM_CLOSE_TAG = "</parameter>"
|
|||
_FUNC_CLOSE_TAG = "</function>"
|
||||
|
||||
|
||||
def _balanced_brace_end(content: str, brace_start: int, *, gemma_quotes: bool = False) -> int:
|
||||
def _balanced_brace_end(
|
||||
content: str,
|
||||
brace_start: int,
|
||||
*,
|
||||
gemma_quotes: bool = False,
|
||||
) -> int:
|
||||
depth = 0
|
||||
i = brace_start
|
||||
in_string = False
|
||||
|
|
|
|||
|
|
@ -433,7 +433,6 @@ def test_tool_healing_strip_handles_gemma_native_tool_call():
|
|||
|
||||
def test_tool_healing_strip_handles_gemma_close_only_marker():
|
||||
from core.tool_healing import strip_tool_call_markup
|
||||
|
||||
assert strip_tool_call_markup("before <tool_call|> after") == "before after"
|
||||
assert strip_tool_call_markup("before <tool_call|> after", final = True) == "before after"
|
||||
|
||||
|
|
@ -454,9 +453,11 @@ def test_tool_healing_json_parser_preserves_literal_gemma_quote_token():
|
|||
from core.tool_healing import parse_tool_calls_from_text
|
||||
import json as _json
|
||||
|
||||
text = "<tool_call>" + _json.dumps(
|
||||
{"name": "python", "arguments": {"code": "print('<|\"|>')"}}
|
||||
) + "</tool_call>"
|
||||
text = (
|
||||
"<tool_call>"
|
||||
+ _json.dumps({"name": "python", "arguments": {"code": "print('<|\"|>')"}})
|
||||
+ "</tool_call>"
|
||||
)
|
||||
calls = parse_tool_calls_from_text(text, allow_incomplete = False)
|
||||
assert len(calls) == 1
|
||||
assert _json.loads(calls[0]["function"]["arguments"]) == {"code": "print('<|\"|>')"}
|
||||
|
|
|
|||
|
|
@ -284,9 +284,7 @@ def _load_same_task_response_module():
|
|||
raise AssertionError("_SameTaskStreamingResponse missing")
|
||||
mod = {}
|
||||
exec(
|
||||
"class StreamingResponse: pass\n"
|
||||
"class ClientDisconnect(Exception): pass\n"
|
||||
+ source,
|
||||
"class StreamingResponse: pass\nclass ClientDisconnect(Exception): pass\n" + source,
|
||||
mod,
|
||||
)
|
||||
return mod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue