From 7478f836d2956bd509af1816aa7d6c5d36b466c0 Mon Sep 17 00:00:00 2001 From: maheshsattala <59285563+maheshsattala@users.noreply.github.com> Date: Fri, 27 Dec 2024 09:22:59 +0530 Subject: [PATCH] llm logs fix (#1708) * excluded data while fetching the llm logs. * excluded data while fetching the llm logs. --- kairon/shared/llm/processor.py | 2 +- tests/integration_test/services_test.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kairon/shared/llm/processor.py b/kairon/shared/llm/processor.py index f627f7f2b..0d121f308 100644 --- a/kairon/shared/llm/processor.py +++ b/kairon/shared/llm/processor.py @@ -363,7 +363,7 @@ def get_logs(bot: str, start_idx: int = 0, page_size: int = 10): @param page_size: page size @return: list of logs. """ - for log in LLMLogs.objects(metadata__bot=bot).order_by("-start_time").skip(start_idx).limit(page_size): + for log in LLMLogs.objects(metadata__bot=bot).order_by("-start_time").skip(start_idx).limit(page_size).exclude('response.data'): llm_log = log.to_mongo().to_dict() llm_log.pop('_id') yield llm_log diff --git a/tests/integration_test/services_test.py b/tests/integration_test/services_test.py index 0bbd8146c..9de5c5646 100644 --- a/tests/integration_test/services_test.py +++ b/tests/integration_test/services_test.py @@ -28671,6 +28671,7 @@ def test_get_llm_logs(): headers={"Authorization": pytest.token_type + " " + pytest.access_token}, ) actual = response.json() + print(actual) assert actual["success"] assert actual["error_code"] == 0 assert len(actual["data"]["logs"]) == 1 @@ -28684,7 +28685,7 @@ def test_get_llm_logs(): assert actual["data"]["logs"][0]["model_params"] == {} assert actual["data"]["logs"][0]["metadata"]['bot'] == pytest.bot assert actual["data"]["logs"][0]["metadata"]['user'] == "test" - + assert not actual["data"]["logs"][0].get('response', {}).get("data", None) def test_add_custom_widget_invalid_config(): response = client.post(