diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9b5a962d17..d83d223ea1 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -55301,6 +55301,10 @@ components: items: $ref: "#/components/schemas/LLMObsAnnotationItem" type: array + can_annotate: + description: Whether the current caller can annotate this interaction. + example: true + type: boolean content_id: description: Upstream entity identifier (trace ID, session ID, or deterministic display_block ID). example: "trace-abc-123" @@ -55339,6 +55343,7 @@ components: - modified_at - queue_id - queue_name + - can_annotate - annotations type: object LLMObsAnnotatedInteractionItem: @@ -55403,6 +55408,7 @@ components: description: List of interactions with their annotations. example: - annotations: [] + can_annotate: true content_id: trace-abc-123 id: "interaction-456" type: trace @@ -55461,6 +55467,8 @@ components: description: ID of the annotation that failed, if applicable. example: "00000000-0000-0000-0000-000000000000" type: string + code: + $ref: "#/components/schemas/LLMObsAnnotationErrorCode" error: description: Error message. example: "interaction not found" @@ -55473,6 +55481,14 @@ components: - interaction_id - error type: object + LLMObsAnnotationErrorCode: + description: Stable error code. `permission_denied` indicates the item was rejected by queue access rules. + enum: + - permission_denied + example: permission_denied + type: string + x-enum-varnames: + - PERMISSION_DENIED LLMObsAnnotationItem: description: A single annotation on an interaction. properties: @@ -55651,6 +55667,21 @@ components: description: Identifier of the project this queue belongs to. example: "00000000-0000-0000-0000-000000000002" type: string + restrict_to_assignees: + description: Whether annotation access is restricted to assigned users. + example: false + type: boolean + restrict_to_reviewers: + description: Whether annotation access is restricted to queue reviewers. + example: true + type: boolean + reviewer_emails: + description: Email addresses of reviewers who can access the annotation queue. + example: + - "reviewer@example.com" + items: + type: string + type: array required: - name - project_id @@ -55660,6 +55691,11 @@ components: properties: annotation_schema: $ref: "#/components/schemas/LLMObsAnnotationSchema" + can_manage_access: + description: Whether the current caller can manage access for the annotation queue. + example: true + readOnly: true + type: boolean created_at: description: Timestamp when the queue was created. example: "2024-01-15T10:30:00Z" @@ -55694,6 +55730,23 @@ components: description: Identifier of the project this queue belongs to. example: "00000000-0000-0000-0000-000000000002" type: string + restrict_to_assignees: + description: Whether annotation access is restricted to assigned users. + example: false + type: boolean + restrict_to_reviewers: + description: Whether annotation access is restricted to queue reviewers. + example: true + type: boolean + reviewer_emails: + description: |- + Email addresses of reviewers for the annotation queue. Returned only + when the caller can manage queue access. + example: + - "reviewer@example.com" + items: + type: string + type: array required: - name - project_id @@ -55703,6 +55756,9 @@ components: - modified_by - modified_at - owned_by + - restrict_to_reviewers + - restrict_to_assignees + - can_manage_access type: object LLMObsAnnotationQueueDataRequest: description: Data object for creating an Agent Observability annotation queue. @@ -55919,6 +55975,21 @@ components: description: Updated name of the annotation queue. example: "Updated queue name" type: string + restrict_to_assignees: + description: Whether annotation access is restricted to assigned users. + example: false + type: boolean + restrict_to_reviewers: + description: Whether annotation access is restricted to queue reviewers. + example: true + type: boolean + reviewer_emails: + description: Updated email addresses of reviewers who can access the annotation queue. + example: + - "reviewer@example.com" + items: + type: string + type: array type: object LLMObsAnnotationQueueUpdateDataRequest: description: Data object for updating an Agent Observability annotation queue. @@ -57803,6 +57874,10 @@ components: items: $ref: "#/components/schemas/LLMObsAnnotationItem" type: array + can_annotate: + description: Whether the current caller can annotate this interaction. + example: true + type: boolean content_id: description: Server-generated deterministic identifier derived from the block list. example: "9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2" @@ -57819,6 +57894,7 @@ components: - id - type - content_id + - can_annotate - annotations - display_block type: object @@ -61809,6 +61885,10 @@ components: items: $ref: "#/components/schemas/LLMObsAnnotationItem" type: array + can_annotate: + description: Whether the current caller can annotate this interaction. + example: true + type: boolean content_id: description: Upstream entity identifier supplied by the caller. example: "trace-abc-123" @@ -61835,6 +61915,7 @@ components: - content_id - created_at - modified_at + - can_annotate - annotations type: object LLMObsTraceInteractionItem: @@ -161960,6 +162041,7 @@ paths: value: good modified_at: "0001-01-01T00:00:00Z" modified_by: "00000000-0000-0000-0000-000000000002" + can_annotate: true content_id: trace-abc-123 created_at: "2025-06-01T12:00:00Z" id: interaction-456 @@ -162037,6 +162119,7 @@ paths: value: data: - attributes: + can_manage_access: true created_at: "2024-01-15T10:30:00Z" created_by: 00000000-0000-0000-0000-000000000002 description: Queue for annotating customer support traces @@ -162045,6 +162128,10 @@ paths: name: My annotation queue owned_by: 00000000-0000-0000-0000-000000000002 project_id: 00000000-0000-0000-0000-000000000002 + restrict_to_assignees: false + restrict_to_reviewers: true + reviewer_emails: + - reviewer@example.com id: 00000000-0000-0000-0000-000000000001 type: queues schema: @@ -162083,6 +162170,7 @@ paths: description: |- Create an annotation queue. The `name` and `project_id` fields are required. An optional `annotation_schema` can be provided to define the labels for the queue. + Optional access-control fields can restrict annotation access to reviewers or assignees. Fields such as `created_by`, `owned_by`, `created_at`, `modified_by`, and `modified_at` are inferred by the backend. operationId: CreateLLMObsAnnotationQueue @@ -162098,6 +162186,19 @@ paths: name: My annotation queue project_id: 00000000-0000-0000-0000-000000000002 type: queues + with_access_controls: + summary: Create queue with access controls + value: + data: + attributes: + description: Queue for annotating customer support traces + name: Restricted annotation queue + project_id: 00000000-0000-0000-0000-000000000002 + restrict_to_assignees: false + restrict_to_reviewers: true + reviewer_emails: + - reviewer@example.com + type: queues with_schema: summary: Create queue with annotation schema value: @@ -162133,6 +162234,7 @@ paths: value: data: attributes: + can_manage_access: true created_at: "2024-01-15T10:30:00Z" created_by: 00000000-0000-0000-0000-000000000002 description: Queue for annotating customer support traces @@ -162141,6 +162243,10 @@ paths: name: My annotation queue owned_by: 00000000-0000-0000-0000-000000000002 project_id: 00000000-0000-0000-0000-000000000002 + restrict_to_assignees: false + restrict_to_reviewers: true + reviewer_emails: + - reviewer@example.com id: 00000000-0000-0000-0000-000000000001 type: queues schema: @@ -162215,7 +162321,9 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: description: |- - Partially update an annotation queue. The `name`, `description`, and `annotation_schema` fields can be updated. + Partially update an annotation queue. The `name`, `description`, + `annotation_schema`, `reviewer_emails`, `restrict_to_reviewers`, and + `restrict_to_assignees` fields can be updated. operationId: UpdateLLMObsAnnotationQueue parameters: - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" @@ -162229,6 +162337,10 @@ paths: attributes: description: Updated description name: Updated queue name + restrict_to_assignees: false + restrict_to_reviewers: true + reviewer_emails: + - reviewer@example.com type: queues schema: $ref: "#/components/schemas/LLMObsAnnotationQueueUpdateRequest" @@ -162243,6 +162355,7 @@ paths: value: data: attributes: + can_manage_access: true created_at: "2024-01-15T10:30:00Z" created_by: 00000000-0000-0000-0000-000000000002 description: Queue for annotating customer support traces @@ -162251,6 +162364,10 @@ paths: name: My annotation queue owned_by: 00000000-0000-0000-0000-000000000002 project_id: 00000000-0000-0000-0000-000000000002 + restrict_to_assignees: false + restrict_to_reviewers: true + reviewer_emails: + - reviewer@example.com id: 00000000-0000-0000-0000-000000000001 type: queues schema: @@ -162308,6 +162425,7 @@ paths: attributes: annotated_interactions: - annotations: [] + can_annotate: true content_id: trace-abc-123 id: interaction-456 type: trace @@ -162358,6 +162476,7 @@ paths: by `interaction_id` and the requesting user's identity. Results and errors in the response are linked to request items by `interaction_id`. Errors for individual items are returned in the `errors` field without blocking the rest of the batch. + Requests where every item is denied by queue access rules return `403`. operationId: UpsertLLMObsAnnotations parameters: - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" @@ -162402,9 +162521,31 @@ paths: modified_by: 00000000-0000-0000-0000-000000000002 id: 00000000-0000-0000-0000-000000000001 type: annotations + mixed_access_denied: + summary: Some annotations were denied by queue access rules + value: + data: + attributes: + annotations: + - created_at: "2024-01-15T10:30:00Z" + created_by: 00000000-0000-0000-0000-000000000002 + id: 00000000-0000-0000-0000-000000000000 + interaction_id: 00000000-0000-0000-0000-000000000001 + label_values: + - label_schema_id: abc-123 + value: good + modified_at: "2024-01-15T10:30:00Z" + modified_by: 00000000-0000-0000-0000-000000000002 + errors: + - code: permission_denied + error: permission denied + interaction_id: 00000000-0000-0000-0000-000000000003 + id: 00000000-0000-0000-0000-000000000001 + type: annotations schema: $ref: "#/components/schemas/LLMObsAnnotationsResponse" - description: OK — annotations created or updated. Per-item errors are listed in `errors`. + description: >- + OK — annotations created or updated. For mixed batches, denied items and other per-item errors are listed in `errors`. "400": content: application/json: @@ -162422,7 +162563,7 @@ paths: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden + description: Forbidden — all request items were denied by queue access rules "404": content: application/json: diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 56b4374ab4..d06d4f4114 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -23643,6 +23643,13 @@ datadog\_api\_client.v2.model.llm\_obs\_annotation\_error module :members: :show-inheritance: +datadog\_api\_client.v2.model.llm\_obs\_annotation\_error\_code module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_annotation_error_code + :members: + :show-inheritance: + datadog\_api\_client.v2.model.llm\_obs\_annotation\_item module --------------------------------------------------------------- diff --git a/examples/v2/agent-observability/CreateLLMObsAnnotationQueue.py b/examples/v2/agent-observability/CreateLLMObsAnnotationQueue.py index 4e56eb15ea..aab3f67fec 100644 --- a/examples/v2/agent-observability/CreateLLMObsAnnotationQueue.py +++ b/examples/v2/agent-observability/CreateLLMObsAnnotationQueue.py @@ -42,6 +42,11 @@ description="Queue for annotating customer support traces", name="My annotation queue", project_id="00000000-0000-0000-0000-000000000002", + restrict_to_assignees=False, + restrict_to_reviewers=True, + reviewer_emails=[ + "reviewer@example.com", + ], ), type=LLMObsAnnotationQueueType.QUEUES, ), diff --git a/examples/v2/agent-observability/UpdateLLMObsAnnotationQueue.py b/examples/v2/agent-observability/UpdateLLMObsAnnotationQueue.py index 6bcb0a107b..c9966dbba0 100644 --- a/examples/v2/agent-observability/UpdateLLMObsAnnotationQueue.py +++ b/examples/v2/agent-observability/UpdateLLMObsAnnotationQueue.py @@ -43,6 +43,11 @@ ), description="Updated description", name="Updated queue name", + restrict_to_assignees=False, + restrict_to_reviewers=True, + reviewer_emails=[ + "reviewer@example.com", + ], ), type=LLMObsAnnotationQueueType.QUEUES, ), diff --git a/examples/v2/agent-observability/UpsertLLMObsAnnotations.py b/examples/v2/agent-observability/UpsertLLMObsAnnotations.py index ec7fd8feb4..5e80c17acb 100644 --- a/examples/v2/agent-observability/UpsertLLMObsAnnotations.py +++ b/examples/v2/agent-observability/UpsertLLMObsAnnotations.py @@ -1,6 +1,6 @@ """ -Create or update annotations returns "OK — annotations created or updated. Per-item errors are listed in `errors`." -response +Create or update annotations returns "OK — annotations created or updated. For mixed batches, denied items and other +per-item errors are listed in `errors`." response """ from datadog_api_client import ApiClient, Configuration diff --git a/src/datadog_api_client/v2/api/agent_observability_api.py b/src/datadog_api_client/v2/api/agent_observability_api.py index 3804f19a5c..3cd16b79d1 100644 --- a/src/datadog_api_client/v2/api/agent_observability_api.py +++ b/src/datadog_api_client/v2/api/agent_observability_api.py @@ -2249,6 +2249,7 @@ def create_llm_obs_annotation_queue( Create an annotation queue. The ``name`` and ``project_id`` fields are required. An optional ``annotation_schema`` can be provided to define the labels for the queue. + Optional access-control fields can restrict annotation access to reviewers or assignees. Fields such as ``created_by`` , ``owned_by`` , ``created_at`` , ``modified_by`` , and ``modified_at`` are inferred by the backend. @@ -3638,7 +3639,9 @@ def update_llm_obs_annotation_queue( ) -> LLMObsAnnotationQueueResponse: """Update an Agent Observability annotation queue. - Partially update an annotation queue. The ``name`` , ``description`` , and ``annotation_schema`` fields can be updated. + Partially update an annotation queue. The ``name`` , ``description`` , + ``annotation_schema`` , ``reviewer_emails`` , ``restrict_to_reviewers`` , and + ``restrict_to_assignees`` fields can be updated. :param queue_id: The ID of the Agent Observability annotation queue. :type queue_id: str @@ -3918,6 +3921,7 @@ def upsert_llm_obs_annotations( by ``interaction_id`` and the requesting user's identity. Results and errors in the response are linked to request items by ``interaction_id``. Errors for individual items are returned in the ``errors`` field without blocking the rest of the batch. + Requests where every item is denied by queue access rules return ``403``. :param queue_id: The ID of the Agent Observability annotation queue. :type queue_id: str diff --git a/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_by_trace_item.py b/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_by_trace_item.py index 82e0179718..56801353e9 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_by_trace_item.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_by_trace_item.py @@ -35,6 +35,7 @@ def openapi_types(_): return { "annotations": ([LLMObsAnnotationItem],), + "can_annotate": (bool,), "content_id": (str,), "created_at": (datetime,), "display_block": ([LLMObsContentBlock],), @@ -47,6 +48,7 @@ def openapi_types(_): attribute_map = { "annotations": "annotations", + "can_annotate": "can_annotate", "content_id": "content_id", "created_at": "created_at", "display_block": "display_block", @@ -60,6 +62,7 @@ def openapi_types(_): def __init__( self_, annotations: List[LLMObsAnnotationItem], + can_annotate: bool, content_id: str, created_at: datetime, id: str, @@ -76,6 +79,9 @@ def __init__( :param annotations: List of annotations for this interaction. :type annotations: [LLMObsAnnotationItem] + :param can_annotate: Whether the current caller can annotate this interaction. + :type can_annotate: bool + :param content_id: Upstream entity identifier (trace ID, session ID, or deterministic display_block ID). :type content_id: str @@ -106,6 +112,7 @@ def __init__( super().__init__(kwargs) self_.annotations = annotations + self_.can_annotate = can_annotate self_.content_id = content_id self_.created_at = created_at self_.id = id diff --git a/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_item.py b/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_item.py index 5d4de62048..bbdf73ba35 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_item.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotated_interaction_item.py @@ -18,6 +18,9 @@ def __init__(self, **kwargs): :param annotations: List of annotations for this interaction. :type annotations: [LLMObsAnnotationItem] + :param can_annotate: Whether the current caller can annotate this interaction. + :type can_annotate: bool + :param content_id: Upstream entity identifier supplied by the caller. :type content_id: str diff --git a/src/datadog_api_client/v2/model/llm_obs_annotation_error.py b/src/datadog_api_client/v2/model/llm_obs_annotation_error.py index bb6d86424f..c6ecf801fa 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotation_error.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotation_error.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union +from typing import Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -13,28 +13,46 @@ ) +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_annotation_error_code import LLMObsAnnotationErrorCode + + class LLMObsAnnotationError(ModelNormal): @cached_property def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_annotation_error_code import LLMObsAnnotationErrorCode + return { "annotation_id": (str,), + "code": (LLMObsAnnotationErrorCode,), "error": (str,), "interaction_id": (str,), } attribute_map = { "annotation_id": "annotation_id", + "code": "code", "error": "error", "interaction_id": "interaction_id", } - def __init__(self_, error: str, interaction_id: str, annotation_id: Union[str, UnsetType] = unset, **kwargs): + def __init__( + self_, + error: str, + interaction_id: str, + annotation_id: Union[str, UnsetType] = unset, + code: Union[LLMObsAnnotationErrorCode, UnsetType] = unset, + **kwargs, + ): """ A partial error for a single annotation that could not be processed. :param annotation_id: ID of the annotation that failed, if applicable. :type annotation_id: str, optional + :param code: Stable error code. ``permission_denied`` indicates the item was rejected by queue access rules. + :type code: LLMObsAnnotationErrorCode, optional + :param error: Error message. :type error: str @@ -43,6 +61,8 @@ def __init__(self_, error: str, interaction_id: str, annotation_id: Union[str, U """ if annotation_id is not unset: kwargs["annotation_id"] = annotation_id + if code is not unset: + kwargs["code"] = code super().__init__(kwargs) self_.error = error diff --git a/src/datadog_api_client/v2/model/llm_obs_annotation_error_code.py b/src/datadog_api_client/v2/model/llm_obs_annotation_error_code.py new file mode 100644 index 0000000000..876679dd02 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_annotation_error_code.py @@ -0,0 +1,35 @@ +# 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 ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class LLMObsAnnotationErrorCode(ModelSimple): + """ + Stable error code. `permission_denied` indicates the item was rejected by queue access rules. + + :param value: If omitted defaults to "permission_denied". Must be one of ["permission_denied"]. + :type value: str + """ + + allowed_values = { + "permission_denied", + } + PERMISSION_DENIED: ClassVar["LLMObsAnnotationErrorCode"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +LLMObsAnnotationErrorCode.PERMISSION_DENIED = LLMObsAnnotationErrorCode("permission_denied") diff --git a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_request.py b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_request.py index 3d83fac88b..26d9cefc79 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_request.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_request.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -27,6 +27,9 @@ def openapi_types(_): "description": (str,), "name": (str,), "project_id": (str,), + "restrict_to_assignees": (bool,), + "restrict_to_reviewers": (bool,), + "reviewer_emails": ([str],), } attribute_map = { @@ -34,6 +37,9 @@ def openapi_types(_): "description": "description", "name": "name", "project_id": "project_id", + "restrict_to_assignees": "restrict_to_assignees", + "restrict_to_reviewers": "restrict_to_reviewers", + "reviewer_emails": "reviewer_emails", } def __init__( @@ -42,6 +48,9 @@ def __init__( project_id: str, annotation_schema: Union[LLMObsAnnotationSchema, UnsetType] = unset, description: Union[str, UnsetType] = unset, + restrict_to_assignees: Union[bool, UnsetType] = unset, + restrict_to_reviewers: Union[bool, UnsetType] = unset, + reviewer_emails: Union[List[str], UnsetType] = unset, **kwargs, ): """ @@ -58,11 +67,26 @@ def __init__( :param project_id: Identifier of the project this queue belongs to. :type project_id: str + + :param restrict_to_assignees: Whether annotation access is restricted to assigned users. + :type restrict_to_assignees: bool, optional + + :param restrict_to_reviewers: Whether annotation access is restricted to queue reviewers. + :type restrict_to_reviewers: bool, optional + + :param reviewer_emails: Email addresses of reviewers who can access the annotation queue. + :type reviewer_emails: [str], optional """ if annotation_schema is not unset: kwargs["annotation_schema"] = annotation_schema if description is not unset: kwargs["description"] = description + if restrict_to_assignees is not unset: + kwargs["restrict_to_assignees"] = restrict_to_assignees + if restrict_to_reviewers is not unset: + kwargs["restrict_to_reviewers"] = restrict_to_reviewers + if reviewer_emails is not unset: + kwargs["reviewer_emails"] = reviewer_emails super().__init__(kwargs) self_.name = name diff --git a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_response.py b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_response.py index 994876a687..39ff6fbce7 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_response.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_data_attributes_response.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -25,6 +25,7 @@ def openapi_types(_): return { "annotation_schema": (LLMObsAnnotationSchema,), + "can_manage_access": (bool,), "created_at": (datetime,), "created_by": (str,), "description": (str,), @@ -33,10 +34,14 @@ def openapi_types(_): "name": (str,), "owned_by": (str,), "project_id": (str,), + "restrict_to_assignees": (bool,), + "restrict_to_reviewers": (bool,), + "reviewer_emails": ([str],), } attribute_map = { "annotation_schema": "annotation_schema", + "can_manage_access": "can_manage_access", "created_at": "created_at", "created_by": "created_by", "description": "description", @@ -45,10 +50,17 @@ def openapi_types(_): "name": "name", "owned_by": "owned_by", "project_id": "project_id", + "restrict_to_assignees": "restrict_to_assignees", + "restrict_to_reviewers": "restrict_to_reviewers", + "reviewer_emails": "reviewer_emails", + } + read_only_vars = { + "can_manage_access", } def __init__( self_, + can_manage_access: bool, created_at: datetime, created_by: str, description: str, @@ -57,7 +69,10 @@ def __init__( name: str, owned_by: str, project_id: str, + restrict_to_assignees: bool, + restrict_to_reviewers: bool, annotation_schema: Union[LLMObsAnnotationSchema, UnsetType] = unset, + reviewer_emails: Union[List[str], UnsetType] = unset, **kwargs, ): """ @@ -66,6 +81,9 @@ def __init__( :param annotation_schema: Schema defining the labels for an annotation queue. :type annotation_schema: LLMObsAnnotationSchema, optional + :param can_manage_access: Whether the current caller can manage access for the annotation queue. + :type can_manage_access: bool + :param created_at: Timestamp when the queue was created. :type created_at: datetime @@ -89,11 +107,24 @@ def __init__( :param project_id: Identifier of the project this queue belongs to. :type project_id: str + + :param restrict_to_assignees: Whether annotation access is restricted to assigned users. + :type restrict_to_assignees: bool + + :param restrict_to_reviewers: Whether annotation access is restricted to queue reviewers. + :type restrict_to_reviewers: bool + + :param reviewer_emails: Email addresses of reviewers for the annotation queue. Returned only + when the caller can manage queue access. + :type reviewer_emails: [str], optional """ if annotation_schema is not unset: kwargs["annotation_schema"] = annotation_schema + if reviewer_emails is not unset: + kwargs["reviewer_emails"] = reviewer_emails super().__init__(kwargs) + self_.can_manage_access = can_manage_access self_.created_at = created_at self_.created_by = created_by self_.description = description @@ -102,3 +133,5 @@ def __init__( self_.name = name self_.owned_by = owned_by self_.project_id = project_id + self_.restrict_to_assignees = restrict_to_assignees + self_.restrict_to_reviewers = restrict_to_reviewers diff --git a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_update_data_attributes_request.py b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_update_data_attributes_request.py index 06f2c6fa4a..f0c31d5297 100644 --- a/src/datadog_api_client/v2/model/llm_obs_annotation_queue_update_data_attributes_request.py +++ b/src/datadog_api_client/v2/model/llm_obs_annotation_queue_update_data_attributes_request.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Union, TYPE_CHECKING +from typing import List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -26,12 +26,18 @@ def openapi_types(_): "annotation_schema": (LLMObsAnnotationSchema,), "description": (str,), "name": (str,), + "restrict_to_assignees": (bool,), + "restrict_to_reviewers": (bool,), + "reviewer_emails": ([str],), } attribute_map = { "annotation_schema": "annotation_schema", "description": "description", "name": "name", + "restrict_to_assignees": "restrict_to_assignees", + "restrict_to_reviewers": "restrict_to_reviewers", + "reviewer_emails": "reviewer_emails", } def __init__( @@ -39,6 +45,9 @@ def __init__( annotation_schema: Union[LLMObsAnnotationSchema, UnsetType] = unset, description: Union[str, UnsetType] = unset, name: Union[str, UnsetType] = unset, + restrict_to_assignees: Union[bool, UnsetType] = unset, + restrict_to_reviewers: Union[bool, UnsetType] = unset, + reviewer_emails: Union[List[str], UnsetType] = unset, **kwargs, ): """ @@ -52,6 +61,15 @@ def __init__( :param name: Updated name of the annotation queue. :type name: str, optional + + :param restrict_to_assignees: Whether annotation access is restricted to assigned users. + :type restrict_to_assignees: bool, optional + + :param restrict_to_reviewers: Whether annotation access is restricted to queue reviewers. + :type restrict_to_reviewers: bool, optional + + :param reviewer_emails: Updated email addresses of reviewers who can access the annotation queue. + :type reviewer_emails: [str], optional """ if annotation_schema is not unset: kwargs["annotation_schema"] = annotation_schema @@ -59,4 +77,10 @@ def __init__( kwargs["description"] = description if name is not unset: kwargs["name"] = name + if restrict_to_assignees is not unset: + kwargs["restrict_to_assignees"] = restrict_to_assignees + if restrict_to_reviewers is not unset: + kwargs["restrict_to_reviewers"] = restrict_to_reviewers + if reviewer_emails is not unset: + kwargs["reviewer_emails"] = reviewer_emails super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_display_block_annotated_interaction_item.py b/src/datadog_api_client/v2/model/llm_obs_display_block_annotated_interaction_item.py index 0edb149eb3..0eb8a65c98 100644 --- a/src/datadog_api_client/v2/model/llm_obs_display_block_annotated_interaction_item.py +++ b/src/datadog_api_client/v2/model/llm_obs_display_block_annotated_interaction_item.py @@ -32,6 +32,7 @@ def openapi_types(_): return { "annotations": ([LLMObsAnnotationItem],), + "can_annotate": (bool,), "content_id": (str,), "display_block": ([LLMObsContentBlock],), "id": (str,), @@ -40,6 +41,7 @@ def openapi_types(_): attribute_map = { "annotations": "annotations", + "can_annotate": "can_annotate", "content_id": "content_id", "display_block": "display_block", "id": "id", @@ -49,6 +51,7 @@ def openapi_types(_): def __init__( self_, annotations: List[LLMObsAnnotationItem], + can_annotate: bool, content_id: str, display_block: List[LLMObsContentBlock], id: str, @@ -61,6 +64,9 @@ def __init__( :param annotations: List of annotations for this interaction. :type annotations: [LLMObsAnnotationItem] + :param can_annotate: Whether the current caller can annotate this interaction. + :type can_annotate: bool + :param content_id: Server-generated deterministic identifier derived from the block list. :type content_id: str @@ -77,6 +83,7 @@ def __init__( super().__init__(kwargs) self_.annotations = annotations + self_.can_annotate = can_annotate self_.content_id = content_id self_.display_block = display_block self_.id = id diff --git a/src/datadog_api_client/v2/model/llm_obs_trace_annotated_interaction_item.py b/src/datadog_api_client/v2/model/llm_obs_trace_annotated_interaction_item.py index 086ddc0ef7..da96e519af 100644 --- a/src/datadog_api_client/v2/model/llm_obs_trace_annotated_interaction_item.py +++ b/src/datadog_api_client/v2/model/llm_obs_trace_annotated_interaction_item.py @@ -25,6 +25,7 @@ def openapi_types(_): return { "annotations": ([LLMObsAnnotationItem],), + "can_annotate": (bool,), "content_id": (str,), "created_at": (datetime,), "id": (str,), @@ -34,6 +35,7 @@ def openapi_types(_): attribute_map = { "annotations": "annotations", + "can_annotate": "can_annotate", "content_id": "content_id", "created_at": "created_at", "id": "id", @@ -44,6 +46,7 @@ def openapi_types(_): def __init__( self_, annotations: List[LLMObsAnnotationItem], + can_annotate: bool, content_id: str, created_at: datetime, id: str, @@ -57,6 +60,9 @@ def __init__( :param annotations: List of annotations for this interaction. :type annotations: [LLMObsAnnotationItem] + :param can_annotate: Whether the current caller can annotate this interaction. + :type can_annotate: bool + :param content_id: Upstream entity identifier supplied by the caller. :type content_id: str @@ -75,6 +81,7 @@ def __init__( super().__init__(kwargs) self_.annotations = annotations + self_.can_annotate = can_annotate self_.content_id = content_id self_.created_at = created_at self_.id = id diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index b168aca54c..a1366b28bb 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -4354,6 +4354,7 @@ from datadog_api_client.v2.model.llm_obs_annotated_interactions_type import LLMObsAnnotatedInteractionsType from datadog_api_client.v2.model.llm_obs_annotation_assessment import LLMObsAnnotationAssessment from datadog_api_client.v2.model.llm_obs_annotation_error import LLMObsAnnotationError +from datadog_api_client.v2.model.llm_obs_annotation_error_code import LLMObsAnnotationErrorCode from datadog_api_client.v2.model.llm_obs_annotation_item import LLMObsAnnotationItem from datadog_api_client.v2.model.llm_obs_annotation_item_response import LLMObsAnnotationItemResponse from datadog_api_client.v2.model.llm_obs_annotation_label_value import LLMObsAnnotationLabelValue @@ -14221,6 +14222,7 @@ "LLMObsAnnotatedInteractionsType", "LLMObsAnnotationAssessment", "LLMObsAnnotationError", + "LLMObsAnnotationErrorCode", "LLMObsAnnotationItem", "LLMObsAnnotationItemResponse", "LLMObsAnnotationLabelValue", diff --git a/tests/v2/features/agent_observability.feature b/tests/v2/features/agent_observability.feature index 0b036ba38e..acf08cf0dd 100644 --- a/tests/v2/features/agent_observability.feature +++ b/tests/v2/features/agent_observability.feature @@ -210,7 +210,7 @@ Feature: Agent Observability Scenario: Create an Agent Observability annotation queue returns "Bad Request" response Given operation "CreateLLMObsAnnotationQueue" enabled And new "CreateLLMObsAnnotationQueue" request - And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "00000000-0000-0000-0000-000000000002"}, "type": "queues"}} + And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "00000000-0000-0000-0000-000000000002", "restrict_to_assignees": false, "restrict_to_reviewers": true, "reviewer_emails": ["reviewer@example.com"]}, "type": "queues"}} When the request is sent Then the response status is 400 Bad Request @@ -218,7 +218,7 @@ Feature: Agent Observability Scenario: Create an Agent Observability annotation queue returns "Created" response Given operation "CreateLLMObsAnnotationQueue" enabled And new "CreateLLMObsAnnotationQueue" request - And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "00000000-0000-0000-0000-000000000002"}, "type": "queues"}} + And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "00000000-0000-0000-0000-000000000002", "restrict_to_assignees": false, "restrict_to_reviewers": true, "reviewer_emails": ["reviewer@example.com"]}, "type": "queues"}} When the request is sent Then the response status is 201 Created @@ -409,13 +409,13 @@ Feature: Agent Observability Then the response status is 404 Not Found — the queue does not exist. @generated @skip @team:DataDog/ml-observability - Scenario: Create or update annotations returns "OK — annotations created or updated. Per-item errors are listed in `errors`." response + Scenario: Create or update annotations returns "OK — annotations created or updated. For mixed batches, denied items and other per-item errors are listed in `errors`." response Given operation "UpsertLLMObsAnnotations" enabled And new "UpsertLLMObsAnnotations" request And request contains "queue_id" parameter from "REPLACE.ME" And body with value {"data": {"attributes": {"annotations": [{"interaction_id": "00000000-0000-0000-0000-000000000001", "label_values": [{"label_schema_id": "abc-123", "value": "good"}, {"label_schema_id": "ef56gh78", "value": "positive"}]}]}, "type": "annotations"}} When the request is sent - Then the response status is 200 OK — annotations created or updated. Per-item errors are listed in `errors`. + Then the response status is 200 OK — annotations created or updated. For mixed batches, denied items and other per-item errors are listed in `errors`. @generated @skip @team:DataDog/ml-observability Scenario: Delete Agent Observability dataset records returns "Bad Request" response @@ -1480,7 +1480,7 @@ Feature: Agent Observability Given operation "UpdateLLMObsAnnotationQueue" enabled And new "UpdateLLMObsAnnotationQueue" request And request contains "queue_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name", "restrict_to_assignees": false, "restrict_to_reviewers": true, "reviewer_emails": ["reviewer@example.com"]}, "type": "queues"}} When the request is sent Then the response status is 400 Bad Request @@ -1489,7 +1489,7 @@ Feature: Agent Observability Given operation "UpdateLLMObsAnnotationQueue" enabled And new "UpdateLLMObsAnnotationQueue" request And request contains "queue_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name", "restrict_to_assignees": false, "restrict_to_reviewers": true, "reviewer_emails": ["reviewer@example.com"]}, "type": "queues"}} When the request is sent Then the response status is 404 Not Found @@ -1498,7 +1498,7 @@ Feature: Agent Observability Given operation "UpdateLLMObsAnnotationQueue" enabled And new "UpdateLLMObsAnnotationQueue" request And request contains "queue_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + And body with value {"data": {"attributes": {"annotation_schema": {"label_schemas": [{"description": "Rating of the response quality.", "has_assessment": false, "has_reasoning": false, "id": "abc-123", "is_assessment": false, "is_integer": false, "is_required": true, "max": 5.0, "min": 0.0, "name": "quality", "type": "score", "values": ["good", "bad", "neutral"]}]}, "description": "Updated description", "name": "Updated queue name", "restrict_to_assignees": false, "restrict_to_reviewers": true, "reviewer_emails": ["reviewer@example.com"]}, "type": "queues"}} When the request is sent Then the response status is 200 OK