Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a7ac7ad
ENG-1852: Hotfix, added fail-fast option (#488)
kadirpekel Apr 11, 2025
b0887bd
Fix: BUG-503 failed to update utility tool after get (#491)
ahmetgunduz Apr 16, 2025
89daf2f
Bug-503-fix Update (#493)
ahmetgunduz Apr 16, 2025
6bf7d00
ENG-1920: added sentry cred (#476)
xainaz Apr 16, 2025
9e2b03c
Read input variables correctly (#496)
thiago-aixplain Apr 17, 2025
409a893
Fix: file not deleted in test_sql_tool_with_csv test (#492)
ahmetgunduz Apr 17, 2025
3acfacd
ENG-2007: Fix agent and team agent parametrized functional test - Syn…
lucas-aixplain Apr 17, 2025
da7ec38
ENG-1789: Add multiple index backbones support (#443)
basitanees Apr 23, 2025
d360780
ENG-2049: rename air functions (#500)
thiago-aixplain Apr 24, 2025
24e88da
ENG 1924: aixplain sdk new test cases for agents using utility and pi…
OsujiCC Apr 24, 2025
044d8d8
add pydantic requirement (#502)
basitanees Apr 25, 2025
4efdbc8
ENG-1978: Adding instructions to teams (#485)
thiago-aixplain Apr 25, 2025
ab2fcc5
BUG-504: Merged paramMappings for the same link vectors (#499)
kadirpekel Apr 25, 2025
268cc1a
ENG-1836: Set name of tools on the SDK (#501)
thiago-aixplain Apr 28, 2025
9796d19
Eng 2051 Improvements on CI flow (#509)
kadirpekel Apr 30, 2025
f0837fc
Add a finetuned version of BGE model (#512)
Muhammad-Elmallah May 5, 2025
511bf5f
ENG-2055-Aixplain-SDK-Centralized-Error-Handling (#510)
ahmetgunduz May 6, 2025
0c4edf4
ENG-1862:Added status to Tools and deployment check for Agent and Tea…
ahmetgunduz May 6, 2025
0989c51
Merge branch 'test' into development
hadi-aix May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 69 additions & 18 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,79 @@ on:
workflow_dispatch:

jobs:
setup-and-test:
test:
runs-on: ubuntu-latest
timeout-minutes: 45 # Global timeout fallback
strategy:
fail-fast: false
matrix:
test-suite: [
'tests/unit',
'tests/functional/file_asset',
'tests/functional/data_asset',
'tests/functional/benchmark',
'tests/functional/model',
'tests/functional/pipelines/run_test.py --pipeline_version 2.0 --sdk_version v1 --sdk_version_param PipelineFactory',
'tests/functional/pipelines/run_test.py --pipeline_version 2.0 --sdk_version v2 --sdk_version_param PipelineFactory',
'tests/functional/pipelines/run_test.py --pipeline_version 3.0 --sdk_version v1 --sdk_version_param PipelineFactory',
'tests/functional/pipelines/run_test.py --pipeline_version 3.0 --sdk_version v2 --sdk_version_param PipelineFactory',
'tests/functional/pipelines/designer_test.py',
'tests/functional/pipelines/create_test.py',
'tests/functional/finetune --sdk_version v1 --sdk_version_param FinetuneFactory',
'tests/functional/finetune --sdk_version v2 --sdk_version_param FinetuneFactory',
'tests/functional/general_assets',
'tests/functional/apikey',
'tests/functional/agent tests/functional/team_agent',
'unit',
'file_asset',
'data_asset',
'benchmark',
'model',
'pipeline_2.0_v1',
'pipeline_2.0_v2',
'pipeline_3.0_v1',
'pipeline_3.0_v2',
'pipeline_designer',
'pipeline_create',
'finetune_v1',
'finetune_v2',
'general_assets',
'apikey',
'agent_and_team_agent',
]
include:
- test-suite: 'unit'
path: 'tests/unit'
timeout: 45 # Tweaked timeout for each unit tests
- test-suite: 'file_asset'
path: 'tests/functional/file_asset'
timeout: 45
- test-suite: 'data_asset'
path: 'tests/functional/data_asset'
timeout: 45
- test-suite: 'benchmark'
path: 'tests/functional/benchmark'
timeout: 45
- test-suite: 'model'
path: 'tests/functional/model'
timeout: 45
- test-suite: 'pipeline_2.0_v1'
path: 'tests/functional/pipelines/run_test.py --pipeline_version 2.0 --sdk_version v1 --sdk_version_param PipelineFactory'
timeout: 45
- test-suite: 'pipeline_2.0_v2'
path: 'tests/functional/pipelines/run_test.py --pipeline_version 2.0 --sdk_version v2 --sdk_version_param PipelineFactory'
timeout: 45
- test-suite: 'pipeline_3.0_v1'
path: 'tests/functional/pipelines/run_test.py --pipeline_version 3.0 --sdk_version v1 --sdk_version_param PipelineFactory'
timeout: 45
- test-suite: 'pipeline_3.0_v2'
path: 'tests/functional/pipelines/run_test.py --pipeline_version 3.0 --sdk_version v2 --sdk_version_param PipelineFactory'
timeout: 45
- test-suite: 'pipeline_designer'
path: 'tests/functional/pipelines/designer_test.py'
timeout: 45
- test-suite: 'pipeline_create'
path: 'tests/functional/pipelines/create_test.py'
timeout: 45
- test-suite: 'finetune_v1'
path: 'tests/functional/finetune --sdk_version v1 --sdk_version_param FinetuneFactory'
timeout: 45
- test-suite: 'finetune_v2'
path: 'tests/functional/finetune --sdk_version v2 --sdk_version_param FinetuneFactory'
timeout: 45
- test-suite: 'general_assets'
path: 'tests/functional/general_assets'
timeout: 45
- test-suite: 'apikey'
path: 'tests/functional/apikey'
timeout: 45
- test-suite: 'agent_and_team_agent'
path: 'tests/functional/agent tests/functional/team_agent'
timeout: 45
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -62,4 +112,5 @@ jobs:
fi

- name: Run Tests
run: python -m pytest ${{ matrix.test-suite}}
timeout-minutes: ${{ matrix.timeout }}
run: python -m pytest ${{ matrix.path }}
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ repos:
hooks:
- id: flake8
args: # arguments to configure flake8
- --ignore=E402,E501,E203
- --ignore=E402,E501,E203,W503
1 change: 1 addition & 0 deletions aixplain/enums/asset_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ class AssetStatus(Text, Enum):
COMPLETED = "completed"
CANCELING = "canceling"
CANCELED = "canceled"
DEPRECATED_DRAFT = "deprecated_draft"
4 changes: 1 addition & 3 deletions aixplain/enums/embedding_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ class EmbeddingModel(str, Enum):
JINA_CLIP_V2_MULTIMODAL = "67c5f705d8f6a65d6f74d732"
MULTILINGUAL_E5_LARGE = "67efd0772a0a850afa045af3"
BGE_M3 = "67f401032a0a850afa045b19"



AIXPLAIN_LEGAL_EMBEDDINGS = "681254b668e47e7844c1f15a"

def __str__(self):
return self._value_
2 changes: 1 addition & 1 deletion aixplain/enums/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from enum import Enum
from urllib.parse import urljoin
from aixplain.utils import config
from aixplain.utils.request_utils import _request_with_retry
from aixplain.utils.cache_utils import save_to_cache, load_from_cache, CACHE_FOLDER
from aixplain.utils.request_utils import _request_with_retry

CACHE_FILE = f"{CACHE_FOLDER}/licenses.json"

Expand Down
2 changes: 1 addition & 1 deletion aixplain/enums/supplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import logging

from aixplain.utils import config
from aixplain.utils.file_utils import _request_with_retry
from aixplain.utils.request_utils import _request_with_retry
from enum import Enum
from urllib.parse import urljoin
import re
Expand Down
116 changes: 116 additions & 0 deletions aixplain/exceptions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
"""
Error message registry for aiXplain SDK.

This module maintains a centralized registry of error messages used throughout the aiXplain ecosystem.
It allows developers to look up existing error messages and reuse them instead of creating new ones.
"""

from aixplain.exceptions.types import (
AixplainBaseException,
AuthenticationError,
ValidationError,
ResourceError,
BillingError,
SupplierError,
NetworkError,
ServiceError,
InternalError,
)


def get_error_from_status_code(status_code: int, error_details: str = None) -> AixplainBaseException:
"""
Map HTTP status codes to appropriate exception types.

Args:
status_code (int): The HTTP status code to map.
default_message (str, optional): The default message to use if no specific message is available.

Returns:
AixplainBaseException: An exception of the appropriate type.
"""
try:
if isinstance(status_code, str):
status_code = int(status_code)
except Exception as e:
raise InternalError(f"Failed to get status code from {status_code}: {e}") from e

error_details = f"Details: {error_details}" if error_details else ""
if status_code == 400:
return ValidationError(
message=f"Bad request: Please verify the request payload and ensure it is correct. {error_details}".strip(),
status_code=status_code,
)
elif status_code == 401:
return AuthenticationError(
message=f"Unauthorized API key: Please verify the spelling of the API key and its current validity. {error_details}".strip(),
status_code=status_code,
)
elif status_code == 402:
return BillingError(
message=f"Payment required: Please ensure you have enough credits to run this asset. {error_details}".strip(),
status_code=status_code,
)
elif status_code == 403:
# 403 could be auth or resource, using ResourceError as a general 'forbidden'
return ResourceError(
message=f"Forbidden access: Please verify the API key and its current validity. {error_details}".strip(),
status_code=status_code,
)
elif status_code == 404:
# Added 404 mapping
return ResourceError(
message=f"Resource not found: Please verify the spelling of the resource and its current availability. {error_details}".strip(),
status_code=status_code,
)
elif status_code == 429:
# Using SupplierError for rate limiting as per your original function
return SupplierError(
message=f"Rate limit exceeded: Please try again later. {error_details}".strip(),
status_code=status_code,
retry_recommended=True,
)
elif status_code == 500:
return InternalError(
message=f"Internal server error: Please try again later. {error_details}".strip(),
status_code=status_code,
retry_recommended=True,
)
elif status_code == 503:
return ServiceError(
message=f"Service unavailable: Please try again later. {error_details}".strip(),
status_code=status_code,
retry_recommended=True,
)
elif status_code == 504:
return NetworkError(
message=f"Gateway timeout: Please try again later. {error_details}".strip(),
status_code=status_code,
retry_recommended=True,
)
elif 460 <= status_code < 470:
return ResourceError(
message=f"Subscription-related error: Please ensure that your subscription is active and has not expired. {error_details}".strip(),
status_code=status_code,
)
elif 470 <= status_code < 480:
return BillingError(
message=f"Billing-related error: Please ensure you have enough credits to run this asset. {error_details}".strip(),
status_code=status_code,
)
elif 480 <= status_code < 490:
return SupplierError(
message=f"Supplier-related error: Please ensure that the selected supplier provides the asset you are trying to access. {error_details}".strip(),
status_code=status_code,
)
elif 490 <= status_code < 500:
return ValidationError(
message=f"Validation-related error: Please verify the request payload and ensure it is correct. {error_details}".strip(),
status_code=status_code,
)
else:
# Catch-all for other client/server errors
category = "Client" if 400 <= status_code < 500 else "Server"
return InternalError(
message=f"Unspecified {category} Error (Status {status_code}) {error_details}".strip(), status_code=status_code
)
Loading