-
Notifications
You must be signed in to change notification settings - Fork 23
Put conditions inside try statements according to changes required. #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e5742ec
Fixing mixup
xainaz e02195f
Fixing mixup
xainaz e6907fc
Fixing mixup
xainaz 3531ae6
Put conditions inside try statements according to changes required.
xainaz 569de4a
Changes made
xainaz e39465d
Logging the error + changing the range of error codes
zaina826 e5714ca
Logging the error + changing the range of error codes
zaina826 050e31b
Logging the error + Account
xainaz 51c4102
Merge branch 'development' into BUG-73-sdk-treat-http-errors
xainaz 18eaf9c
Added elaborative error messages
ae3960a
Added test for model errors
6848dfe
Added all tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -131,4 +131,3 @@ dmypy.json | |
| # Vscode | ||
| .vscode | ||
| .DS_Store | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,36 @@ | ||
|
|
||
| from dotenv import load_dotenv | ||
| from urllib.parse import urljoin | ||
| import requests_mock | ||
| from aixplain.enums import Function | ||
|
|
||
| load_dotenv() | ||
| from aixplain.utils import config | ||
| from aixplain.modules import LLM | ||
|
|
||
| import pytest | ||
|
|
||
| @pytest.mark.parametrize( | ||
| "status_code,error_message", | ||
| [ | ||
| (401,"Unauthorized API key: Please verify the spelling of the API key and its current validity."), | ||
| (465,"Subscription-related error: Please ensure that your subscription is active and has not expired."), | ||
| (475,"Billing-related error: Please ensure you have enough credits to run this model. "), | ||
| (485, "Supplier-related error: Please ensure that the selected supplier provides the model you are trying to access."), | ||
| (495, "Validation-related error: Please ensure all required fields are provided and correctly formatted."), | ||
| (501, "Status 501: Unspecified error: An unspecified error occurred while processing your request."), | ||
|
|
||
| ], | ||
| ) | ||
|
|
||
| def test_run_async_errors(status_code, error_message): | ||
| base_url = config.MODELS_RUN_URL | ||
| llm_id = "llm-id" | ||
| execute_url = urljoin(base_url, f"execute/{llm_id}") | ||
|
|
||
| with requests_mock.Mocker() as mock: | ||
| mock.post(execute_url, status_code=status_code) | ||
| test_llm = LLM(id=llm_id, name="Test llm",url=base_url, function=Function.TEXT_GENERATION) | ||
| response = test_llm.run_async(data="input_data") | ||
| assert response["status"] == "FAILED" | ||
| assert response["error_message"] == error_message |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.