diff --git a/B01_Dashboard/B01_Dashboard_Knowledge_Chat.py b/B01_Dashboard/B01_Dashboard_Knowledge_Chat.py index e6755349c..cea3a1c2a 100644 --- a/B01_Dashboard/B01_Dashboard_Knowledge_Chat.py +++ b/B01_Dashboard/B01_Dashboard_Knowledge_Chat.py @@ -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( diff --git a/resources/tester/test_b01_knowledge_chat.py b/resources/tester/test_b01_knowledge_chat.py index 5d7e6a1c5..be1d819c6 100644 --- a/resources/tester/test_b01_knowledge_chat.py +++ b/resources/tester/test_b01_knowledge_chat.py @@ -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"]