@@ -82,8 +82,7 @@ def __init__(
8282 fallback_models : Optional [List [str ]] = None ,
8383 teamspace : Optional [str ] = None ,
8484 max_retries : int = 3 ,
85- lightning_api_key : Optional [str ] = None ,
86- lightning_user_id : Optional [str ] = None ,
85+ api_key : Optional [str ] = None ,
8786 enable_async : Optional [bool ] = False ,
8887 verbose : int = 0 ,
8988 full_response : Optional [bool ] = None ,
@@ -96,26 +95,15 @@ def __init__(
9695 if the main model fails. Defaults to None.
9796 teamspace (Optional[List[str]]): Teamspace used for billing.
9897 max_retries (int): The maximum number of retries for API requests. Defaults to 3.
99- lightning_api_key (Optional[str]): The API key for Lightning AI. Defaults to None.
100- lightning_user_id (Optional[str]): The user ID for Lightning AI. Defaults to None.
98+ api_key (Optional[str]): The API key for Lightning AI. Defaults to None.
10199 enable_async (Optional[bool]): Enable async requests. Defaults to True.
102100 verbose (int): Verbosity level for logging. Defaults to 0. Must be 0, 1, or 2.
103101 full_response (bool): Whether the entire response should be returned from the chat
104102 """
105- if (lightning_api_key is None ) != (lightning_user_id is None ):
106- missing_param = "lightning_api_key" if lightning_api_key is None else "lightning_user_id"
107- raise ValueError (
108- f"Missing required parameter: '{ missing_param } '. "
109- "Both 'lightning_api_key' and 'lightning_user_id' must be provided together. "
110- "Either provide both or none.\n "
111- "To find the API key and user ID, go to the Global Settings page in your Lightning account."
112- )
113-
114- if lightning_api_key is not None and lightning_user_id is not None :
115- os .environ ["LIGHTNING_API_KEY" ] = lightning_api_key
116- os .environ ["LIGHTNING_USER_ID" ] = lightning_user_id
103+ if api_key is not None :
104+ os .environ ["LIGHTNING_API_KEY" ] = api_key
117105
118- if os .environ .get ("LIGHTNING_API_KEY" ) is None and os . environ . get ( "LIGHTNING_USER_ID" ) is None :
106+ if os .environ .get ("LIGHTNING_API_KEY" ) is None :
119107 self ._authenticate ()
120108
121109 if verbose not in [0 , 1 , 2 ]:
0 commit comments