Skip to content

Commit 2808b92

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 5036b50 of spec repo
1 parent b0dfc8c commit 2808b92

21 files changed

Lines changed: 1360 additions & 15 deletions

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 419 additions & 5 deletions
Large diffs are not rendered by default.

‎examples/v2/ai-gateway/CreateAiGatewayRateLimit.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from datadog_api_client.v2.model.ai_gateway_rate_limit_create_data import AiGatewayRateLimitCreateData
1010
from datadog_api_client.v2.model.ai_gateway_rate_limit_create_request import AiGatewayRateLimitCreateRequest
1111
from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode
12+
from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry
1213
from datadog_api_client.v2.model.ai_gateway_rate_limit_type import AiGatewayRateLimitType
1314
from uuid import UUID
1415

@@ -20,6 +21,15 @@
2021
name="Default rate limit",
2122
output_tokens_per_minute=None,
2223
requests_per_minute=600,
24+
selector=[
25+
AiGatewayRateLimitSelectorEntry(
26+
dim="user_id",
27+
per_value=True,
28+
values=[
29+
"11111111-1111-1111-1111-111111111111",
30+
],
31+
),
32+
],
2333
team_id=UUID("00000000-0000-4000-8000-000000000002"),
2434
user_id=UUID("00000000-0000-4000-8000-000000000001"),
2535
),
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Get an AI Gateway rate limit counter summary returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.ai_gateway_api import AIGatewayApi
8+
from uuid import UUID
9+
10+
configuration = Configuration()
11+
configuration.access_token = environ["DD_BEARER_TOKEN"]
12+
configuration.unstable_operations["get_ai_gateway_rate_limit_instances_summary"] = True
13+
with ApiClient(configuration) as api_client:
14+
api_instance = AIGatewayApi(api_client)
15+
response = api_instance.get_ai_gateway_rate_limit_instances_summary(
16+
id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
17+
)
18+
19+
print(response)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
List AI Gateway rate limit counters returns "OK" response
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.ai_gateway_api import AIGatewayApi
8+
from uuid import UUID
9+
10+
configuration = Configuration()
11+
configuration.access_token = environ["DD_BEARER_TOKEN"]
12+
configuration.unstable_operations["list_ai_gateway_rate_limit_instances"] = True
13+
with ApiClient(configuration) as api_client:
14+
api_instance = AIGatewayApi(api_client)
15+
response = api_instance.list_ai_gateway_rate_limit_instances(
16+
id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
17+
)
18+
19+
print(response)

‎src/datadog_api_client/configuration.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def __init__(
381381
"v2.get_ai_gateway_policy": False,
382382
"v2.get_ai_gateway_provider": False,
383383
"v2.get_ai_gateway_rate_limit": False,
384+
"v2.get_ai_gateway_rate_limit_instances_summary": False,
384385
"v2.get_ai_gateway_rate_limit_usage": False,
385386
"v2.get_ai_gateway_routing_rule": False,
386387
"v2.list_ai_gateway_budget_instance_dimensions": False,
@@ -392,6 +393,7 @@ def __init__(
392393
"v2.list_ai_gateway_policies": False,
393394
"v2.list_ai_gateway_provider_models": False,
394395
"v2.list_ai_gateway_providers": False,
396+
"v2.list_ai_gateway_rate_limit_instances": False,
395397
"v2.list_ai_gateway_rate_limits": False,
396398
"v2.list_ai_gateway_routing_rules": False,
397399
"v2.override_ai_gateway_budget_instance_capacity": False,

‎src/datadog_api_client/v2/api/ai_gateway_api.py‎

Lines changed: 155 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@
6767
from datadog_api_client.v2.model.ai_gateway_rate_limit_create_request import AiGatewayRateLimitCreateRequest
6868
from datadog_api_client.v2.model.ai_gateway_rate_limit_usage_list_response import AiGatewayRateLimitUsageListResponse
6969
from datadog_api_client.v2.model.ai_gateway_rate_limit_update_request import AiGatewayRateLimitUpdateRequest
70+
from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_list_response import (
71+
AiGatewayRateLimitInstanceListResponse,
72+
)
73+
from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_sort import AiGatewayRateLimitInstanceSort
74+
from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_response import (
75+
AiGatewayRateLimitInstancesSummaryResponse,
76+
)
7077
from datadog_api_client.v2.model.ai_gateway_routing_rule_list_response import AiGatewayRoutingRuleListResponse
7178
from datadog_api_client.v2.model.ai_gateway_routing_rule_response import AiGatewayRoutingRuleResponse
7279
from datadog_api_client.v2.model.ai_gateway_routing_rule_create_request import AiGatewayRoutingRuleCreateRequest
@@ -778,6 +785,35 @@ def __init__(self, api_client=None):
778785
api_client=api_client,
779786
)
780787

788+
self._get_ai_gateway_rate_limit_instances_summary_endpoint = _Endpoint(
789+
settings={
790+
"response_type": (AiGatewayRateLimitInstancesSummaryResponse,),
791+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
792+
"endpoint_path": "/api/v2/rate-limits/{id}/instances/summary",
793+
"operation_id": "get_ai_gateway_rate_limit_instances_summary",
794+
"http_method": "GET",
795+
"version": "v2",
796+
},
797+
params_map={
798+
"id": {
799+
"required": True,
800+
"openapi_types": (UUID,),
801+
"attribute": "id",
802+
"location": "path",
803+
},
804+
"split_dim": {
805+
"openapi_types": ([str],),
806+
"attribute": "split_dim",
807+
"location": "query",
808+
"collection_format": "multi",
809+
},
810+
},
811+
headers_map={
812+
"accept": ["application/json"],
813+
},
814+
api_client=api_client,
815+
)
816+
781817
self._get_ai_gateway_rate_limit_usage_endpoint = _Endpoint(
782818
settings={
783819
"response_type": (AiGatewayRateLimitUsageListResponse,),
@@ -1100,6 +1136,57 @@ def __init__(self, api_client=None):
11001136
api_client=api_client,
11011137
)
11021138

1139+
self._list_ai_gateway_rate_limit_instances_endpoint = _Endpoint(
1140+
settings={
1141+
"response_type": (AiGatewayRateLimitInstanceListResponse,),
1142+
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
1143+
"endpoint_path": "/api/v2/rate-limits/{id}/instances",
1144+
"operation_id": "list_ai_gateway_rate_limit_instances",
1145+
"http_method": "GET",
1146+
"version": "v2",
1147+
},
1148+
params_map={
1149+
"id": {
1150+
"required": True,
1151+
"openapi_types": (UUID,),
1152+
"attribute": "id",
1153+
"location": "path",
1154+
},
1155+
"split_dim": {
1156+
"openapi_types": ([str],),
1157+
"attribute": "split_dim",
1158+
"location": "query",
1159+
"collection_format": "multi",
1160+
},
1161+
"sort": {
1162+
"openapi_types": (AiGatewayRateLimitInstanceSort,),
1163+
"attribute": "sort",
1164+
"location": "query",
1165+
},
1166+
"limit": {
1167+
"validation": {
1168+
"inclusive_maximum": 500,
1169+
"inclusive_minimum": 1,
1170+
},
1171+
"openapi_types": (int,),
1172+
"attribute": "limit",
1173+
"location": "query",
1174+
},
1175+
"offset": {
1176+
"validation": {
1177+
"inclusive_minimum": 0,
1178+
},
1179+
"openapi_types": (int,),
1180+
"attribute": "offset",
1181+
"location": "query",
1182+
},
1183+
},
1184+
headers_map={
1185+
"accept": ["application/json"],
1186+
},
1187+
api_client=api_client,
1188+
)
1189+
11031190
self._list_ai_gateway_rate_limits_endpoint = _Endpoint(
11041191
settings={
11051192
"response_type": (AiGatewayRateLimitListResponse,),
@@ -1590,7 +1677,7 @@ def create_ai_gateway_rate_limit(
15901677
) -> AiGatewayRateLimitResponse:
15911678
"""Create an AI Gateway rate limit.
15921679
1593-
Create a rate limit. All requests matching its scope share one allowance, and every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, and tags, or when the organization already has the maximum number of rate limits.
1680+
Create a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits.
15941681
15951682
:type body: AiGatewayRateLimitCreateRequest
15961683
:rtype: AiGatewayRateLimitResponse
@@ -1990,6 +2077,30 @@ def get_ai_gateway_rate_limit(
19902077

19912078
return self._get_ai_gateway_rate_limit_endpoint.call_with_http_info(**kwargs)
19922079

2080+
def get_ai_gateway_rate_limit_instances_summary(
2081+
self,
2082+
id: UUID,
2083+
*,
2084+
split_dim: Union[List[str], UnsetType] = unset,
2085+
) -> AiGatewayRateLimitInstancesSummaryResponse:
2086+
"""Get an AI Gateway rate limit counter summary.
2087+
2088+
Aggregate a template rate limit's counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Use split_dim to aggregate only counters that match every given dimension value.
2089+
2090+
:param id: Rate limit UUID.
2091+
:type id: UUID
2092+
:param split_dim: Keep only counters whose split dimension equals a value, written as ``<dim>=<value>`` , such as ``split_dim=user_id=<uuid>&split_dim=model=gpt-4o``. Dimensions use the ``split_dims`` names ``user_id`` , ``team_id`` , ``model`` , ``provider`` , and ``tag:<key>``. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit.
2093+
:type split_dim: [str], optional
2094+
:rtype: AiGatewayRateLimitInstancesSummaryResponse
2095+
"""
2096+
kwargs: Dict[str, Any] = {}
2097+
kwargs["id"] = id
2098+
2099+
if split_dim is not unset:
2100+
kwargs["split_dim"] = split_dim
2101+
2102+
return self._get_ai_gateway_rate_limit_instances_summary_endpoint.call_with_http_info(**kwargs)
2103+
19932104
def get_ai_gateway_rate_limit_usage(
19942105
self,
19952106
) -> AiGatewayRateLimitUsageListResponse:
@@ -2252,6 +2363,48 @@ def list_ai_gateway_providers(
22522363
kwargs: Dict[str, Any] = {}
22532364
return self._list_ai_gateway_providers_endpoint.call_with_http_info(**kwargs)
22542365

2366+
def list_ai_gateway_rate_limit_instances(
2367+
self,
2368+
id: UUID,
2369+
*,
2370+
split_dim: Union[List[str], UnsetType] = unset,
2371+
sort: Union[AiGatewayRateLimitInstanceSort, UnsetType] = unset,
2372+
limit: Union[int, UnsetType] = unset,
2373+
offset: Union[int, UnsetType] = unset,
2374+
) -> AiGatewayRateLimitInstanceListResponse:
2375+
"""List AI Gateway rate limit counters.
2376+
2377+
List the counters of a template rate limit, one per matched user, Team, or value, with their live usage. Counters appear within a few minutes of their first request and are dropped after 30 days without one. Usage is read for counters seen in the last 20 minutes, at most 200 per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list.
2378+
2379+
:param id: Rate limit UUID.
2380+
:type id: UUID
2381+
:param split_dim: Keep only counters whose split dimension equals a value, written as ``<dim>=<value>`` , such as ``split_dim=user_id=<uuid>&split_dim=model=gpt-4o``. Dimensions use the ``split_dims`` names ``user_id`` , ``team_id`` , ``model`` , ``provider`` , and ``tag:<key>``. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit.
2382+
:type split_dim: [str], optional
2383+
:param sort: Sort order for rate limit counters.
2384+
:type sort: AiGatewayRateLimitInstanceSort, optional
2385+
:param limit: Maximum number of rate limit counters to return.
2386+
:type limit: int, optional
2387+
:param offset: Number of rate limit counters to skip.
2388+
:type offset: int, optional
2389+
:rtype: AiGatewayRateLimitInstanceListResponse
2390+
"""
2391+
kwargs: Dict[str, Any] = {}
2392+
kwargs["id"] = id
2393+
2394+
if split_dim is not unset:
2395+
kwargs["split_dim"] = split_dim
2396+
2397+
if sort is not unset:
2398+
kwargs["sort"] = sort
2399+
2400+
if limit is not unset:
2401+
kwargs["limit"] = limit
2402+
2403+
if offset is not unset:
2404+
kwargs["offset"] = offset
2405+
2406+
return self._list_ai_gateway_rate_limit_instances_endpoint.call_with_http_info(**kwargs)
2407+
22552408
def list_ai_gateway_rate_limits(
22562409
self,
22572410
) -> AiGatewayRateLimitListResponse:
@@ -2478,7 +2631,7 @@ def update_ai_gateway_rate_limit(
24782631
) -> AiGatewayRateLimitResponse:
24792632
"""Update an AI Gateway rate limit.
24802633
2481-
Update a rate limit. Only the attributes sent are changed. Scope stays editable, and changes never reset current usage. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule.
2634+
Update a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule.
24822635
24832636
:param id: Rate limit UUID.
24842637
:type id: UUID

‎src/datadog_api_client/v2/model/ai_gateway_rate_limit_attributes.py‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import Dict, Union, TYPE_CHECKING
6+
from typing import Dict, List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
@@ -18,6 +18,7 @@
1818

1919
if TYPE_CHECKING:
2020
from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode
21+
from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry
2122

2223

2324
class AiGatewayRateLimitAttributes(ModelNormal):
@@ -39,6 +40,7 @@ class AiGatewayRateLimitAttributes(ModelNormal):
3940
@cached_property
4041
def openapi_types(_):
4142
from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode
43+
from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry
4244

4345
return {
4446
"created_at": (datetime,),
@@ -52,6 +54,7 @@ def openapi_types(_):
5254
"requests_per_minute": (int, none_type),
5355
"revision": (int,),
5456
"scope_restricted": (bool,),
57+
"selector": ([AiGatewayRateLimitSelectorEntry],),
5558
"tags": ({str: (str,)},),
5659
"team_id": (UUID, none_type),
5760
"updated_at": (datetime,),
@@ -71,6 +74,7 @@ def openapi_types(_):
7174
"requests_per_minute": "requests_per_minute",
7275
"revision": "revision",
7376
"scope_restricted": "scope_restricted",
77+
"selector": "selector",
7478
"tags": "tags",
7579
"team_id": "team_id",
7680
"updated_at": "updated_at",
@@ -94,6 +98,7 @@ def __init__(
9498
monitor_id: Union[int, none_type, UnsetType] = unset,
9599
output_tokens_per_minute: Union[int, none_type, UnsetType] = unset,
96100
requests_per_minute: Union[int, none_type, UnsetType] = unset,
101+
selector: Union[List[AiGatewayRateLimitSelectorEntry], none_type, UnsetType] = unset,
97102
team_id: Union[UUID, none_type, UnsetType] = unset,
98103
user_id: Union[UUID, none_type, UnsetType] = unset,
99104
**kwargs,
@@ -110,7 +115,7 @@ def __init__(
110115
:param enabled: Whether this rate limit is active.
111116
:type enabled: bool
112117
113-
:param input_tokens_per_minute: Maximum input tokens per rolling minute shared by all matching traffic. Null when this rule does not limit input tokens.
118+
:param input_tokens_per_minute: Maximum input tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit input tokens.
114119
:type input_tokens_per_minute: int, none_type, optional
115120
116121
:param mode: Action taken when request rate exceeds the limit.
@@ -122,10 +127,10 @@ def __init__(
122127
:param name: Rate limit name.
123128
:type name: str
124129
125-
:param output_tokens_per_minute: Maximum output tokens per rolling minute shared by all matching traffic. Null when this rule does not limit output tokens.
130+
:param output_tokens_per_minute: Maximum output tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit output tokens.
126131
:type output_tokens_per_minute: int, none_type, optional
127132
128-
:param requests_per_minute: Maximum requests per rolling minute shared by all matching traffic. Null when this rule does not limit requests.
133+
:param requests_per_minute: Maximum requests per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit requests.
129134
:type requests_per_minute: int, none_type, optional
130135
131136
:param revision: Increases on every change to the definition.
@@ -134,6 +139,9 @@ def __init__(
134139
:param scope_restricted: Whether provider or model scope metadata was withheld. Omit unchanged scope fields on an unrelated update to preserve their saved values.
135140
:type scope_restricted: bool
136141
142+
:param selector: Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance.
143+
:type selector: [AiGatewayRateLimitSelectorEntry], none_type, optional
144+
137145
:param tags: Optional scope tags, such as provider, model, ml_app, or custom dimensions. A request matches when it has all of these tags.
138146
:type tags: {str: (str,)}
139147
@@ -157,6 +165,8 @@ def __init__(
157165
kwargs["output_tokens_per_minute"] = output_tokens_per_minute
158166
if requests_per_minute is not unset:
159167
kwargs["requests_per_minute"] = requests_per_minute
168+
if selector is not unset:
169+
kwargs["selector"] = selector
160170
if team_id is not unset:
161171
kwargs["team_id"] = team_id
162172
if user_id is not unset:

0 commit comments

Comments
 (0)