|  | 
| 19 | 19 |     agent_create_params, | 
| 20 | 20 |     agent_update_params, | 
| 21 | 21 |     agent_update_status_params, | 
|  | 22 | +    agent_retrieve_usage_params, | 
| 22 | 23 | ) | 
| 23 | 24 | from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr | 
| 24 | 25 | from ..._utils import maybe_transform, async_maybe_transform | 
|  | 
| 103 | 104 | from ...types.agent_retrieve_response import AgentRetrieveResponse | 
| 104 | 105 | from ...types.api_deployment_visibility import APIDeploymentVisibility | 
| 105 | 106 | from ...types.agent_update_status_response import AgentUpdateStatusResponse | 
|  | 107 | +from ...types.agent_retrieve_usage_response import AgentRetrieveUsageResponse | 
| 106 | 108 | from .evaluation_metrics.evaluation_metrics import ( | 
| 107 | 109 |     EvaluationMetricsResource, | 
| 108 | 110 |     AsyncEvaluationMetricsResource, | 
| @@ -500,6 +502,59 @@ def delete( | 
| 500 | 502 |             cast_to=AgentDeleteResponse, | 
| 501 | 503 |         ) | 
| 502 | 504 | 
 | 
|  | 505 | +    def retrieve_usage( | 
|  | 506 | +        self, | 
|  | 507 | +        uuid: str, | 
|  | 508 | +        *, | 
|  | 509 | +        start: str | NotGiven = NOT_GIVEN, | 
|  | 510 | +        stop: str | NotGiven = NOT_GIVEN, | 
|  | 511 | +        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | 
|  | 512 | +        # The extra values given here take precedence over values defined on the client or passed to this method. | 
|  | 513 | +        extra_headers: Headers | None = None, | 
|  | 514 | +        extra_query: Query | None = None, | 
|  | 515 | +        extra_body: Body | None = None, | 
|  | 516 | +        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | 
|  | 517 | +    ) -> AgentRetrieveUsageResponse: | 
|  | 518 | +        """ | 
|  | 519 | +        To get agent usage, send a GET request to `/v2/gen-ai/agents/{uuid}/usage`. | 
|  | 520 | +        Returns usage metrics for the specified agent within the provided time range. | 
|  | 521 | + | 
|  | 522 | +        Args: | 
|  | 523 | +          start: Return all usage data from this date. | 
|  | 524 | + | 
|  | 525 | +          stop: Return all usage data up to this date, if omitted, will return up to the current | 
|  | 526 | +              date. | 
|  | 527 | + | 
|  | 528 | +          extra_headers: Send extra headers | 
|  | 529 | + | 
|  | 530 | +          extra_query: Add additional query parameters to the request | 
|  | 531 | + | 
|  | 532 | +          extra_body: Add additional JSON properties to the request | 
|  | 533 | + | 
|  | 534 | +          timeout: Override the client-level default timeout for this request, in seconds | 
|  | 535 | +        """ | 
|  | 536 | +        if not uuid: | 
|  | 537 | +            raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") | 
|  | 538 | +        return self._get( | 
|  | 539 | +            f"/v2/gen-ai/agents/{uuid}/usage" | 
|  | 540 | +            if self._client._base_url_overridden | 
|  | 541 | +            else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage", | 
|  | 542 | +            options=make_request_options( | 
|  | 543 | +                extra_headers=extra_headers, | 
|  | 544 | +                extra_query=extra_query, | 
|  | 545 | +                extra_body=extra_body, | 
|  | 546 | +                timeout=timeout, | 
|  | 547 | +                query=maybe_transform( | 
|  | 548 | +                    { | 
|  | 549 | +                        "start": start, | 
|  | 550 | +                        "stop": stop, | 
|  | 551 | +                    }, | 
|  | 552 | +                    agent_retrieve_usage_params.AgentRetrieveUsageParams, | 
|  | 553 | +                ), | 
|  | 554 | +            ), | 
|  | 555 | +            cast_to=AgentRetrieveUsageResponse, | 
|  | 556 | +        ) | 
|  | 557 | + | 
| 503 | 558 |     def update_status( | 
| 504 | 559 |         self, | 
| 505 | 560 |         path_uuid: str, | 
| @@ -943,6 +998,59 @@ async def delete( | 
| 943 | 998 |             cast_to=AgentDeleteResponse, | 
| 944 | 999 |         ) | 
| 945 | 1000 | 
 | 
|  | 1001 | +    async def retrieve_usage( | 
|  | 1002 | +        self, | 
|  | 1003 | +        uuid: str, | 
|  | 1004 | +        *, | 
|  | 1005 | +        start: str | NotGiven = NOT_GIVEN, | 
|  | 1006 | +        stop: str | NotGiven = NOT_GIVEN, | 
|  | 1007 | +        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. | 
|  | 1008 | +        # The extra values given here take precedence over values defined on the client or passed to this method. | 
|  | 1009 | +        extra_headers: Headers | None = None, | 
|  | 1010 | +        extra_query: Query | None = None, | 
|  | 1011 | +        extra_body: Body | None = None, | 
|  | 1012 | +        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, | 
|  | 1013 | +    ) -> AgentRetrieveUsageResponse: | 
|  | 1014 | +        """ | 
|  | 1015 | +        To get agent usage, send a GET request to `/v2/gen-ai/agents/{uuid}/usage`. | 
|  | 1016 | +        Returns usage metrics for the specified agent within the provided time range. | 
|  | 1017 | + | 
|  | 1018 | +        Args: | 
|  | 1019 | +          start: Return all usage data from this date. | 
|  | 1020 | + | 
|  | 1021 | +          stop: Return all usage data up to this date, if omitted, will return up to the current | 
|  | 1022 | +              date. | 
|  | 1023 | + | 
|  | 1024 | +          extra_headers: Send extra headers | 
|  | 1025 | + | 
|  | 1026 | +          extra_query: Add additional query parameters to the request | 
|  | 1027 | + | 
|  | 1028 | +          extra_body: Add additional JSON properties to the request | 
|  | 1029 | + | 
|  | 1030 | +          timeout: Override the client-level default timeout for this request, in seconds | 
|  | 1031 | +        """ | 
|  | 1032 | +        if not uuid: | 
|  | 1033 | +            raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") | 
|  | 1034 | +        return await self._get( | 
|  | 1035 | +            f"/v2/gen-ai/agents/{uuid}/usage" | 
|  | 1036 | +            if self._client._base_url_overridden | 
|  | 1037 | +            else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage", | 
|  | 1038 | +            options=make_request_options( | 
|  | 1039 | +                extra_headers=extra_headers, | 
|  | 1040 | +                extra_query=extra_query, | 
|  | 1041 | +                extra_body=extra_body, | 
|  | 1042 | +                timeout=timeout, | 
|  | 1043 | +                query=await async_maybe_transform( | 
|  | 1044 | +                    { | 
|  | 1045 | +                        "start": start, | 
|  | 1046 | +                        "stop": stop, | 
|  | 1047 | +                    }, | 
|  | 1048 | +                    agent_retrieve_usage_params.AgentRetrieveUsageParams, | 
|  | 1049 | +                ), | 
|  | 1050 | +            ), | 
|  | 1051 | +            cast_to=AgentRetrieveUsageResponse, | 
|  | 1052 | +        ) | 
|  | 1053 | + | 
| 946 | 1054 |     async def update_status( | 
| 947 | 1055 |         self, | 
| 948 | 1056 |         path_uuid: str, | 
| @@ -1020,6 +1128,9 @@ def __init__(self, agents: AgentsResource) -> None: | 
| 1020 | 1128 |         self.delete = to_raw_response_wrapper( | 
| 1021 | 1129 |             agents.delete, | 
| 1022 | 1130 |         ) | 
|  | 1131 | +        self.retrieve_usage = to_raw_response_wrapper( | 
|  | 1132 | +            agents.retrieve_usage, | 
|  | 1133 | +        ) | 
| 1023 | 1134 |         self.update_status = to_raw_response_wrapper( | 
| 1024 | 1135 |             agents.update_status, | 
| 1025 | 1136 |         ) | 
| @@ -1084,6 +1195,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None: | 
| 1084 | 1195 |         self.delete = async_to_raw_response_wrapper( | 
| 1085 | 1196 |             agents.delete, | 
| 1086 | 1197 |         ) | 
|  | 1198 | +        self.retrieve_usage = async_to_raw_response_wrapper( | 
|  | 1199 | +            agents.retrieve_usage, | 
|  | 1200 | +        ) | 
| 1087 | 1201 |         self.update_status = async_to_raw_response_wrapper( | 
| 1088 | 1202 |             agents.update_status, | 
| 1089 | 1203 |         ) | 
| @@ -1148,6 +1262,9 @@ def __init__(self, agents: AgentsResource) -> None: | 
| 1148 | 1262 |         self.delete = to_streamed_response_wrapper( | 
| 1149 | 1263 |             agents.delete, | 
| 1150 | 1264 |         ) | 
|  | 1265 | +        self.retrieve_usage = to_streamed_response_wrapper( | 
|  | 1266 | +            agents.retrieve_usage, | 
|  | 1267 | +        ) | 
| 1151 | 1268 |         self.update_status = to_streamed_response_wrapper( | 
| 1152 | 1269 |             agents.update_status, | 
| 1153 | 1270 |         ) | 
| @@ -1212,6 +1329,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None: | 
| 1212 | 1329 |         self.delete = async_to_streamed_response_wrapper( | 
| 1213 | 1330 |             agents.delete, | 
| 1214 | 1331 |         ) | 
|  | 1332 | +        self.retrieve_usage = async_to_streamed_response_wrapper( | 
|  | 1333 | +            agents.retrieve_usage, | 
|  | 1334 | +        ) | 
| 1215 | 1335 |         self.update_status = async_to_streamed_response_wrapper( | 
| 1216 | 1336 |             agents.update_status, | 
| 1217 | 1337 |         ) | 
|  | 
0 commit comments