Skip to content

Commit

Permalink
Merge pull request #57 from AryaXAI/bugfix_test
Browse files Browse the repository at this point in the history
Model test tags optional and v2 apis
  • Loading branch information
chintanarya authored Oct 18, 2024
2 parents d7ec85b + 6c4da7d commit ea42334
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 51 deletions.
94 changes: 47 additions & 47 deletions aryaxai/common/xai_uris.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# URIs of XAI base service starts here
# Auth
LOGIN_URI = f"{API_VERSION}/access-token/authorize"
LOGIN_URI = f"{API_VERSION_V2}/access-token/authorize"

# User
GET_WORKSPACES_URI = f"{API_VERSION_V2}/users/workspaces"
Expand All @@ -25,28 +25,28 @@
AVAILABLE_BATCH_SERVERS_URI = f"{API_VERSION_V2}/users/automl_custom_servers"

# Notifications
GET_NOTIFICATIONS_URI = f"{API_VERSION}/notifications/fetch"
CLEAR_NOTIFICATIONS_URI = f"{API_VERSION}/notifications/clear"
GET_NOTIFICATIONS_URI = f"{API_VERSION_V2}/notifications/fetch"
CLEAR_NOTIFICATIONS_URI = f"{API_VERSION_V2}/notifications/clear"

# Workspace
UPDATE_WORKSPACE_URI = f"{API_VERSION_V2}/users/workspace_config_update"
CREATE_PROJECT_URI = f"{API_VERSION_V2}/users/create_project"

# Project
UPDATE_PROJECT_URI = f"{API_VERSION_V2}/users/project_config_update"
UPLOAD_DATA_FILE_URI = f"{API_VERSION}/project/uploadfile_with_info"
UPLOAD_DATA_FILE_INFO_URI = f"{API_VERSION}/project/get_Uploaded_file_info"
DELETE_DATA_FILE_URI = f"{API_VERSION}/project/delete_data"
ALL_DATA_FILE_URI = f"{API_VERSION}/project/get_all_uploaded_files"
UPLOAD_DATA_FILE_URI = f"{API_VERSION_V2}/project/uploadfile_with_info"
UPLOAD_DATA_FILE_INFO_URI = f"{API_VERSION_V2}/project/get_Uploaded_file_info"
DELETE_DATA_FILE_URI = f"{API_VERSION_V2}/project/delete_data"
ALL_DATA_FILE_URI = f"{API_VERSION_V2}/project/get_all_uploaded_files"
UPLOAD_DATA_URI = f"{API_VERSION_V2}/project/upload_data"
UPLOAD_DATA_WITH_CHECK_URI = f"{API_VERSION_V2}/project/upload_data_with_check"
UPLOAD_MODEL_URI = f"{API_VERSION_V2}/project/upload_model"
GET_MODEL_TYPES_URI = f"{API_VERSION}/project/get_model_types"
GET_DATA_SUMMARY_URI = f"{API_VERSION}/project/data_summary"
GET_DATA_DIAGNOSIS_URI = f"{API_VERSION}/project/get_data_diagnosis"
GET_MODEL_TYPES_URI = f"{API_VERSION_V2}/project/get_model_types"
GET_DATA_SUMMARY_URI = f"{API_VERSION_V2}/project/data_summary"
GET_DATA_DIAGNOSIS_URI = f"{API_VERSION_V2}/project/get_data_diagnosis"
RUN_DATA_DRIFT_DIAGNOSIS_URI = f"{API_VERSION_V2}/project/run_data_drift_diagnosis"
GET_DATA_DRIFT_DIAGNOSIS_URI = f"{API_VERSION_V2}/project/get_data_drift_diagnosis"
GET_PROJECT_CONFIG = f"{API_VERSION}/users/get_xai_config"
GET_PROJECT_CONFIG = f"{API_VERSION_V2}/users/get_xai_config"
AVAILABLE_TAGS_URI = f"{API_VERSION_V2}/project/get_all_available_tags_info"
TAG_DATA_URI = f"{API_VERSION_V2}/project/tag_data"

Expand All @@ -61,67 +61,67 @@
DOWNLOAD_DASHBOARD_LOGS_URI = f"{API_VERSION_V2}/dashboards/download_dashboard_logs"

# Auto ML
MODEL_PARAMETERS_URI = f"{API_VERSION}/users/get_xai_model_parameters"
MODEL_PARAMETERS_URI = f"{API_VERSION_V2}/users/get_xai_model_parameters"
TRAIN_MODEL_URI = f"{API_VERSION_V2}/users/xai_config_update"
GET_MODELS_URI = f"{API_VERSION}/ai-models/get_all_models"
UPDATE_ACTIVE_MODEL_URI = f"{API_VERSION}/ai-models/update_active_model"
REMOVE_MODEL_URI = f"{API_VERSION}/ai-models/remove_model"
GET_MODELS_URI = f"{API_VERSION_V2}/ai-models/get_all_models"
UPDATE_ACTIVE_MODEL_URI = f"{API_VERSION_V2}/ai-models/update_active_model"
REMOVE_MODEL_URI = f"{API_VERSION_V2}/ai-models/remove_model"
RUN_MODEL_ON_DATA_URI = f"{API_VERSION_V2}/ai-models/run_model_on_data"
DOWNLOAD_TAG_DATA_URI = f"{API_VERSION}/ai-models/download_tag_data"
MODEL_SUMMARY_URI = f"{API_VERSION}/project/get_model_perfermance"
MODEL_SVG_URI = f"{API_VERSION}/project/get_model_svg_plot"
MODEL_INFERENCES_URI = f"{API_VERSION}/ai-models/get_all_tags_for_models"
DOWNLOAD_TAG_DATA_URI = f"{API_VERSION_V2}/ai-models/download_tag_data"
MODEL_SUMMARY_URI = f"{API_VERSION_V2}/project/get_model_perfermance"
MODEL_SVG_URI = f"{API_VERSION_V2}/project/get_model_svg_plot"
MODEL_INFERENCES_URI = f"{API_VERSION_V2}/ai-models/get_all_tags_for_models"

# Explainability
GET_CASES_URI = f"{API_VERSION}/ai-models/get_cases"
SEARCH_CASE_URI = f"{API_VERSION}/ai-models/search_case"
CASE_INFO_URI = f"{API_VERSION}/ai-models/get_case_info"
DELETE_CASE_URI = f"{API_VERSION}/project/delete_data_with_filter"
GET_CASES_URI = f"{API_VERSION_V2}/ai-models/get_cases"
SEARCH_CASE_URI = f"{API_VERSION_V2}/ai-models/search_case"
CASE_INFO_URI = f"{API_VERSION_V2}/ai-models/get_case_info"
DELETE_CASE_URI = f"{API_VERSION_V2}/project/delete_data_with_filter"
CASE_LOGS_URI = f"{API_VERSION_V2}/ai-models/explainability_logs"
GET_VIEWED_CASE_URI = f"{API_VERSION_V2}/ai-models/get_viewed_case"

# Observations
GET_OBSERVATIONS_URI = f"{API_VERSION}/observations/get_observations"
GET_OBSERVATION_PARAMS_URI = f"{API_VERSION}/observations/get_observation_params"
CREATE_OBSERVATION_URI = f"{API_VERSION}/observations/create_observation"
UPDATE_OBSERVATION_URI = f"{API_VERSION}/observations/observation_config_update"
GET_OBSERVATIONS_URI = f"{API_VERSION_V2}/observations/get_observations"
GET_OBSERVATION_PARAMS_URI = f"{API_VERSION_V2}/observations/get_observation_params"
CREATE_OBSERVATION_URI = f"{API_VERSION_V2}/observations/create_observation"
UPDATE_OBSERVATION_URI = f"{API_VERSION_V2}/observations/observation_config_update"

# Policies
GET_POLICIES_URI = f"{API_VERSION}/policies/get_policies"
GET_POLICY_PARAMS_URI = f"{API_VERSION}/policies/get_policy_params"
CREATE_POLICY_URI = f"{API_VERSION}/policies/create_policy"
UPDATE_POLICY_URI = f"{API_VERSION}/policies/policy_config_update"
GET_POLICIES_URI = f"{API_VERSION_V2}/policies/get_policies"
GET_POLICY_PARAMS_URI = f"{API_VERSION_V2}/policies/get_policy_params"
CREATE_POLICY_URI = f"{API_VERSION_V2}/policies/create_policy"
UPDATE_POLICY_URI = f"{API_VERSION_V2}/policies/policy_config_update"

# Alerts
GET_TRIGGERS_URI = f"{API_VERSION_V2}/triggers/get_triggers"
CREATE_TRIGGER_URI = f"{API_VERSION_V2}/triggers/update_triggers"
DELETE_TRIGGER_URI = f"{API_VERSION_V2}/triggers/update_triggers"
EXECUTED_TRIGGER_URI = f"{API_VERSION_V2}/triggers/get_executed_triggers"
GET_EXECUTED_TRIGGER_INFO = f"{API_VERSION_V2}/triggers/get_trigger_details"
GET_LABELS_URI = f"{API_VERSION}/triggers/get_label_classes"
GET_LABELS_URI = f"{API_VERSION_V2}/triggers/get_label_classes"

# Synthetic AI
AVAILABLE_SYNTHETIC_CUSTOM_SERVERS_URI = f"{API_VERSION}/synthetics/custom_servers"
AVAILABLE_SYNTHETIC_CUSTOM_SERVERS_URI = f"{API_VERSION_V2}/synthetics/custom_servers"
GET_SYNTHETIC_MODEL_PARAMS_URI = (
f"{API_VERSION}/synthetics/get_synthetic_model_parameters"
f"{API_VERSION_V2}/synthetics/get_synthetic_model_parameters"
)
TRAIN_SYNTHETIC_MODEL_URI = f"{API_VERSION}/synthetics/train_synthetic_model"
GET_SYNTHETIC_MODELS_URI = f"{API_VERSION}/synthetics/get_synthetics_models"
DELETE_SYNTHETIC_MODEL_URI = f"{API_VERSION}/synthetics/delete_synthetic_model"
TRAIN_SYNTHETIC_MODEL_URI = f"{API_VERSION_V2}/synthetics/train_synthetic_model"
GET_SYNTHETIC_MODELS_URI = f"{API_VERSION_V2}/synthetics/get_synthetics_models"
DELETE_SYNTHETIC_MODEL_URI = f"{API_VERSION_V2}/synthetics/delete_synthetic_model"
GET_SYNTHETIC_MODEL_DETAILS_URI = (
f"{API_VERSION}/synthetics/get_synthetic_model_details"
f"{API_VERSION_V2}/synthetics/get_synthetic_model_details"
)
GENERATE_SYNTHETIC_DATA_URI = f"{API_VERSION}/synthetics/generate_synthetic_data"
GENERATE_ANONYMITY_SCORE_URI = f"{API_VERSION}/synthetics/generate_anonimity_score"
GET_ANONYMITY_SCORE_URI = f"{API_VERSION}/synthetics/get_anonimity_score"
GENERATE_SYNTHETIC_DATA_URI = f"{API_VERSION_V2}/synthetics/generate_synthetic_data"
GENERATE_ANONYMITY_SCORE_URI = f"{API_VERSION_V2}/synthetics/generate_anonimity_score"
GET_ANONYMITY_SCORE_URI = f"{API_VERSION_V2}/synthetics/get_anonimity_score"

GET_SYNTHETIC_DATA_TAGS_URI = f"{API_VERSION}/synthetics/get_synthetic_data_tags"
DOWNLOAD_SYNTHETIC_DATA_URI = f"{API_VERSION}/synthetics/download_synthetic_data"
DELETE_SYNTHETIC_TAG_URI = f"{API_VERSION}/project/delete_data_with_filter"
GET_SYNTHETIC_DATA_TAGS_URI = f"{API_VERSION_V2}/synthetics/get_synthetic_data_tags"
DOWNLOAD_SYNTHETIC_DATA_URI = f"{API_VERSION_V2}/synthetics/download_synthetic_data"
DELETE_SYNTHETIC_TAG_URI = f"{API_VERSION_V2}/project/delete_data_with_filter"

CREATE_SYNTHETIC_PROMPT_URI = f"{API_VERSION}/synthetics/create_synthetic_prompts"
UPDATE_SYNTHETIC_PROMPT_URI = f"{API_VERSION}/synthetics/synthetic_prompts_update"
GET_SYNTHETIC_PROMPT_URI = f"{API_VERSION}/synthetics/get_synthetics_promts"
CREATE_SYNTHETIC_PROMPT_URI = f"{API_VERSION_V2}/synthetics/create_synthetic_prompts"
UPDATE_SYNTHETIC_PROMPT_URI = f"{API_VERSION_V2}/synthetics/synthetic_prompts_update"
GET_SYNTHETIC_PROMPT_URI = f"{API_VERSION_V2}/synthetics/get_synthetics_promts"

# Events
POLL_EVENTS = f"{API_VERSION_V2}/events/poll"
Expand Down
10 changes: 6 additions & 4 deletions aryaxai/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ def upload_model(
model_type: str,
model_name: str,
model_data_tags: List[str],
model_test_tags: Optional[List[str]],
model_test_tags: Optional[List[str]] = None,
instance_type: Optional[str] = None,
):
"""Uploads your custom model on AryaXAI
Expand All @@ -750,8 +750,8 @@ def upload_model(
use upload_model_types() method to get all allowed model_types
:param model_name: name of the model
:param model_data_tags: data tags for model
:param model_test_tags: test tags for model
:param instance_type: instance to be used for uploading model
:param model_test_tags: test tags for model (optional)
:param instance_type: instance to be used for uploading model (optional)
"""

def upload_file_and_return_path() -> str:
Expand All @@ -778,7 +778,9 @@ def upload_file_and_return_path() -> str:

tags = self.tags()
Validate.value_against_list("model_data_tags", model_data_tags, tags)
Validate.value_against_list("model_test_tags", model_test_tags, tags)

if model_test_tags is not None:
Validate.value_against_list("model_test_tags", model_test_tags, tags)

uploaded_path = upload_file_and_return_path()

Expand Down

0 comments on commit ea42334

Please sign in to comment.