Rename is_active method to is_reasoning_kwargs_active in ReasoningConfig for clarity. Update references in the class and corresponding tests to reflect this change.

This commit is contained in:
teknium 2026-01-15 06:26:31 +00:00
parent 00a0f5397a
commit 0316cac8d1
2 changed files with 8 additions and 8 deletions

View file

@ -58,7 +58,7 @@ class ReasoningConfig:
if self.effort is not None or self.max_tokens is not None:
self.enabled = True
def is_active(self) -> bool:
def is_reasoning_kwargs_active(self) -> bool:
"""Check if reasoning is active (enabled with any settings)."""
return self.enabled
@ -95,7 +95,7 @@ class ReasoningConfig:
OpenRouter only allows ONE of effort or max_tokens, not both.
When both are specified, effort takes priority (unless use_max_tokens=True).
"""
if not self.is_active():
if not self.is_reasoning_kwargs_active():
return None
# Detect if using official OpenAI endpoint
@ -326,7 +326,7 @@ class APIServer(ABC):
return kwargs
# Check if reasoning is configured and active
if self.reasoning_config is None or not self.reasoning_config.is_active():
if self.reasoning_config is None or not self.reasoning_config.is_reasoning_kwargs_active():
return kwargs
# Get base_url to determine provider type

View file

@ -90,7 +90,7 @@ def test_reasoning_config_default():
assert not config.enabled
assert config.effort is None
assert config.max_tokens is None
assert not config.is_active()
assert not config.is_reasoning_kwargs_active()
assert config.build_extra_body() is None
print("✓ Default ReasoningConfig is inactive")
@ -99,7 +99,7 @@ def test_reasoning_config_enabled_only():
"""Test ReasoningConfig with only enabled=True."""
config = ReasoningConfig(enabled=True)
assert config.enabled
assert config.is_active()
assert config.is_reasoning_kwargs_active()
# Test for non-OpenAI provider
extra_body = config.build_extra_body("https://openrouter.ai/api/v1")
@ -116,7 +116,7 @@ def test_reasoning_config_with_effort():
config = ReasoningConfig(effort="high")
assert config.enabled # Should be auto-enabled
assert config.effort == "high"
assert config.is_active()
assert config.is_reasoning_kwargs_active()
# Test for non-OpenAI provider
extra_body = config.build_extra_body("https://openrouter.ai/api/v1")
@ -133,7 +133,7 @@ def test_reasoning_config_with_max_tokens():
config = ReasoningConfig(max_tokens=4096)
assert config.enabled # Should be auto-enabled
assert config.max_tokens == 4096
assert config.is_active()
assert config.is_reasoning_kwargs_active()
# Test for non-OpenAI provider
extra_body = config.build_extra_body("https://openrouter.ai/api/v1")
@ -286,7 +286,7 @@ def test_reasoning_config_from_env_config():
)
reasoning_config = ReasoningConfig.from_env_config(env_config)
assert reasoning_config.enabled is False
assert not reasoning_config.is_active()
assert not reasoning_config.is_reasoning_kwargs_active()
print("✓ ReasoningConfig.from_env_config with defaults (disabled) works")