2727import traceback
2828from typing import List
2929from aixplain .factories .file_factory import FileFactory
30- from aixplain .enums import Function
30+ from aixplain .enums import Function , Supplier
3131from aixplain .modules .asset import Asset
3232from aixplain .utils import config
3333from urllib .parse import urljoin
@@ -44,7 +44,7 @@ class Model(Asset):
4444 description (Text, optional): description of the model. Defaults to "".
4545 api_key (Text, optional): API key of the Model. Defaults to None.
4646 url (Text, optional): endpoint of the model. Defaults to config.MODELS_RUN_URL.
47- supplier (Text, optional): model supplier. Defaults to "aiXplain".
47+ supplier (Union[Dict, Text, Supplier, int], optional): supplier of the asset . Defaults to "aiXplain".
4848 version (Text, optional): version of the model. Defaults to "1.0".
4949 function (Text, optional): model AI function. Defaults to None.
5050 url (str): URL to run the model.
@@ -58,7 +58,7 @@ def __init__(
5858 name : Text ,
5959 description : Text = "" ,
6060 api_key : Optional [Text ] = None ,
61- supplier : Text = "aiXplain" ,
61+ supplier : Union [ Dict , Text , Supplier , int ] = "aiXplain" ,
6262 version : Optional [Text ] = None ,
6363 function : Optional [Text ] = None ,
6464 is_subscribed : bool = False ,
@@ -71,7 +71,7 @@ def __init__(
7171 name (Text): Name of the Model
7272 description (Text, optional): description of the model. Defaults to "".
7373 api_key (Text, optional): API key of the Model. Defaults to None.
74- supplier (Text, optional): model supplier. Defaults to "aiXplain".
74+ supplier (Union[Dict, Text, Supplier, int], optional): supplier of the asset . Defaults to "aiXplain".
7575 version (Text, optional): version of the model. Defaults to "1.0".
7676 function (Text, optional): model AI function. Defaults to None.
7777 is_subscribed (bool, optional): Is the user subscribed. Defaults to False.
@@ -95,7 +95,10 @@ def to_dict(self) -> Dict:
9595 return {"id" : self .id , "name" : self .name , "supplier" : self .supplier , "additional_info" : clean_additional_info }
9696
9797 def __repr__ (self ):
98- return f"<Model: { self .name } by { self .supplier } >"
98+ try :
99+ return f"<Model: { self .name } by { self .supplier ['name' ]} >"
100+ except Exception :
101+ return f"<Model: { self .name } by { self .supplier } >"
99102
100103 def __polling (self , poll_url : Text , name : Text = "model_process" , wait_time : float = 0.5 , timeout : float = 300 ) -> Dict :
101104 """Keeps polling the platform to check whether an asynchronous call is done.
0 commit comments