1+ from typing import Any , Dict , List , Optional , Tuple , Union
2+
13import inspect
24import logging
35import traceback
46from dataclasses import dataclass
57from functools import singledispatchmethod
6- from typing import List , Any , Union , Dict , Optional , Tuple
78
89from mlflow import MlflowClient
910
10- from giskard .client .dtos import TestSuiteDTO , TestInputDTO , SuiteTestDTO
11+ from giskard .client .dtos import SuiteTestDTO , TestInputDTO , TestSuiteDTO
1112from giskard .client .giskard_client import GiskardClient
1213from giskard .core .core import TestFunctionMeta
1314from giskard .datasets .base import Dataset
1415from giskard .ml_worker .core .savable import Artifact
1516from giskard .ml_worker .exceptions .IllegalArgumentError import IllegalArgumentError
16- from giskard .ml_worker .testing .registry .giskard_test import (
17- GiskardTest ,
18- Test ,
19- GiskardTestMethod ,
20- )
17+ from giskard .ml_worker .testing .registry .giskard_test import GiskardTest , GiskardTestMethod , Test
2118from giskard .ml_worker .testing .registry .registry import tests_registry
2219from giskard .ml_worker .testing .registry .slicing_function import SlicingFunction
23- from giskard .ml_worker .testing .registry .transformation_function import (
24- TransformationFunction ,
25- )
26- from giskard .ml_worker .testing .test_result import (
27- TestResult ,
28- TestMessage ,
29- TestMessageLevel ,
30- )
20+ from giskard .ml_worker .testing .registry .transformation_function import TransformationFunction
21+ from giskard .ml_worker .testing .test_result import TestMessage , TestMessageLevel , TestResult
3122from giskard .models .base import BaseModel
3223
3324logger = logging .getLogger (__name__ )
@@ -97,6 +88,7 @@ def _repr_html_(self):
9788
9889 def to_mlflow (self , mlflow_client : MlflowClient = None , mlflow_run_id : str = None ):
9990 import mlflow
91+
10092 from giskard .integrations .mlflow .giskard_evaluator_utils import process_text
10193
10294 metrics = dict ()
@@ -122,8 +114,10 @@ def to_wandb(self, **kwargs) -> None:
122114 Additional keyword arguments
123115 (see https://docs.wandb.ai/ref/python/init) to be added to the active WandB run.
124116 """
125- from giskard .integrations .wandb .wandb_utils import wandb_run , _parse_test_name
126117 import wandb
118+
119+ from giskard .integrations .wandb .wandb_utils import _parse_test_name , wandb_run
120+
127121 from ..utils .analytics_collector import analytics
128122
129123 with wandb_run (** kwargs ) as run :
@@ -426,22 +420,25 @@ def upload(self, client: GiskardClient, project_key: str):
426420 """
427421 if self .name is None :
428422 self .name = "Unnamed test suite"
429-
423+
424+ uploaded_uuids : List [str ] = []
430425 # Upload the default parameters if they are model or dataset
431426 for arg in self .default_params .values ():
432427 if isinstance (arg , BaseModel ) or isinstance (arg , Dataset ):
433428 arg .upload (client , project_key )
429+ uploaded_uuids .append (str (arg .id ))
434430
435- self .id = client .save_test_suite (self .to_dto (client , project_key ))
431+ self .id = client .save_test_suite (self .to_dto (client , project_key , uploaded_uuids ))
436432 project_id = client .get_project (project_key ).project_id
437433 print (f"Test suite has been saved: { client .host_url } /main/projects/{ project_id } /test-suite/{ self .id } /overview" )
438434 return self
439435
440- def to_dto (self , client : GiskardClient , project_key : str ):
436+ def to_dto (self , client : GiskardClient , project_key : str , uploaded_uuids : Optional [ List [ str ]] = None ):
441437 suite_tests : List [SuiteTestDTO ] = list ()
442438
443439 # Avoid to upload the same artifacts several times
444- uploaded_uuids : List [str ] = []
440+ if uploaded_uuids is None :
441+ uploaded_uuids = []
445442
446443 for t in self .tests :
447444 suite_tests .append (
0 commit comments