Lower Gemini chat thinking level

This commit is contained in:
2026-10-09 14:31:12 +09:00
parent fea0323d5e
commit 974c7e6cb2
2 changed files with 6 additions and 1 deletions
@@ -161,7 +161,10 @@ async def ask_knowledge_chat(payload: ChatRequest, _session=Depends(verify_sessi
response = await client.post(
f"https://generativelanguage.googleapis.com/v1beta/models/{MODEL}:generateContent",
headers={"x-goog-api-key": key},
json={"contents": [{"parts": [{"text": prompt}]}]},
json={
"contents": [{"parts": [{"text": prompt}]}],
"generationConfig": {"thinkingConfig": {"thinkingLevel": "low"}},
},
)
if response.status_code >= 400:
logger.warning(
@@ -135,11 +135,13 @@ def test_chat_searches_all_knowledge_markdown_except_excluded_folders(monkeypatc
async def post(self, url, *, headers, json):
sent["prompt"] = json["contents"][0]["parts"][0]["text"]
sent["thinking_level"] = json["generationConfig"]["thinkingConfig"]["thinkingLevel"]
return Response()
monkeypatch.setattr(chat.httpx, "AsyncClient", Client)
result = asyncio.run(chat.ask_knowledge_chat(chat.ChatRequest(question="임도 기준"), {}))
assert result["answer"] == "설명 [1]"
assert sent["thinking_level"] == "low"
paths = {source["path"] for source in result["sources"]}
assert paths == {"original/법률/현행.md"}
assert "실무문서" not in sent["prompt"]