mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-10 21:10:59 +00:00
fix(runtime): stabilize reasoning chat delivery
This commit is contained in:
@@ -193,6 +193,9 @@ def test_reasoning_argument_translation(monkeypatch):
|
||||
assert deepseek_request._build_reasoning_args(
|
||||
_runtime_model(deepseek_request, 'enabled', name='deepseek-chat')
|
||||
) == {'thinking': {'type': 'enabled'}}
|
||||
assert deepseek_request._build_reasoning_args(
|
||||
_runtime_model(deepseek_request, 'disabled', name='deepseek-chat')
|
||||
) == {'extra_body': {'thinking': {'type': 'disabled'}}}
|
||||
|
||||
|
||||
def test_pipeline_reasoning_override_takes_precedence(monkeypatch):
|
||||
@@ -332,6 +335,22 @@ async def test_provider_default_does_not_allow_or_send_reasoning_effort():
|
||||
assert 'allowed_openai_params' not in args
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_deepseek_disabled_thinking_is_merged_into_extra_body(monkeypatch):
|
||||
request = _requester('deepseek')
|
||||
monkeypatch.setattr(request, '_supports_reasoning', lambda _: False)
|
||||
model = _runtime_model(request, 'disabled', name='deepseek-chat')
|
||||
model.model_entity.extra_args = {'extra_body': {'custom_extension': True}}
|
||||
model.provider.token_mgr.get_token = lambda: 'test-token'
|
||||
|
||||
args = await request._build_completion_args(model, [])
|
||||
|
||||
assert args['extra_body'] == {
|
||||
'custom_extension': True,
|
||||
'thinking': {'type': 'disabled'},
|
||||
}
|
||||
|
||||
|
||||
class _Dumpable:
|
||||
def __init__(self, data: dict):
|
||||
self.data = data
|
||||
|
||||
Reference in New Issue
Block a user