-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added api for the retraining of the bot and added test cases for the …
…same.
- Loading branch information
Mahesh
committed
Nov 8, 2023
1 parent
6a60039
commit 0e9357f
Showing
5 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11898,6 +11898,33 @@ def test_add_training_example_case_insensitivity(): | |
assert actual["error_code"] == 0 | ||
|
||
|
||
@responses.activate | ||
@patch("kairon.shared.data.model_processor.ModelProcessor.is_daily_training_limit_exceeded", autospec=True) | ||
def test_retrain(mock_training_limit): | ||
|
||
mock_training_limit.return_value = False | ||
event_url = urljoin(Utility.environment['events']['server_url'], f"/api/events/execute/{EventClass.model_training}") | ||
responses.add( | ||
"POST", event_url, json={"success": True, "message": "Event triggered successfully!"} | ||
) | ||
|
||
client.post( | ||
f"/api/bot/{pytest.bot}/train", | ||
headers={"Authorization": pytest.token_type + " " + pytest.access_token}, | ||
) | ||
|
||
response = client.post( | ||
f"/api/bot/{pytest.bot}/retrain", | ||
headers={"Authorization": pytest.token_type + " " + pytest.access_token}, | ||
) | ||
actual = response.json() | ||
assert actual["success"] | ||
assert actual["error_code"] == 0 | ||
assert actual["data"] is None | ||
assert actual["message"] == "Model training started." | ||
complete_end_to_end_event_execution(pytest.bot, "[email protected]", EventClass.model_training) | ||
|
||
|
||
def test_add_utterances_case_insensitivity(): | ||
response = client.post( | ||
f"/api/bot/{pytest.bot}/utterance", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters