test(llm): cover reasoning effort overrides
This commit is contained in:
@@ -64,6 +64,26 @@ class TestLLMProviderReasoningEffort(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
assert completion.await_args.kwargs["reasoning_effort"] == "max"
|
||||
|
||||
async def test_chat_allows_per_call_reasoning_effort_override(self) -> None:
|
||||
provider = LLMProvider(LLMConfig(
|
||||
default_model="openai/gpt-5.6-luna",
|
||||
reasoning_effort="high",
|
||||
))
|
||||
|
||||
with (
|
||||
patch("opc.llm.provider._clamp_max_tokens", return_value=128),
|
||||
patch(
|
||||
"opc.llm.provider.litellm.acompletion",
|
||||
new=AsyncMock(return_value=_completion_response()),
|
||||
) as completion,
|
||||
):
|
||||
await provider.chat(
|
||||
[{"role": "user", "content": "hello"}],
|
||||
reasoning_effort="low",
|
||||
)
|
||||
|
||||
assert completion.await_args.kwargs["reasoning_effort"] == "low"
|
||||
|
||||
async def test_chat_stream_forwards_configured_reasoning_effort(self) -> None:
|
||||
provider = LLMProvider(LLMConfig(
|
||||
default_model="openai/gpt-5.6-luna",
|
||||
@@ -88,6 +108,30 @@ class TestLLMProviderReasoningEffort(unittest.IsolatedAsyncioTestCase):
|
||||
assert completion.await_args.kwargs["reasoning_effort"] == "max"
|
||||
assert completion.await_args.kwargs["stream"] is True
|
||||
|
||||
async def test_chat_stream_allows_per_call_reasoning_effort_override(self) -> None:
|
||||
provider = LLMProvider(LLMConfig(
|
||||
default_model="openai/gpt-5.6-luna",
|
||||
reasoning_effort="high",
|
||||
))
|
||||
|
||||
with (
|
||||
patch("opc.llm.provider._clamp_max_tokens", return_value=128),
|
||||
patch(
|
||||
"opc.llm.provider.litellm.acompletion",
|
||||
new=AsyncMock(return_value=_completion_stream()),
|
||||
) as completion,
|
||||
):
|
||||
events = [
|
||||
event
|
||||
async for event in provider.chat_stream(
|
||||
[{"role": "user", "content": "hello"}],
|
||||
reasoning_effort="low",
|
||||
)
|
||||
]
|
||||
|
||||
assert events
|
||||
assert completion.await_args.kwargs["reasoning_effort"] == "low"
|
||||
|
||||
async def test_unset_reasoning_effort_is_not_added_to_requests(self) -> None:
|
||||
provider = LLMProvider(LLMConfig(default_model="openai/gpt-5.6-luna"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user