-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for the deletion of fine-tuned models --------- Co-authored-by: arresejo <[email protected]>
- Loading branch information
Showing
9 changed files
with
93 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "mistralai" | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
description = "" | ||
authors = ["Bam4d <[email protected]>"] | ||
readme = "README.md" | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from mistralai.models.models import ModelDeleted | ||
|
||
from .utils import mock_model_deleted_response_payload, mock_response | ||
|
||
|
||
class TestDeleteModel: | ||
def test_delete_model(self, client): | ||
expected_response_model = ModelDeleted.model_validate_json(mock_model_deleted_response_payload()) | ||
client._client.request.return_value = mock_response(200, expected_response_model.json()) | ||
|
||
response_model = client.delete_model("model_id") | ||
|
||
client._client.request.assert_called_once_with( | ||
"delete", | ||
"https://api.mistral.ai/v1/models/model_id", | ||
headers={ | ||
"User-Agent": f"mistral-client-python/{client._version}", | ||
"Accept": "application/json", | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer test_api_key", | ||
}, | ||
json={}, | ||
data=None, | ||
) | ||
|
||
assert response_model == expected_response_model |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
from mistralai.models.models import ModelDeleted | ||
|
||
from .utils import mock_model_deleted_response_payload, mock_response | ||
|
||
|
||
class TestAsyncDeleteModel: | ||
@pytest.mark.asyncio | ||
async def test_delete_model(self, async_client): | ||
expected_response_model = ModelDeleted.model_validate_json(mock_model_deleted_response_payload()) | ||
async_client._client.request.return_value = mock_response(200, expected_response_model.json()) | ||
|
||
response_model = await async_client.delete_model("model_id") | ||
|
||
async_client._client.request.assert_called_once_with( | ||
"delete", | ||
"https://api.mistral.ai/v1/models/model_id", | ||
headers={ | ||
"User-Agent": f"mistral-client-python/{async_client._version}", | ||
"Accept": "application/json", | ||
"Content-Type": "application/json", | ||
"Authorization": "Bearer test_api_key", | ||
}, | ||
json={}, | ||
data=None, | ||
) | ||
|
||
assert response_model == expected_response_model |
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