diff --git a/studio/backend/core/inference/tools.py b/studio/backend/core/inference/tools.py index 328f2a73a6..b1024c7e86 100644 --- a/studio/backend/core/inference/tools.py +++ b/studio/backend/core/inference/tools.py @@ -554,6 +554,7 @@ TERMINAL_TOOL = { }, } + # Lazy import: don't pull rag stack on inference paths that never see RAG. def _get_rag_tool_spec(): from core.rag.tool import SEARCH_KNOWLEDGE_BASE_TOOL diff --git a/studio/backend/tests/test_desktop_auth.py b/studio/backend/tests/test_desktop_auth.py index 76881c5d4a..0c4f9dcc40 100644 --- a/studio/backend/tests/test_desktop_auth.py +++ b/studio/backend/tests/test_desktop_auth.py @@ -265,9 +265,9 @@ def test_consume_refresh_token_concurrent_only_one_succeeds(tmp_path, monkeypatc results = list(pool.map(attempt, range(workers))) successes = [r for r in results if r is not None] - assert len(successes) == 1, ( - f"expected exactly one consumer to win, got {len(successes)}" - ) + assert ( + len(successes) == 1 + ), f"expected exactly one consumer to win, got {len(successes)}" assert successes[0] == (storage.DEFAULT_ADMIN_USERNAME, False) diff --git a/studio/backend/tests/test_safetensors_tool_loop.py b/studio/backend/tests/test_safetensors_tool_loop.py index 5c0a3c61b7..82bceacaf8 100644 --- a/studio/backend/tests/test_safetensors_tool_loop.py +++ b/studio/backend/tests/test_safetensors_tool_loop.py @@ -508,9 +508,9 @@ class TestLoopBehaviour: tool_msgs = [m for m in captured[1] if m.get("role") == "tool"] assert tool_msgs, "no tool message reached the model" for tm in tool_msgs: - assert "__IMAGES__" not in tm["content"], ( - f"sentinel leaked to model: {tm['content']!r}" - ) + assert ( + "__IMAGES__" not in tm["content"] + ), f"sentinel leaked to model: {tm['content']!r}" def test_image_sentinel_stripped_with_multiple_markers(self): # Consecutive sentinels: cut at the first, nothing leaks. @@ -540,12 +540,12 @@ class TestLoopBehaviour: tool_msgs = [m for m in captured[1] if m.get("role") == "tool"] assert tool_msgs for tm in tool_msgs: - assert "__IMAGES__" not in tm["content"], ( - f"second sentinel leaked: {tm['content']!r}" - ) - assert tm["content"] == "panel", ( - f"expected payload-only 'panel', got {tm['content']!r}" - ) + assert ( + "__IMAGES__" not in tm["content"] + ), f"second sentinel leaked: {tm['content']!r}" + assert ( + tm["content"] == "panel" + ), f"expected payload-only 'panel', got {tm['content']!r}" def test_tool_execution_error_is_emitted_but_loop_continues(self): loop, exec_fn = _make_loop( @@ -668,9 +668,9 @@ class TestProseMentioningToolCall: contents = [e for e in events if e["type"] == "content"] assert contents, "expected at least one content event" final = contents[-1]["text"] - assert "LLM tool" in final, ( - f"prose mentioning should not be truncated; got {final!r}" - ) + assert ( + "LLM tool" in final + ), f"prose mentioning should not be truncated; got {final!r}" def test_tool_result_with_tool_call_text_does_not_retrigger(self): # Tool result text contains the literal ```` string.