mirror of
https://github.com/Alishahryar1/free-claude-code.git
synced 2026-06-01 22:09:04 +02:00
fix: avoid dual gemini thinking controls
This commit is contained in:
@@ -53,7 +53,6 @@ def build_request_body(request_data: Any, *, thinking_enabled: bool) -> dict:
|
||||
extra_body.update(deepcopy(request_extra))
|
||||
|
||||
if thinking_enabled:
|
||||
body["reasoning_effort"] = "high"
|
||||
_apply_thinking_config(extra_body)
|
||||
else:
|
||||
body["reasoning_effort"] = "none"
|
||||
|
||||
@@ -99,7 +99,7 @@ def test_build_request_body_basic(gemini_provider):
|
||||
|
||||
assert body["model"] == "gemini-2.5-flash"
|
||||
assert body["messages"][0]["role"] == "system"
|
||||
assert body["reasoning_effort"] == "high"
|
||||
assert "reasoning_effort" not in body
|
||||
eb = body.get("extra_body")
|
||||
assert isinstance(eb, dict)
|
||||
literal_extra_body = eb.get("extra_body")
|
||||
@@ -119,6 +119,7 @@ def test_build_request_body_sdk_wire_json_has_literal_extra_body(gemini_provider
|
||||
body = gemini_provider._build_request_body(req)
|
||||
wire_json = _simulate_openai_sdk_wire_json(body)
|
||||
|
||||
assert "reasoning_effort" not in wire_json
|
||||
assert "google" not in wire_json
|
||||
literal_extra_body = wire_json.get("extra_body")
|
||||
assert isinstance(literal_extra_body, dict)
|
||||
@@ -153,6 +154,7 @@ def test_build_request_body_preserves_caller_extra_body(gemini_provider):
|
||||
|
||||
body = gemini_provider._build_request_body(req)
|
||||
|
||||
assert "reasoning_effort" not in body
|
||||
eb = body.get("extra_body")
|
||||
assert isinstance(eb, dict)
|
||||
assert eb.get("metadata") == {"user": "u1"}
|
||||
@@ -177,6 +179,7 @@ def test_build_request_body_merges_caller_nested_google(gemini_provider):
|
||||
|
||||
body = gemini_provider._build_request_body(req)
|
||||
|
||||
assert "reasoning_effort" not in body
|
||||
eb = body.get("extra_body")
|
||||
assert isinstance(eb, dict)
|
||||
assert eb.get("metadata") == {"user": "u1"}
|
||||
@@ -221,6 +224,17 @@ async def test_stream_response_text(gemini_provider):
|
||||
assert any(
|
||||
'"text_delta"' in event and "Hello back!" in event for event in events
|
||||
)
|
||||
kwargs = mock_create.call_args.kwargs
|
||||
assert "reasoning_effort" not in kwargs
|
||||
extra_body = kwargs.get("extra_body")
|
||||
assert isinstance(extra_body, dict)
|
||||
literal_extra_body = extra_body.get("extra_body")
|
||||
assert isinstance(literal_extra_body, dict)
|
||||
google = literal_extra_body.get("google")
|
||||
assert isinstance(google, dict)
|
||||
thinking_config = google.get("thinking_config")
|
||||
assert isinstance(thinking_config, dict)
|
||||
assert thinking_config.get("include_thoughts") is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user