Skip to content
Open
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
281 changes: 232 additions & 49 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Get an annotated queue interaction returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.agent_observability_api import AgentObservabilityApi

configuration = Configuration()
configuration.unstable_operations["get_llm_obs_annotated_interaction"] = True
with ApiClient(configuration) as api_client:
api_instance = AgentObservabilityApi(api_client)
response = api_instance.get_llm_obs_annotated_interaction(
queue_id="queue_id",
interaction_id="interaction_id",
)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ def __init__(
"v2.delete_llm_obs_projects": False,
"v2.delete_llm_obs_prompt": False,
"v2.export_llm_obs_dataset": False,
"v2.get_llm_obs_annotated_interaction": False,
"v2.get_llm_obs_annotated_interactions": False,
"v2.get_llm_obs_annotated_interactions_by_trace_i_ds": False,
"v2.get_llm_obs_annotation_queue_label_schema": False,
Expand Down
55 changes: 55 additions & 0 deletions src/datadog_api_client/v2/api/agent_observability_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from datadog_api_client.v2.model.llm_obs_annotation_queue_request import LLMObsAnnotationQueueRequest
from datadog_api_client.v2.model.llm_obs_annotation_queue_update_request import LLMObsAnnotationQueueUpdateRequest
from datadog_api_client.v2.model.llm_obs_annotated_interactions_response import LLMObsAnnotatedInteractionsResponse
from datadog_api_client.v2.model.llm_obs_annotated_interaction_response import LLMObsAnnotatedInteractionResponse
from datadog_api_client.v2.model.llm_obs_annotations_response import LLMObsAnnotationsResponse
from datadog_api_client.v2.model.llm_obs_annotations_request import LLMObsAnnotationsRequest
from datadog_api_client.v2.model.llm_obs_delete_annotations_response import LLMObsDeleteAnnotationsResponse
Expand Down Expand Up @@ -741,6 +742,35 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_llm_obs_annotated_interaction_endpoint = _Endpoint(
settings={
"response_type": (LLMObsAnnotatedInteractionResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions/{interaction_id}",
"operation_id": "get_llm_obs_annotated_interaction",
"http_method": "GET",
"version": "v2",
},
params_map={
"queue_id": {
"required": True,
"openapi_types": (str,),
"attribute": "queue_id",
"location": "path",
},
"interaction_id": {
"required": True,
"openapi_types": (str,),
"attribute": "interaction_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._get_llm_obs_annotated_interactions_endpoint = _Endpoint(
settings={
"response_type": (LLMObsAnnotatedInteractionsResponse,),
Expand Down Expand Up @@ -2277,6 +2307,9 @@ def create_llm_obs_annotation_queue_interactions(
* ``display_block`` : omit ``content_id`` and provide the rendered content
in ``display_block``. The server generates ``content_id`` as a
deterministic hash of the block list.
* ``frontend`` : omit ``content_id`` and provide the web content in
``frontend``. The server returns a deterministic ``content_id`` for the
content.

Items of different types can be mixed in a single request.

Expand Down Expand Up @@ -2694,6 +2727,28 @@ def export_llm_obs_dataset(

return self._export_llm_obs_dataset_endpoint.call_with_http_info(**kwargs)

def get_llm_obs_annotated_interaction(
self,
queue_id: str,
interaction_id: str,
) -> LLMObsAnnotatedInteractionResponse:
"""Get an annotated queue interaction.

Retrieve a single interaction (trace, session, display block, or frontend content) and its annotations for a given annotation queue.

:param queue_id: The ID of the Agent Observability annotation queue.
:type queue_id: str
:param interaction_id: The ID of the interaction within the annotation queue.
:type interaction_id: str
:rtype: LLMObsAnnotatedInteractionResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["queue_id"] = queue_id

kwargs["interaction_id"] = interaction_id

return self._get_llm_obs_annotated_interaction_endpoint.call_with_http_info(**kwargs)

def get_llm_obs_annotated_interactions(
self,
queue_id: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@


if TYPE_CHECKING:
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_content_block import LLMObsContentBlock
from datadog_api_client.v2.model.llm_obs_frontend_content import LLMObsFrontendContent
from datadog_api_client.v2.model.llm_obs_any_interaction_type import LLMObsAnyInteractionType


Expand All @@ -29,16 +30,18 @@ class LLMObsAnnotatedInteractionByTraceItem(ModelNormal):

@cached_property
def openapi_types(_):
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_content_block import LLMObsContentBlock
from datadog_api_client.v2.model.llm_obs_frontend_content import LLMObsFrontendContent
from datadog_api_client.v2.model.llm_obs_any_interaction_type import LLMObsAnyInteractionType

return {
"annotations": ([LLMObsAnnotationItem],),
"annotations": ([LLMObsAnnotationItemResponse],),
"can_annotate": (bool,),
"content_id": (str,),
"created_at": (datetime,),
"display_block": ([LLMObsContentBlock],),
"frontend": (LLMObsFrontendContent,),
"id": (str,),
"modified_at": (datetime,),
"queue_id": (str,),
Expand All @@ -52,6 +55,7 @@ def openapi_types(_):
"content_id": "content_id",
"created_at": "created_at",
"display_block": "display_block",
"frontend": "frontend",
"id": "id",
"modified_at": "modified_at",
"queue_id": "queue_id",
Expand All @@ -61,7 +65,7 @@ def openapi_types(_):

def __init__(
self_,
annotations: List[LLMObsAnnotationItem],
annotations: List[LLMObsAnnotationItemResponse],
can_annotate: bool,
content_id: str,
created_at: datetime,
Expand All @@ -71,18 +75,19 @@ def __init__(
queue_name: str,
type: LLMObsAnyInteractionType,
display_block: Union[List[LLMObsContentBlock], UnsetType] = unset,
frontend: Union[LLMObsFrontendContent, UnsetType] = unset,
**kwargs,
):
"""
An annotated interaction returned by the cross-queue lookup, including the source queue metadata.

:param annotations: List of annotations for this interaction.
:type annotations: [LLMObsAnnotationItem]
:type annotations: [LLMObsAnnotationItemResponse]

: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).
:param content_id: Upstream entity identifier (trace ID, session ID, or deterministic display_block or frontend ID).
:type content_id: str

:param created_at: Timestamp when the interaction was added to the queue.
Expand All @@ -92,6 +97,9 @@ def __init__(
Must contain at least one block.
:type display_block: [LLMObsContentBlock], optional

:param frontend: Web content that makes up a ``frontend`` interaction.
:type frontend: LLMObsFrontendContent, optional

:param id: Unique identifier of the interaction.
:type id: str

Expand All @@ -109,6 +117,8 @@ def __init__(
"""
if display_block is not unset:
kwargs["display_block"] = display_block
if frontend is not unset:
kwargs["frontend"] = frontend
super().__init__(kwargs)

self_.annotations = annotations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.llm_obs_annotated_interaction_item import LLMObsAnnotatedInteractionItem
from datadog_api_client.v2.model.llm_obs_trace_annotated_interaction_item import LLMObsTraceAnnotatedInteractionItem
from datadog_api_client.v2.model.llm_obs_display_block_annotated_interaction_item import (
LLMObsDisplayBlockAnnotatedInteractionItem,
)
from datadog_api_client.v2.model.llm_obs_frontend_annotated_interaction_item import (
LLMObsFrontendAnnotatedInteractionItem,
)


class LLMObsAnnotatedInteractionDataAttributesResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.llm_obs_annotated_interaction_item import LLMObsAnnotatedInteractionItem

return {
"annotated_interaction": (LLMObsAnnotatedInteractionItem,),
}

attribute_map = {
"annotated_interaction": "annotated_interaction",
}

def __init__(
self_,
annotated_interaction: Union[
LLMObsAnnotatedInteractionItem,
LLMObsTraceAnnotatedInteractionItem,
LLMObsDisplayBlockAnnotatedInteractionItem,
LLMObsFrontendAnnotatedInteractionItem,
],
**kwargs,
):
"""
Attributes containing the annotated interaction.

:param annotated_interaction: An interaction with its associated annotations.
:type annotated_interaction: LLMObsAnnotatedInteractionItem
"""
super().__init__(kwargs)

self_.annotated_interaction = annotated_interaction
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# 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 typing import TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.llm_obs_annotated_interaction_data_attributes_response import (
LLMObsAnnotatedInteractionDataAttributesResponse,
)
from datadog_api_client.v2.model.llm_obs_annotated_interactions_type import LLMObsAnnotatedInteractionsType


class LLMObsAnnotatedInteractionDataResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.llm_obs_annotated_interaction_data_attributes_response import (
LLMObsAnnotatedInteractionDataAttributesResponse,
)
from datadog_api_client.v2.model.llm_obs_annotated_interactions_type import LLMObsAnnotatedInteractionsType

return {
"attributes": (LLMObsAnnotatedInteractionDataAttributesResponse,),
"id": (str,),
"type": (LLMObsAnnotatedInteractionsType,),
}

attribute_map = {
"attributes": "attributes",
"id": "id",
"type": "type",
}

def __init__(
self_,
attributes: LLMObsAnnotatedInteractionDataAttributesResponse,
id: str,
type: LLMObsAnnotatedInteractionsType,
**kwargs,
):
"""
Data object for a single annotated interaction.

:param attributes: Attributes containing the annotated interaction.
:type attributes: LLMObsAnnotatedInteractionDataAttributesResponse

:param id: The annotation queue ID.
:type id: str

:param type: Resource type for annotated interactions.
:type type: LLMObsAnnotatedInteractionsType
"""
super().__init__(kwargs)

self_.attributes = attributes
self_.id = id
self_.type = type
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, **kwargs):
An interaction with its associated annotations.

:param annotations: List of annotations for this interaction.
:type annotations: [LLMObsAnnotationItem]
:type annotations: [LLMObsAnnotationItemResponse]

:param can_annotate: Whether the current caller can annotate this interaction.
:type can_annotate: bool
Expand All @@ -39,6 +39,9 @@ def __init__(self, **kwargs):
:param display_block: List of content blocks that make up a `display_block` interaction.
Must contain at least one block.
:type display_block: [LLMObsContentBlock]

:param frontend: Web content that makes up a `frontend` interaction.
:type frontend: LLMObsFrontendContent
"""
super().__init__(kwargs)

Expand All @@ -57,10 +60,14 @@ def _composed_schemas(_):
from datadog_api_client.v2.model.llm_obs_display_block_annotated_interaction_item import (
LLMObsDisplayBlockAnnotatedInteractionItem,
)
from datadog_api_client.v2.model.llm_obs_frontend_annotated_interaction_item import (
LLMObsFrontendAnnotatedInteractionItem,
)

return {
"oneOf": [
LLMObsTraceAnnotatedInteractionItem,
LLMObsDisplayBlockAnnotatedInteractionItem,
LLMObsFrontendAnnotatedInteractionItem,
],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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 typing import TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.llm_obs_annotated_interaction_data_response import (
LLMObsAnnotatedInteractionDataResponse,
)


class LLMObsAnnotatedInteractionResponse(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.llm_obs_annotated_interaction_data_response import (
LLMObsAnnotatedInteractionDataResponse,
)

return {
"data": (LLMObsAnnotatedInteractionDataResponse,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: LLMObsAnnotatedInteractionDataResponse, **kwargs):
"""
Response containing a single annotated interaction.

:param data: Data object for a single annotated interaction.
:type data: LLMObsAnnotatedInteractionDataResponse
"""
super().__init__(kwargs)

self_.data = data
Loading
Loading