Skip to content

Commit

Permalink
llm logs fix (#1708)
Browse files Browse the repository at this point in the history
* excluded data while fetching the llm logs.

* excluded data while fetching the llm logs.
  • Loading branch information
maheshsattala authored Dec 27, 2024
1 parent d214b3d commit 7478f83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion kairon/shared/llm/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_test/services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down

0 comments on commit 7478f83

Please sign in to comment.