Skip to content

Commit

Permalink
Fixing UT
Browse files Browse the repository at this point in the history
  • Loading branch information
dristy.cd committed Aug 6, 2024
1 parent fa95b87 commit 5ed0d62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pebblo/topic_classifier/topic_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
TOPICS_TO_EXCLUDE,
)
from pebblo.topic_classifier.enums.constants import topic_display_names
from pebblo.utils import get_confidence_score_label

logger = get_logger(__name__)

Expand Down Expand Up @@ -93,7 +94,11 @@ def _get_topics(topic_model_response):
most_possible_advice = max(topics, key=lambda t: topics[t])
final_topic = {
most_possible_advice: [
{"confidence_score": topics[most_possible_advice]}
{
"confidence_score": get_confidence_score_label(
(topics[most_possible_advice])
)
}
]
}
return final_topic, len(final_topic.keys())
2 changes: 2 additions & 0 deletions tests/app/service/test_prompt_gov.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

import tests.log # noqa: F401
from pebblo.app.libs.responses import PebbloJsonResponse
from pebblo.app.models.models import PromptGovResponseModel
from pebblo.app.service.prompt_gov import PromptGov
Expand All @@ -20,6 +21,7 @@ def test_process_request_success(mock_entity_classifier):
{"us-ssn": 1},
1,
"anonymized document",
{"us-ssn": [{"location": "16_27", "confidence_score": "HIGH"}]},
)

data = {"prompt": "Sachin's SSN is 222-85-4836"}
Expand Down

0 comments on commit 5ed0d62

Please sign in to comment.