@@ -113,6 +113,8 @@ def __init__(
113113        - `access_token` from `DIGITALOCEAN_ACCESS_TOKEN` 
114114        - `model_access_key` from `GRADIENT_MODEL_ACCESS_KEY` 
115115        - `agent_access_key` from `GRADIENT_AGENT_ACCESS_KEY` 
116+         - `agent_endpoint` from `GRADIENT_AGENT_ENDPOINT` 
117+         - `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT` 
116118        """ 
117119        if  access_token  is  None :
118120            if  api_key  is  not None :
@@ -149,10 +151,7 @@ def __init__(
149151        self ._agent_endpoint  =  agent_endpoint 
150152
151153        if  inference_endpoint  is  None :
152-             inference_endpoint  =  os .environ .get ("GRADIENT_INFERENCE_ENDPOINT" )
153-             if  inference_endpoint  is  None :
154-                 inference_endpoint  =  "https://inference.do-ai.run" 
155- 
154+             inference_endpoint  =  os .environ .get ("GRADIENT_INFERENCE_ENDPOINT" ) or  "inference.do-ai.run" 
156155        self .inference_endpoint  =  inference_endpoint 
157156
158157        if  base_url  is  None :
@@ -267,9 +266,7 @@ def default_headers(self) -> dict[str, str | Omit]:
267266
268267    @override  
269268    def  _validate_headers (self , headers : Headers , custom_headers : Headers ) ->  None :
270-         if  (
271-             self .access_token  or  self .agent_access_key  or  self .model_access_key 
272-         ) and  headers .get ("Authorization" ):
269+         if  (self .access_token  or  self .agent_access_key  or  self .model_access_key ) and  headers .get ("Authorization" ):
273270            return 
274271        if  isinstance (custom_headers .get ("Authorization" ), Omit ):
275272            return 
@@ -303,14 +300,10 @@ def copy(
303300        Create a new client instance re-using the same options given to the current client with optional overriding. 
304301        """ 
305302        if  default_headers  is  not None  and  set_default_headers  is  not None :
306-             raise  ValueError (
307-                 "The `default_headers` and `set_default_headers` arguments are mutually exclusive" 
308-             )
303+             raise  ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
309304
310305        if  default_query  is  not None  and  set_default_query  is  not None :
311-             raise  ValueError (
312-                 "The `default_query` and `set_default_query` arguments are mutually exclusive" 
313-             )
306+             raise  ValueError ("The `default_query` and `set_default_query` arguments are mutually exclusive" )
314307
315308        headers  =  self ._custom_headers 
316309        if  default_headers  is  not None :
@@ -358,14 +351,10 @@ def _make_status_error(
358351            return  _exceptions .BadRequestError (err_msg , response = response , body = body )
359352
360353        if  response .status_code  ==  401 :
361-             return  _exceptions .AuthenticationError (
362-                 err_msg , response = response , body = body 
363-             )
354+             return  _exceptions .AuthenticationError (err_msg , response = response , body = body )
364355
365356        if  response .status_code  ==  403 :
366-             return  _exceptions .PermissionDeniedError (
367-                 err_msg , response = response , body = body 
368-             )
357+             return  _exceptions .PermissionDeniedError (err_msg , response = response , body = body )
369358
370359        if  response .status_code  ==  404 :
371360            return  _exceptions .NotFoundError (err_msg , response = response , body = body )
@@ -374,17 +363,13 @@ def _make_status_error(
374363            return  _exceptions .ConflictError (err_msg , response = response , body = body )
375364
376365        if  response .status_code  ==  422 :
377-             return  _exceptions .UnprocessableEntityError (
378-                 err_msg , response = response , body = body 
379-             )
366+             return  _exceptions .UnprocessableEntityError (err_msg , response = response , body = body )
380367
381368        if  response .status_code  ==  429 :
382369            return  _exceptions .RateLimitError (err_msg , response = response , body = body )
383370
384371        if  response .status_code  >=  500 :
385-             return  _exceptions .InternalServerError (
386-                 err_msg , response = response , body = body 
387-             )
372+             return  _exceptions .InternalServerError (err_msg , response = response , body = body )
388373        return  APIStatusError (err_msg , response = response , body = body )
389374
390375
@@ -432,6 +417,8 @@ def __init__(
432417        - `access_token` from `DIGITALOCEAN_ACCESS_TOKEN` 
433418        - `model_access_key` from `GRADIENT_MODEL_ACCESS_KEY` 
434419        - `agent_access_key` from `GRADIENT_AGENT_ACCESS_KEY` 
420+         - `agent_endpoint` from `GRADIENT_AGENT_ENDPOINT` 
421+         - `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT` 
435422        """ 
436423        if  access_token  is  None :
437424            if  api_key  is  not None :
@@ -463,8 +450,12 @@ def __init__(
463450                    agent_access_key  =  os .environ .get ("GRADIENT_AGENT_KEY" )
464451        self .agent_access_key  =  agent_access_key 
465452
453+         if  agent_endpoint  is  None :
454+             agent_endpoint  =  os .environ .get ("GRADIENT_AGENT_ENDPOINT" )
466455        self ._agent_endpoint  =  agent_endpoint 
467456
457+         if  inference_endpoint  is  None :
458+             inference_endpoint  =  os .environ .get ("GRADIENT_INFERENCE_ENDPOINT" ) or  "inference.do-ai.run" 
468459        self .inference_endpoint  =  inference_endpoint 
469460
470461        if  base_url  is  None :
@@ -579,9 +570,7 @@ def default_headers(self) -> dict[str, str | Omit]:
579570
580571    @override  
581572    def  _validate_headers (self , headers : Headers , custom_headers : Headers ) ->  None :
582-         if  (
583-             self .access_token  or  self .agent_access_key  or  self .model_access_key 
584-         ) and  headers .get ("Authorization" ):
573+         if  (self .access_token  or  self .agent_access_key  or  self .model_access_key ) and  headers .get ("Authorization" ):
585574            return 
586575        if  isinstance (custom_headers .get ("Authorization" ), Omit ):
587576            return 
@@ -615,14 +604,10 @@ def copy(
615604        Create a new client instance re-using the same options given to the current client with optional overriding. 
616605        """ 
617606        if  default_headers  is  not None  and  set_default_headers  is  not None :
618-             raise  ValueError (
619-                 "The `default_headers` and `set_default_headers` arguments are mutually exclusive" 
620-             )
607+             raise  ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
621608
622609        if  default_query  is  not None  and  set_default_query  is  not None :
623-             raise  ValueError (
624-                 "The `default_query` and `set_default_query` arguments are mutually exclusive" 
625-             )
610+             raise  ValueError ("The `default_query` and `set_default_query` arguments are mutually exclusive" )
626611
627612        headers  =  self ._custom_headers 
628613        if  default_headers  is  not None :
@@ -670,14 +655,10 @@ def _make_status_error(
670655            return  _exceptions .BadRequestError (err_msg , response = response , body = body )
671656
672657        if  response .status_code  ==  401 :
673-             return  _exceptions .AuthenticationError (
674-                 err_msg , response = response , body = body 
675-             )
658+             return  _exceptions .AuthenticationError (err_msg , response = response , body = body )
676659
677660        if  response .status_code  ==  403 :
678-             return  _exceptions .PermissionDeniedError (
679-                 err_msg , response = response , body = body 
680-             )
661+             return  _exceptions .PermissionDeniedError (err_msg , response = response , body = body )
681662
682663        if  response .status_code  ==  404 :
683664            return  _exceptions .NotFoundError (err_msg , response = response , body = body )
@@ -686,17 +667,13 @@ def _make_status_error(
686667            return  _exceptions .ConflictError (err_msg , response = response , body = body )
687668
688669        if  response .status_code  ==  422 :
689-             return  _exceptions .UnprocessableEntityError (
690-                 err_msg , response = response , body = body 
691-             )
670+             return  _exceptions .UnprocessableEntityError (err_msg , response = response , body = body )
692671
693672        if  response .status_code  ==  429 :
694673            return  _exceptions .RateLimitError (err_msg , response = response , body = body )
695674
696675        if  response .status_code  >=  500 :
697-             return  _exceptions .InternalServerError (
698-                 err_msg , response = response , body = body 
699-             )
676+             return  _exceptions .InternalServerError (err_msg , response = response , body = body )
700677        return  APIStatusError (err_msg , response = response , body = body )
701678
702679
@@ -915,9 +892,7 @@ def knowledge_bases(
915892            AsyncKnowledgeBasesResourceWithStreamingResponse ,
916893        )
917894
918-         return  AsyncKnowledgeBasesResourceWithStreamingResponse (
919-             self ._client .knowledge_bases 
920-         )
895+         return  AsyncKnowledgeBasesResourceWithStreamingResponse (self ._client .knowledge_bases )
921896
922897    @cached_property  
923898    def  models (self ) ->  models .AsyncModelsResourceWithStreamingResponse :
0 commit comments