Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3086,6 +3086,14 @@ components:
properties:
action:
$ref: "#/components/schemas/AIGuardAction"
extra_tags:
description: |-
The span tags that tracers should add to the `ai_guard` span. Each item contains a
backend-defined key and value, and clients should not assume a fixed set of keys.
Example keys include `ai_guard.evaluate_id` and `ai_guard.evaluation_context`.
items:
$ref: "#/components/schemas/AIGuardExtraTag"
type: array
global_prob:
description: The global threat probability, between `0` and `1`. Included only when computed.
example: 0.005218505859375
Expand Down Expand Up @@ -3212,6 +3220,21 @@ components:
type: string
x-enum-varnames:
- EVALUATIONS
AIGuardExtraTag:
description: A span tag for tracers to add to the `ai_guard` span.
properties:
key:
description: The span tag key.
example: ai_guard.evaluate_id
type: string
value:
description: The span tag value.
example: a76a703c-324f-42ed-af33-9b17d65e28af
type: string
required:
- key
- value
type: object
AIGuardGlobalConfidenceThreshold:
description: The global confidence threshold applied to every threat category.
example: 0.8
Expand Down Expand Up @@ -157058,6 +157081,9 @@ paths:
data:
attributes:
action: ALLOW
extra_tags:
- key: ai_guard.evaluate_id
value: a76a703c-324f-42ed-af33-9b17d65e28af
global_prob: 0.005218505859375
is_blocking_enabled: false
reason: No rule match.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

if TYPE_CHECKING:
from datadog_api_client.v2.model.ai_guard_action import AIGuardAction
from datadog_api_client.v2.model.ai_guard_extra_tag import AIGuardExtraTag
from datadog_api_client.v2.model.ai_guard_redaction_replacement import AIGuardRedactionReplacement
from datadog_api_client.v2.model.ai_guard_scfw_findings import AIGuardScfwFindings
from datadog_api_client.v2.model.ai_guard_sds_finding import AIGuardSdsFinding
Expand All @@ -25,12 +26,14 @@ class AIGuardEvaluateAttributesResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.ai_guard_action import AIGuardAction
from datadog_api_client.v2.model.ai_guard_extra_tag import AIGuardExtraTag
from datadog_api_client.v2.model.ai_guard_redaction_replacement import AIGuardRedactionReplacement
from datadog_api_client.v2.model.ai_guard_scfw_findings import AIGuardScfwFindings
from datadog_api_client.v2.model.ai_guard_sds_finding import AIGuardSdsFinding

return {
"action": (AIGuardAction,),
"extra_tags": ([AIGuardExtraTag],),
"global_prob": (float,),
"is_blocking_enabled": (bool,),
"reason": (str,),
Expand All @@ -43,6 +46,7 @@ def openapi_types(_):

attribute_map = {
"action": "action",
"extra_tags": "extra_tags",
"global_prob": "global_prob",
"is_blocking_enabled": "is_blocking_enabled",
"reason": "reason",
Expand All @@ -60,6 +64,7 @@ def __init__(
reason: str,
tag_probs: Union[Dict[str, float], none_type],
tags: List[str],
extra_tags: Union[List[AIGuardExtraTag], UnsetType] = unset,
global_prob: Union[float, UnsetType] = unset,
redaction_replacements: Union[List[AIGuardRedactionReplacement], UnsetType] = unset,
scfw_findings: Union[AIGuardScfwFindings, UnsetType] = unset,
Expand All @@ -72,6 +77,11 @@ def __init__(
:param action: The recommended action for the evaluated conversation.
:type action: AIGuardAction

:param extra_tags: The span tags that tracers should add to the ``ai_guard`` span. Each item contains a
backend-defined key and value, and clients should not assume a fixed set of keys.
Example keys include ``ai_guard.evaluate_id`` and ``ai_guard.evaluation_context``.
:type extra_tags: [AIGuardExtraTag], optional

:param global_prob: The global threat probability, between ``0`` and ``1``. Included only when computed.
:type global_prob: float, optional

Expand Down Expand Up @@ -110,6 +120,8 @@ def __init__(
:param tags: The threat tags detected in the conversation.
:type tags: [str]
"""
if extra_tags is not unset:
kwargs["extra_tags"] = extra_tags
if global_prob is not unset:
kwargs["global_prob"] = global_prob
if redaction_replacements is not unset:
Expand Down
39 changes: 39 additions & 0 deletions src/datadog_api_client/v2/model/ai_guard_extra_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations


from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


class AIGuardExtraTag(ModelNormal):
@cached_property
def openapi_types(_):
return {
"key": (str,),
"value": (str,),
}

attribute_map = {
"key": "key",
"value": "value",
}

def __init__(self_, key: str, value: str, **kwargs):
"""
A span tag for tracers to add to the ``ai_guard`` span.

:param key: The span tag key.
:type key: str

:param value: The span tag value.
:type value: str
"""
super().__init__(kwargs)

self_.key = key
self_.value = value
2 changes: 2 additions & 0 deletions src/datadog_api_client/v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datadog_api_client.v2.model.ai_guard_evaluate_request_data_attributes import AIGuardEvaluateRequestDataAttributes
from datadog_api_client.v2.model.ai_guard_evaluate_response import AIGuardEvaluateResponse
from datadog_api_client.v2.model.ai_guard_evaluation_type import AIGuardEvaluationType
from datadog_api_client.v2.model.ai_guard_extra_tag import AIGuardExtraTag
from datadog_api_client.v2.model.ai_guard_image_url import AIGuardImageURL
from datadog_api_client.v2.model.ai_guard_message import AIGuardMessage
from datadog_api_client.v2.model.ai_guard_message_content import AIGuardMessageContent
Expand Down Expand Up @@ -13880,6 +13881,7 @@
"AIGuardEvaluateRequestDataAttributes",
"AIGuardEvaluateResponse",
"AIGuardEvaluationType",
"AIGuardExtraTag",
"AIGuardImageURL",
"AIGuardMessage",
"AIGuardMessageContent",
Expand Down
Loading