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
418 changes: 350 additions & 68 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

98 changes: 91 additions & 7 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17574,6 +17574,41 @@ datadog\_api\_client.v2.model.llm\_obs\_annotation\_schema module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_content\_block module
-------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_content_block
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_content\_block\_header\_level module
----------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_content_block_header_level
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_content\_block\_llm\_obs\_trace\_interaction\_type module
-------------------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_content_block_llm_obs_trace_interaction_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_content\_block\_time\_frame module
--------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_content_block_time_frame
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_content\_block\_type module
-------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_content_block_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_cursor\_meta module
-----------------------------------------------------------

Expand Down Expand Up @@ -18008,6 +18043,34 @@ datadog\_api\_client.v2.model.llm\_obs\_delete\_projects\_request module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_display\_block\_annotated\_interaction\_item module
-------------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_display_block_annotated_interaction_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_display\_block\_interaction\_item module
--------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_display_block_interaction_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_display\_block\_interaction\_response\_item module
------------------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_display_block_interaction_response_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_display\_block\_interaction\_type module
--------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_display_block_interaction_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_event\_type module
----------------------------------------------------------

Expand Down Expand Up @@ -18155,13 +18218,6 @@ datadog\_api\_client.v2.model.llm\_obs\_experiments\_response module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_interaction\_type module
----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_interaction_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_label\_schema module
------------------------------------------------------------

Expand Down Expand Up @@ -18274,6 +18330,34 @@ datadog\_api\_client.v2.model.llm\_obs\_record\_type module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_trace\_annotated\_interaction\_item module
----------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_trace_annotated_interaction_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_trace\_interaction\_item module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_trace_interaction_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_trace\_interaction\_response\_item module
---------------------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_trace_interaction_response_item
:members:
:show-inheritance:

datadog\_api\_client.v2.model.llm\_obs\_trace\_interaction\_type module
-----------------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.llm_obs_trace_interaction_type
:members:
:show-inheritance:

datadog\_api\_client.v2.model.log module
----------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.llm_observability_api import LLMObservabilityApi
from datadog_api_client.v2.model.llm_obs_annotation_queue_interaction_item import LLMObsAnnotationQueueInteractionItem
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_data_attributes_request import (
LLMObsAnnotationQueueInteractionsDataAttributesRequest,
)
Expand All @@ -15,15 +14,16 @@
LLMObsAnnotationQueueInteractionsRequest,
)
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_type import LLMObsAnnotationQueueInteractionsType
from datadog_api_client.v2.model.llm_obs_interaction_type import LLMObsInteractionType
from datadog_api_client.v2.model.llm_obs_trace_interaction_item import LLMObsTraceInteractionItem
from datadog_api_client.v2.model.llm_obs_trace_interaction_type import LLMObsTraceInteractionType

body = LLMObsAnnotationQueueInteractionsRequest(
data=LLMObsAnnotationQueueInteractionsDataRequest(
attributes=LLMObsAnnotationQueueInteractionsDataAttributesRequest(
interactions=[
LLMObsAnnotationQueueInteractionItem(
LLMObsTraceInteractionItem(
content_id="trace-abc-123",
type=LLMObsInteractionType.TRACE,
type=LLMObsTraceInteractionType.TRACE,
),
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""
Add a display_block interaction returns "Created" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.llm_observability_api import LLMObservabilityApi
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_data_attributes_request import (
LLMObsAnnotationQueueInteractionsDataAttributesRequest,
)
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_data_request import (
LLMObsAnnotationQueueInteractionsDataRequest,
)
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_request import (
LLMObsAnnotationQueueInteractionsRequest,
)
from datadog_api_client.v2.model.llm_obs_annotation_queue_interactions_type import LLMObsAnnotationQueueInteractionsType
from datadog_api_client.v2.model.llm_obs_content_block import LLMObsContentBlock
from datadog_api_client.v2.model.llm_obs_content_block_type import LLMObsContentBlockType
from datadog_api_client.v2.model.llm_obs_display_block_interaction_item import LLMObsDisplayBlockInteractionItem
from datadog_api_client.v2.model.llm_obs_display_block_interaction_type import LLMObsDisplayBlockInteractionType

body = LLMObsAnnotationQueueInteractionsRequest(
data=LLMObsAnnotationQueueInteractionsDataRequest(
attributes=LLMObsAnnotationQueueInteractionsDataAttributesRequest(
interactions=[
LLMObsDisplayBlockInteractionItem(
type=LLMObsDisplayBlockInteractionType.DISPLAY_BLOCK,
display_block=[
LLMObsContentBlock(
type=LLMObsContentBlockType.MARKDOWN,
content="## Triage Instructions",
),
],
),
],
),
type=LLMObsAnnotationQueueInteractionsType.INTERACTIONS,
),
)

configuration = Configuration()
configuration.unstable_operations["create_llm_obs_annotation_queue_interactions"] = True
with ApiClient(configuration) as api_client:
api_instance = LLMObservabilityApi(api_client)
response = api_instance.create_llm_obs_annotation_queue_interactions(queue_id="queue_id", body=body)

print(response)
12 changes: 10 additions & 2 deletions src/datadog_api_client/v2/api/llm_observability_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,16 @@ def create_llm_obs_annotation_queue_interactions(
) -> LLMObsAnnotationQueueInteractionsResponse:
"""Add annotation queue interactions.

Add one or more interactions (traces or sessions) to an annotation queue.
At least one interaction must be provided.
Add one or more interactions to an annotation queue. At least one
interaction must be provided. Each interaction has a ``type`` :

* ``trace`` , ``experiment_trace`` , ``session`` : ``content_id`` references the
upstream entity; the server fetches the actual content.
* ``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.

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

:param queue_id: The ID of the LLM Observability annotation queue.
:type queue_id: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,55 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
ModelComposed,
cached_property,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.llm_obs_annotation_item import LLMObsAnnotationItem
from datadog_api_client.v2.model.llm_obs_interaction_type import LLMObsInteractionType


class LLMObsAnnotatedInteractionItem(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_interaction_type import LLMObsInteractionType

return {
"annotations": ([LLMObsAnnotationItem],),
"content_id": (str,),
"id": (str,),
"type": (LLMObsInteractionType,),
}

attribute_map = {
"annotations": "annotations",
"content_id": "content_id",
"id": "id",
"type": "type",
}

def __init__(
self_, annotations: List[LLMObsAnnotationItem], content_id: str, id: str, type: LLMObsInteractionType, **kwargs
):
class LLMObsAnnotatedInteractionItem(ModelComposed):
def __init__(self, **kwargs):
"""
An interaction with its associated annotations.

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

:param content_id: Identifier of the content (trace ID or session ID) for this interaction.
:param content_id: Upstream entity identifier supplied by the caller.
:type content_id: str

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

:param type: Type of interaction in an annotation queue.
:type type: LLMObsInteractionType
:param type: Type of an upstream-entity interaction.
:type type: LLMObsTraceInteractionType

:param display_block: List of content blocks that make up a `display_block` interaction.
Must contain at least one block.
:type display_block: [LLMObsContentBlock]
"""
super().__init__(kwargs)

self_.annotations = annotations
self_.content_id = content_id
self_.id = id
self_.type = type
@cached_property
def _composed_schemas(_):
# we need this here to make our import statements work
# we must store _composed_schemas in here so the code is only run
# when we invoke this method. If we kept this at the class
# level we would get an error because the class level
# code would be run when this module is imported, and these composed
# classes don't exist yet because their module has not finished
# loading
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,
)

return {
"oneOf": [
LLMObsTraceAnnotatedInteractionItem,
LLMObsDisplayBlockAnnotatedInteractionItem,
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
Expand All @@ -13,6 +13,10 @@

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,
)


class LLMObsAnnotatedInteractionsDataAttributesResponse(ModelNormal):
Expand All @@ -28,7 +32,17 @@ def openapi_types(_):
"annotated_interactions": "annotated_interactions",
}

def __init__(self_, annotated_interactions: List[LLMObsAnnotatedInteractionItem], **kwargs):
def __init__(
self_,
annotated_interactions: List[
Union[
LLMObsAnnotatedInteractionItem,
LLMObsTraceAnnotatedInteractionItem,
LLMObsDisplayBlockAnnotatedInteractionItem,
]
],
**kwargs,
):
"""
Attributes containing the list of annotated interactions.

Expand Down
Loading
Loading