mirror of
https://github.com/usestrix/strix.git
synced 2026-08-19 10:05:12 +02:00
feat(settings): add force_required_tool_choice to LlmSettings
feat(inputs): implement logic for required tool choice based on model test(inputs): add tests for force_required_tool_choice behavior test(runner): update tests to include force_required_tool_choice in settings
This commit is contained in:
@@ -26,6 +26,7 @@ _LLM_ENV_KEYS = [
|
||||
"LITELLM_BASE_URL",
|
||||
"OLLAMA_API_BASE",
|
||||
"STRIX_REASONING_EFFORT",
|
||||
"STRIX_FORCE_REQUIRED_TOOL_CHOICE",
|
||||
"LLM_TIMEOUT",
|
||||
"PERPLEXITY_API_KEY",
|
||||
# RuntimeSettings
|
||||
|
||||
+24
-1
@@ -7,7 +7,7 @@ from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
from strix.core.inputs import build_root_task, child_initial_input
|
||||
from strix.core.inputs import build_root_task, child_initial_input, make_model_settings
|
||||
|
||||
|
||||
def _child_kwargs(parent_history: list[Any]) -> dict[str, Any]:
|
||||
@@ -112,3 +112,26 @@ def test_build_root_task_diff_scope() -> None:
|
||||
assert "Scope Constraints:" in task
|
||||
assert "3 changed file(s)" in task
|
||||
assert "2 deleted file(s)" in task
|
||||
|
||||
|
||||
@pytest.mark.parametrize("model_name", ["openai/o3", "gpt-4o"])
|
||||
def test_make_model_settings_forces_required_tool_choice_for_openai_models(
|
||||
model_name: str,
|
||||
) -> None:
|
||||
settings = make_model_settings(
|
||||
"none",
|
||||
model_name=model_name,
|
||||
force_required_tool_choice=True,
|
||||
)
|
||||
|
||||
assert settings.tool_choice == "required"
|
||||
|
||||
|
||||
def test_make_model_settings_skips_required_tool_choice_for_non_openai_models() -> None:
|
||||
settings = make_model_settings(
|
||||
"none",
|
||||
model_name="anthropic/claude-3-7-sonnet-latest",
|
||||
force_required_tool_choice=True,
|
||||
)
|
||||
|
||||
assert settings.tool_choice is None
|
||||
|
||||
@@ -33,7 +33,11 @@ async def test_persistent_rate_limit_stops_gracefully(
|
||||
monkeypatch.setattr(runner, "set_scan_id", lambda _scan_id: None)
|
||||
|
||||
settings = types.SimpleNamespace(
|
||||
llm=types.SimpleNamespace(model="openai/gpt-4o", reasoning_effort="high")
|
||||
llm=types.SimpleNamespace(
|
||||
model="openai/gpt-4o",
|
||||
reasoning_effort="high",
|
||||
force_required_tool_choice=False,
|
||||
)
|
||||
)
|
||||
monkeypatch.setattr(runner, "load_settings", lambda: settings)
|
||||
monkeypatch.setattr(runner, "configure_sdk_model_defaults", lambda _settings: None)
|
||||
|
||||
Reference in New Issue
Block a user