@@ -113,6 +113,7 @@ 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`
116117 """
117118 if access_token is None :
118119 if api_key is not None :
@@ -267,9 +268,7 @@ def default_headers(self) -> dict[str, str | Omit]:
267268
268269 @override
269270 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" ):
271+ if (self .access_token or self .agent_access_key or self .model_access_key ) and headers .get ("Authorization" ):
273272 return
274273 if isinstance (custom_headers .get ("Authorization" ), Omit ):
275274 return
@@ -303,14 +302,10 @@ def copy(
303302 Create a new client instance re-using the same options given to the current client with optional overriding.
304303 """
305304 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- )
305+ raise ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
309306
310307 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- )
308+ raise ValueError ("The `default_query` and `set_default_query` arguments are mutually exclusive" )
314309
315310 headers = self ._custom_headers
316311 if default_headers is not None :
@@ -358,14 +353,10 @@ def _make_status_error(
358353 return _exceptions .BadRequestError (err_msg , response = response , body = body )
359354
360355 if response .status_code == 401 :
361- return _exceptions .AuthenticationError (
362- err_msg , response = response , body = body
363- )
356+ return _exceptions .AuthenticationError (err_msg , response = response , body = body )
364357
365358 if response .status_code == 403 :
366- return _exceptions .PermissionDeniedError (
367- err_msg , response = response , body = body
368- )
359+ return _exceptions .PermissionDeniedError (err_msg , response = response , body = body )
369360
370361 if response .status_code == 404 :
371362 return _exceptions .NotFoundError (err_msg , response = response , body = body )
@@ -374,17 +365,13 @@ def _make_status_error(
374365 return _exceptions .ConflictError (err_msg , response = response , body = body )
375366
376367 if response .status_code == 422 :
377- return _exceptions .UnprocessableEntityError (
378- err_msg , response = response , body = body
379- )
368+ return _exceptions .UnprocessableEntityError (err_msg , response = response , body = body )
380369
381370 if response .status_code == 429 :
382371 return _exceptions .RateLimitError (err_msg , response = response , body = body )
383372
384373 if response .status_code >= 500 :
385- return _exceptions .InternalServerError (
386- err_msg , response = response , body = body
387- )
374+ return _exceptions .InternalServerError (err_msg , response = response , body = body )
388375 return APIStatusError (err_msg , response = response , body = body )
389376
390377
@@ -432,6 +419,7 @@ def __init__(
432419 - `access_token` from `DIGITALOCEAN_ACCESS_TOKEN`
433420 - `model_access_key` from `GRADIENT_MODEL_ACCESS_KEY`
434421 - `agent_access_key` from `GRADIENT_AGENT_ACCESS_KEY`
422+ - `agent_endpoint` from `GRADIENT_AGENT_ENDPOINT`
435423 """
436424 if access_token is None :
437425 if api_key is not None :
@@ -463,6 +451,8 @@ def __init__(
463451 agent_access_key = os .environ .get ("GRADIENT_AGENT_KEY" )
464452 self .agent_access_key = agent_access_key
465453
454+ if agent_endpoint is None :
455+ agent_endpoint = os .environ .get ("GRADIENT_AGENT_ENDPOINT" )
466456 self ._agent_endpoint = agent_endpoint
467457
468458 self .inference_endpoint = inference_endpoint
@@ -579,9 +569,7 @@ def default_headers(self) -> dict[str, str | Omit]:
579569
580570 @override
581571 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" ):
572+ if (self .access_token or self .agent_access_key or self .model_access_key ) and headers .get ("Authorization" ):
585573 return
586574 if isinstance (custom_headers .get ("Authorization" ), Omit ):
587575 return
@@ -615,14 +603,10 @@ def copy(
615603 Create a new client instance re-using the same options given to the current client with optional overriding.
616604 """
617605 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- )
606+ raise ValueError ("The `default_headers` and `set_default_headers` arguments are mutually exclusive" )
621607
622608 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- )
609+ raise ValueError ("The `default_query` and `set_default_query` arguments are mutually exclusive" )
626610
627611 headers = self ._custom_headers
628612 if default_headers is not None :
@@ -670,14 +654,10 @@ def _make_status_error(
670654 return _exceptions .BadRequestError (err_msg , response = response , body = body )
671655
672656 if response .status_code == 401 :
673- return _exceptions .AuthenticationError (
674- err_msg , response = response , body = body
675- )
657+ return _exceptions .AuthenticationError (err_msg , response = response , body = body )
676658
677659 if response .status_code == 403 :
678- return _exceptions .PermissionDeniedError (
679- err_msg , response = response , body = body
680- )
660+ return _exceptions .PermissionDeniedError (err_msg , response = response , body = body )
681661
682662 if response .status_code == 404 :
683663 return _exceptions .NotFoundError (err_msg , response = response , body = body )
@@ -686,17 +666,13 @@ def _make_status_error(
686666 return _exceptions .ConflictError (err_msg , response = response , body = body )
687667
688668 if response .status_code == 422 :
689- return _exceptions .UnprocessableEntityError (
690- err_msg , response = response , body = body
691- )
669+ return _exceptions .UnprocessableEntityError (err_msg , response = response , body = body )
692670
693671 if response .status_code == 429 :
694672 return _exceptions .RateLimitError (err_msg , response = response , body = body )
695673
696674 if response .status_code >= 500 :
697- return _exceptions .InternalServerError (
698- err_msg , response = response , body = body
699- )
675+ return _exceptions .InternalServerError (err_msg , response = response , body = body )
700676 return APIStatusError (err_msg , response = response , body = body )
701677
702678
@@ -915,9 +891,7 @@ def knowledge_bases(
915891 AsyncKnowledgeBasesResourceWithStreamingResponse ,
916892 )
917893
918- return AsyncKnowledgeBasesResourceWithStreamingResponse (
919- self ._client .knowledge_bases
920- )
894+ return AsyncKnowledgeBasesResourceWithStreamingResponse (self ._client .knowledge_bases )
921895
922896 @cached_property
923897 def models (self ) -> models .AsyncModelsResourceWithStreamingResponse :
0 commit comments