From e5efe0d678a691243890ebb50919b562229ae3e8 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 9 Apr 2026 07:32:30 +0000 Subject: [PATCH] Regenerate client from commit 5921132 of spec repo --- .generator/schemas/v2/openapi.yaml | 787 ++++++++- ...servability_CreateLLMObsAnnotationQueue.rs | 28 + ...CreateLLMObsAnnotationQueueInteractions.rs | 36 + ...servability_DeleteLLMObsAnnotationQueue.rs | 18 + ...DeleteLLMObsAnnotationQueueInteractions.rs | 32 + ...vability_GetLLMObsAnnotatedInteractions.rs | 18 + ...bservability_ListLLMObsAnnotationQueues.rs | 19 + ...servability_UpdateLLMObsAnnotationQueue.rs | 29 + src/datadog/configuration.rs | 13 + src/datadogV2/api/api_llm_observability.rs | 1459 +++++++++++++++-- src/datadogV2/model/mod.rs | 60 + ...odel_llm_obs_annotated_interaction_item.rs | 138 ++ ...d_interactions_data_attributes_response.rs | 98 ++ ...bs_annotated_interactions_data_response.rs | 127 ++ ...llm_obs_annotated_interactions_response.rs | 96 ++ ...del_llm_obs_annotated_interactions_type.rs | 48 + .../model/model_llm_obs_annotation_item.rs | 170 ++ ...nnotation_queue_data_attributes_request.rs | 120 ++ ...notation_queue_data_attributes_response.rs | 177 ++ ...l_llm_obs_annotation_queue_data_request.rs | 115 ++ ..._llm_obs_annotation_queue_data_response.rs | 126 ++ ...m_obs_annotation_queue_interaction_item.rs | 113 ++ ...otation_queue_interaction_response_item.rs | 137 ++ ...ue_interactions_data_attributes_request.rs | 98 ++ ...e_interactions_data_attributes_response.rs | 98 ++ ...otation_queue_interactions_data_request.rs | 117 ++ ...tation_queue_interactions_data_response.rs | 127 ++ ...s_annotation_queue_interactions_request.rs | 96 ++ ..._annotation_queue_interactions_response.rs | 96 ++ ..._obs_annotation_queue_interactions_type.rs | 48 + .../model_llm_obs_annotation_queue_request.rs | 95 ++ ...model_llm_obs_annotation_queue_response.rs | 95 ++ .../model_llm_obs_annotation_queue_type.rs | 48 + ...on_queue_update_data_attributes_request.rs | 123 ++ ...bs_annotation_queue_update_data_request.rs | 115 ++ ...llm_obs_annotation_queue_update_request.rs | 96 ++ ...odel_llm_obs_annotation_queues_response.rs | 96 ++ ...ue_interactions_data_attributes_request.rs | 97 ++ ...otation_queue_interactions_data_request.rs | 116 ++ ...e_annotation_queue_interactions_request.rs | 96 ++ .../model/model_llm_obs_interaction_type.rs | 51 + .../features/v2/llm_observability.feature | 155 +- tests/scenarios/features/v2/undo.json | 60 + tests/scenarios/function_mappings.rs | 241 +++ 44 files changed, 5948 insertions(+), 180 deletions(-) create mode 100644 examples/v2_llm-observability_CreateLLMObsAnnotationQueue.rs create mode 100644 examples/v2_llm-observability_CreateLLMObsAnnotationQueueInteractions.rs create mode 100644 examples/v2_llm-observability_DeleteLLMObsAnnotationQueue.rs create mode 100644 examples/v2_llm-observability_DeleteLLMObsAnnotationQueueInteractions.rs create mode 100644 examples/v2_llm-observability_GetLLMObsAnnotatedInteractions.rs create mode 100644 examples/v2_llm-observability_ListLLMObsAnnotationQueues.rs create mode 100644 examples/v2_llm-observability_UpdateLLMObsAnnotationQueue.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotated_interaction_item.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotated_interactions_data_attributes_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotated_interactions_data_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotated_interactions_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotated_interactions_type.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_item.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_data_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_data_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interaction_item.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interaction_response_item.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_interactions_type.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_type.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_update_data_attributes_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_update_data_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queue_update_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_annotation_queues_response.rs create mode 100644 src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_attributes_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_request.rs create mode 100644 src/datadogV2/model/model_llm_obs_interaction_type.rs diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d235bdcd3d..e632b11bed 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -758,6 +758,14 @@ components: schema: example: "my-job" type: string + LLMObsAnnotationQueueIDPathParameter: + description: The ID of the LLM Observability annotation queue. + example: "b5e7f3a1-9c2d-4f8b-a1e6-3d7e9f0a2b4c" + in: path + name: queue_id + required: true + schema: + type: string LLMObsDatasetIDPathParameter: description: The ID of the LLM Observability dataset. example: "9f64e5c7-dc5a-45c8-a17c-1b85f0bec97d" @@ -36063,6 +36071,386 @@ components: format: int64 type: integer type: object + LLMObsAnnotatedInteractionItem: + description: An interaction with its associated annotations. + properties: + annotations: + description: List of annotations for this interaction. + items: + $ref: "#/components/schemas/LLMObsAnnotationItem" + type: array + content_id: + description: Identifier of the content for this interaction. + example: "trace-abc-123" + type: string + id: + description: Unique identifier of the interaction. + example: "interaction-456" + type: string + type: + $ref: "#/components/schemas/LLMObsInteractionType" + required: + - id + - type + - content_id + - annotations + type: object + LLMObsAnnotatedInteractionsDataAttributesResponse: + description: Attributes containing the list of annotated interactions. + properties: + annotated_interactions: + description: List of interactions with their annotations. + items: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionItem" + type: array + required: + - annotated_interactions + type: object + LLMObsAnnotatedInteractionsDataResponse: + description: Data object for annotated interactions. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionsDataAttributesResponse" + id: + description: The queue ID. + example: "b5e7f3a1-9c2d-4f8b-a1e6-3d7e9f0a2b4c" + type: string + type: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionsType" + required: + - id + - type + - attributes + type: object + LLMObsAnnotatedInteractionsResponse: + description: Response containing the annotated interactions for an annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionsDataResponse" + required: + - data + type: object + LLMObsAnnotatedInteractionsType: + description: Resource type for annotated interactions. + enum: + - annotated_interactions + example: annotated_interactions + type: string + x-enum-varnames: + - ANNOTATED_INTERACTIONS + LLMObsAnnotationItem: + description: A single annotation on an interaction. + properties: + created_at: + description: Timestamp when the annotation was created. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + created_by: + description: Identifier of the user who created the annotation. + example: "00000000-0000-0000-0000-000000000002" + type: string + id: + description: Unique identifier of the annotation. + example: "annotation-789" + type: string + interaction_id: + description: Identifier of the interaction this annotation belongs to. + example: "interaction-456" + type: string + label_values: + additionalProperties: {} + description: The label values for this annotation. + example: + quality: "good" + type: object + modified_at: + description: Timestamp when the annotation was last modified. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + modified_by: + description: Identifier of the user who last modified the annotation. + example: "00000000-0000-0000-0000-000000000002" + type: string + required: + - id + - interaction_id + - label_values + - created_by + - created_at + - modified_by + - modified_at + type: object + LLMObsAnnotationQueueDataAttributesRequest: + description: Attributes for creating an LLM Observability annotation queue. + properties: + description: + description: Description of the annotation queue. + example: "Queue for annotating customer support traces" + type: string + name: + description: Name of the annotation queue. + example: "My annotation queue" + type: string + project_id: + description: Identifier of the project this queue belongs to. + example: "a33671aa-24fd-4dcd-9b33-a8ec7dde7751" + type: string + required: + - name + - project_id + type: object + LLMObsAnnotationQueueDataAttributesResponse: + description: Attributes of an LLM Observability annotation queue. + properties: + created_at: + description: Timestamp when the queue was created. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + created_by: + description: Identifier of the user who created the queue. + example: "00000000-0000-0000-0000-000000000002" + type: string + description: + description: Description of the annotation queue. + example: "Queue for annotating customer support traces" + type: string + modified_at: + description: Timestamp when the queue was last modified. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + modified_by: + description: Identifier of the user who last modified the queue. + example: "00000000-0000-0000-0000-000000000002" + type: string + name: + description: Name of the annotation queue. + example: "My annotation queue" + type: string + owned_by: + description: Identifier of the user who owns the queue. + example: "00000000-0000-0000-0000-000000000002" + type: string + project_id: + description: Identifier of the project this queue belongs to. + example: "a33671aa-24fd-4dcd-9b33-a8ec7dde7751" + type: string + required: + - name + - project_id + - description + - created_by + - created_at + - modified_by + - modified_at + - owned_by + type: object + LLMObsAnnotationQueueDataRequest: + description: Data object for creating an LLM Observability annotation queue. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotationQueueDataAttributesRequest" + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueType" + required: + - type + - attributes + type: object + LLMObsAnnotationQueueDataResponse: + description: Data object for an LLM Observability annotation queue. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotationQueueDataAttributesResponse" + id: + description: Unique identifier of the annotation queue. + example: "b5e7f3a1-9c2d-4f8b-a1e6-3d7e9f0a2b4c" + type: string + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueType" + required: + - id + - type + - attributes + type: object + LLMObsAnnotationQueueInteractionItem: + description: A single interaction to add to an annotation queue. + properties: + content_id: + description: Identifier of the content (such as trace ID) for this interaction. + example: "trace-abc-123" + type: string + type: + $ref: "#/components/schemas/LLMObsInteractionType" + required: + - type + - content_id + type: object + LLMObsAnnotationQueueInteractionResponseItem: + description: A single interaction result. + properties: + already_existed: + description: Whether this interaction already existed in the queue. + example: false + type: boolean + content_id: + description: Identifier of the content for this interaction. + example: "trace-abc-123" + type: string + id: + description: Unique identifier of the interaction. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/LLMObsInteractionType" + required: + - id + - type + - content_id + - already_existed + type: object + LLMObsAnnotationQueueInteractionsDataAttributesRequest: + description: Attributes for adding interactions to an annotation queue. + properties: + interactions: + description: List of interactions to add to the queue. Must contain at least one item. + items: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionItem" + minItems: 1 + type: array + required: + - interactions + type: object + LLMObsAnnotationQueueInteractionsDataAttributesResponse: + description: Attributes of the interaction addition response. + properties: + interactions: + description: List of interactions that were processed. + items: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionResponseItem" + type: array + required: + - interactions + type: object + LLMObsAnnotationQueueInteractionsDataRequest: + description: Data object for adding interactions to an annotation queue. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsDataAttributesRequest" + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsType" + required: + - type + - attributes + type: object + LLMObsAnnotationQueueInteractionsDataResponse: + description: Data object for the interaction addition response. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsDataAttributesResponse" + id: + description: The queue ID the interactions were added to. + example: "b5e7f3a1-9c2d-4f8b-a1e6-3d7e9f0a2b4c" + type: string + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsType" + required: + - id + - type + - attributes + type: object + LLMObsAnnotationQueueInteractionsRequest: + description: Request to add interactions to an LLM Observability annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsDataRequest" + required: + - data + type: object + LLMObsAnnotationQueueInteractionsResponse: + description: Response containing the result of adding interactions to an annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsDataResponse" + required: + - data + type: object + LLMObsAnnotationQueueInteractionsType: + description: Resource type for annotation queue interactions. + enum: + - interactions + example: interactions + type: string + x-enum-varnames: + - INTERACTIONS + LLMObsAnnotationQueueRequest: + description: Request to create an LLM Observability annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotationQueueDataRequest" + required: + - data + type: object + LLMObsAnnotationQueueResponse: + description: Response containing a single LLM Observability annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotationQueueDataResponse" + required: + - data + type: object + LLMObsAnnotationQueueType: + description: Resource type of an LLM Observability annotation queue. + enum: + - queues + example: queues + type: string + x-enum-varnames: + - QUEUES + LLMObsAnnotationQueueUpdateDataAttributesRequest: + description: Attributes for updating an LLM Observability annotation queue. All fields are optional. + properties: + description: + description: Updated description of the annotation queue. + example: "Updated description" + type: string + name: + description: Updated name of the annotation queue. + example: "Updated queue name" + type: string + type: object + LLMObsAnnotationQueueUpdateDataRequest: + description: Data object for updating an LLM Observability annotation queue. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotationQueueUpdateDataAttributesRequest" + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueType" + required: + - type + - attributes + type: object + LLMObsAnnotationQueueUpdateRequest: + description: Request to update an LLM Observability annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotationQueueUpdateDataRequest" + required: + - data + type: object + LLMObsAnnotationQueuesResponse: + description: Response containing a list of LLM Observability annotation queues. + properties: + data: + description: List of annotation queues. + items: + $ref: "#/components/schemas/LLMObsAnnotationQueueDataResponse" + type: array + required: + - data + type: object LLMObsCursorMeta: description: Pagination cursor metadata. properties: @@ -36394,6 +36782,41 @@ components: required: - data type: object + LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest: + description: Attributes for deleting interactions from an annotation queue. + properties: + interaction_ids: + description: List of interaction IDs to delete. Must contain at least one item. + example: + - "00000000-0000-0000-0000-000000000000" + - "00000000-0000-0000-0000-000000000001" + items: + description: An interaction ID to delete. + type: string + minItems: 1 + type: array + required: + - interaction_ids + type: object + LLMObsDeleteAnnotationQueueInteractionsDataRequest: + description: Data object for deleting interactions from an annotation queue. + properties: + attributes: + $ref: "#/components/schemas/LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest" + type: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsType" + required: + - type + - attributes + type: object + LLMObsDeleteAnnotationQueueInteractionsRequest: + description: Request to delete interactions from an LLM Observability annotation queue. + properties: + data: + $ref: "#/components/schemas/LLMObsDeleteAnnotationQueueInteractionsDataRequest" + required: + - data + type: object LLMObsDeleteDatasetRecordsDataAttributesRequest: description: Attributes for deleting records from an LLM Observability dataset. properties: @@ -36903,6 +37326,16 @@ components: required: - data type: object + LLMObsInteractionType: + description: Type of interaction in an annotation queue. + enum: + - trace + - experiment_trace + example: trace + type: string + x-enum-varnames: + - TRACE + - EXPERIMENT_TRACE LLMObsMetricAssessment: description: Assessment result for an LLM Observability experiment metric. enum: @@ -92366,6 +92799,358 @@ paths: operator: OR permissions: - org_management + /api/v2/llm-obs/v1/annotation-queues: + get: + description: |- + List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. + If neither is provided, all queues in the organization are returned. + operationId: ListLLMObsAnnotationQueues + parameters: + - description: Filter annotation queues by project ID. Cannot be used together with `queueIds`. + in: query + name: projectId + schema: + type: string + - description: Filter annotation queues by queue IDs (comma-separated). Cannot be used together with `projectId`. + in: query + name: queueIds + schema: + items: + type: string + type: array + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueuesResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List LLM Observability annotation queues + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + post: + description: |- + Create a new annotation queue. Only `name`, `project_id`, and `description` are accepted. + Fields such as `created_by`, `owned_by`, `created_at`, `modified_by`, and `modified_at` are inferred by the backend. + operationId: CreateLLMObsAnnotationQueue + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueRequest" + description: Create annotation queue payload. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create an LLM Observability annotation queue + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/annotation-queues/{queue_id}: + delete: + description: Delete an annotation queue by its ID. + operationId: DeleteLLMObsAnnotationQueue + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + responses: + "204": + description: No Content + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete an LLM Observability annotation queue + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + patch: + description: |- + Partially update an annotation queue. Only `name` and `description` can be updated. + operationId: UpdateLLMObsAnnotationQueue + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueUpdateRequest" + description: Update annotation queue payload. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update an LLM Observability annotation queue + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions: + get: + description: Retrieve all interactions and their annotations for a given annotation queue. + operationId: GetLLMObsAnnotatedInteractions + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionsResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get annotated queue interactions + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions: + post: + description: |- + Add one or more interactions (traces) to an annotation queue. + At least one interaction must be provided. + operationId: CreateLLMObsAnnotationQueueInteractions + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsRequest" + description: Add interactions payload. + required: true + responses: + "201": + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsResponse" + description: Created + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Add annotation queue interactions + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions/delete: + post: + description: Delete one or more interactions from an annotation queue. + operationId: DeleteLLMObsAnnotationQueueInteractions + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/LLMObsDeleteAnnotationQueueInteractionsRequest" + description: Delete interactions payload. + required: true + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete annotation queue interactions + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/llm-obs/v1/experiments: get: description: List all LLM Observability experiments sorted by creation date, newest first. @@ -115735,7 +116520,7 @@ tags: description: Find out more at url: "https://docs.datadoghq.com/account_management/api-app-keys/" name: Key Management - - description: Manage LLM Observability projects, datasets, dataset records, and experiments via the Experiments API. + - description: Manage LLM Observability projects, datasets, dataset records, experiments, and annotations. name: LLM Observability - description: |- Search your logs and send them to your Datadog platform over HTTP. See the [Log Management page](https://docs.datadoghq.com/logs/) for more information. diff --git a/examples/v2_llm-observability_CreateLLMObsAnnotationQueue.rs b/examples/v2_llm-observability_CreateLLMObsAnnotationQueue.rs new file mode 100644 index 0000000000..d2ea7df898 --- /dev/null +++ b/examples/v2_llm-observability_CreateLLMObsAnnotationQueue.rs @@ -0,0 +1,28 @@ +// Create an LLM Observability annotation queue returns "Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueDataAttributesRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueDataRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueType; + +#[tokio::main] +async fn main() { + let body = LLMObsAnnotationQueueRequest::new(LLMObsAnnotationQueueDataRequest::new( + LLMObsAnnotationQueueDataAttributesRequest::new( + "My annotation queue".to_string(), + "a33671aa-24fd-4dcd-9b33-a8ec7dde7751".to_string(), + ) + .description("Queue for annotating customer support traces".to_string()), + LLMObsAnnotationQueueType::QUEUES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateLLMObsAnnotationQueue", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api.create_llm_obs_annotation_queue(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_CreateLLMObsAnnotationQueueInteractions.rs b/examples/v2_llm-observability_CreateLLMObsAnnotationQueueInteractions.rs new file mode 100644 index 0000000000..e2b05a5b59 --- /dev/null +++ b/examples/v2_llm-observability_CreateLLMObsAnnotationQueueInteractions.rs @@ -0,0 +1,36 @@ +// Add annotation queue interactions returns "Created" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionItem; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionsDataRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionsRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionsType; +use datadog_api_client::datadogV2::model::LLMObsInteractionType; + +#[tokio::main] +async fn main() { + let body = LLMObsAnnotationQueueInteractionsRequest::new( + LLMObsAnnotationQueueInteractionsDataRequest::new( + LLMObsAnnotationQueueInteractionsDataAttributesRequest::new(vec![ + LLMObsAnnotationQueueInteractionItem::new( + "trace-abc-123".to_string(), + LLMObsInteractionType::TRACE, + ), + ]), + LLMObsAnnotationQueueInteractionsType::INTERACTIONS, + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.CreateLLMObsAnnotationQueueInteractions", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .create_llm_obs_annotation_queue_interactions("queue_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_DeleteLLMObsAnnotationQueue.rs b/examples/v2_llm-observability_DeleteLLMObsAnnotationQueue.rs new file mode 100644 index 0000000000..e61c63e641 --- /dev/null +++ b/examples/v2_llm-observability_DeleteLLMObsAnnotationQueue.rs @@ -0,0 +1,18 @@ +// Delete an LLM Observability annotation queue returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteLLMObsAnnotationQueue", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .delete_llm_obs_annotation_queue("queue_id".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_DeleteLLMObsAnnotationQueueInteractions.rs b/examples/v2_llm-observability_DeleteLLMObsAnnotationQueueInteractions.rs new file mode 100644 index 0000000000..068a18b653 --- /dev/null +++ b/examples/v2_llm-observability_DeleteLLMObsAnnotationQueueInteractions.rs @@ -0,0 +1,32 @@ +// Delete annotation queue interactions returns "No Content" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueInteractionsType; +use datadog_api_client::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest; +use datadog_api_client::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataRequest; +use datadog_api_client::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest; + +#[tokio::main] +async fn main() { + let body = LLMObsDeleteAnnotationQueueInteractionsRequest::new( + LLMObsDeleteAnnotationQueueInteractionsDataRequest::new( + LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest::new(vec![ + "00000000-0000-0000-0000-000000000000".to_string(), + "00000000-0000-0000-0000-000000000001".to_string(), + ]), + LLMObsAnnotationQueueInteractionsType::INTERACTIONS, + ), + ); + let mut configuration = datadog::Configuration::new(); + configuration + .set_unstable_operation_enabled("v2.DeleteLLMObsAnnotationQueueInteractions", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .delete_llm_obs_annotation_queue_interactions("queue_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_GetLLMObsAnnotatedInteractions.rs b/examples/v2_llm-observability_GetLLMObsAnnotatedInteractions.rs new file mode 100644 index 0000000000..342aa771ae --- /dev/null +++ b/examples/v2_llm-observability_GetLLMObsAnnotatedInteractions.rs @@ -0,0 +1,18 @@ +// Get annotated queue interactions returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetLLMObsAnnotatedInteractions", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .get_llm_obs_annotated_interactions("queue_id".to_string()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_ListLLMObsAnnotationQueues.rs b/examples/v2_llm-observability_ListLLMObsAnnotationQueues.rs new file mode 100644 index 0000000000..895565818c --- /dev/null +++ b/examples/v2_llm-observability_ListLLMObsAnnotationQueues.rs @@ -0,0 +1,19 @@ +// List LLM Observability annotation queues returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::api_llm_observability::ListLLMObsAnnotationQueuesOptionalParams; + +#[tokio::main] +async fn main() { + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListLLMObsAnnotationQueues", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .list_llm_obs_annotation_queues(ListLLMObsAnnotationQueuesOptionalParams::default()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_UpdateLLMObsAnnotationQueue.rs b/examples/v2_llm-observability_UpdateLLMObsAnnotationQueue.rs new file mode 100644 index 0000000000..c2cdaa35b5 --- /dev/null +++ b/examples/v2_llm-observability_UpdateLLMObsAnnotationQueue.rs @@ -0,0 +1,29 @@ +// Update an LLM Observability annotation queue returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueType; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueUpdateDataAttributesRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueUpdateDataRequest; +use datadog_api_client::datadogV2::model::LLMObsAnnotationQueueUpdateRequest; + +#[tokio::main] +async fn main() { + let body = + LLMObsAnnotationQueueUpdateRequest::new(LLMObsAnnotationQueueUpdateDataRequest::new( + LLMObsAnnotationQueueUpdateDataAttributesRequest::new() + .description("Updated description".to_string()) + .name("Updated queue name".to_string()), + LLMObsAnnotationQueueType::QUEUES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateLLMObsAnnotationQueue", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .update_llm_obs_annotation_queue("queue_id".to_string(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index eb6ed44853..f07df95eca 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -293,19 +293,32 @@ impl Default for Configuration { ("v2.update_jira_issue_template".to_owned(), false), ("v2.create_tenancy_config".to_owned(), false), ("v2.get_tenancy_configs".to_owned(), false), + ("v2.create_llm_obs_annotation_queue".to_owned(), false), + ( + "v2.create_llm_obs_annotation_queue_interactions".to_owned(), + false, + ), ("v2.create_llm_obs_dataset".to_owned(), false), ("v2.create_llm_obs_dataset_records".to_owned(), false), ("v2.create_llm_obs_experiment".to_owned(), false), ("v2.create_llm_obs_experiment_events".to_owned(), false), ("v2.create_llm_obs_project".to_owned(), false), + ("v2.delete_llm_obs_annotation_queue".to_owned(), false), + ( + "v2.delete_llm_obs_annotation_queue_interactions".to_owned(), + false, + ), ("v2.delete_llm_obs_dataset_records".to_owned(), false), ("v2.delete_llm_obs_datasets".to_owned(), false), ("v2.delete_llm_obs_experiments".to_owned(), false), ("v2.delete_llm_obs_projects".to_owned(), false), + ("v2.get_llm_obs_annotated_interactions".to_owned(), false), + ("v2.list_llm_obs_annotation_queues".to_owned(), false), ("v2.list_llm_obs_dataset_records".to_owned(), false), ("v2.list_llm_obs_datasets".to_owned(), false), ("v2.list_llm_obs_experiments".to_owned(), false), ("v2.list_llm_obs_projects".to_owned(), false), + ("v2.update_llm_obs_annotation_queue".to_owned(), false), ("v2.update_llm_obs_dataset".to_owned(), false), ("v2.update_llm_obs_dataset_records".to_owned(), false), ("v2.update_llm_obs_experiment".to_owned(), false), diff --git a/src/datadogV2/api/api_llm_observability.rs b/src/datadogV2/api/api_llm_observability.rs index 8f9887dc2b..f12b2e15e2 100644 --- a/src/datadogV2/api/api_llm_observability.rs +++ b/src/datadogV2/api/api_llm_observability.rs @@ -11,6 +11,29 @@ use reqwest::header::{HeaderMap, HeaderValue}; use serde::{Deserialize, Serialize}; use std::io::Write; +/// ListLLMObsAnnotationQueuesOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::list_llm_obs_annotation_queues`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListLLMObsAnnotationQueuesOptionalParams { + /// Filter annotation queues by project ID. Cannot be used together with `queueIds`. + pub project_id: Option, + /// Filter annotation queues by queue IDs (comma-separated). Cannot be used together with `projectId`. + pub queue_ids: Option>, +} + +impl ListLLMObsAnnotationQueuesOptionalParams { + /// Filter annotation queues by project ID. Cannot be used together with `queueIds`. + pub fn project_id(mut self, value: String) -> Self { + self.project_id = Some(value); + self + } + /// Filter annotation queues by queue IDs (comma-separated). Cannot be used together with `projectId`. + pub fn queue_ids(mut self, value: Vec) -> Self { + self.queue_ids = Some(value); + self + } +} + /// ListLLMObsDatasetRecordsOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::list_llm_obs_dataset_records`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -159,6 +182,24 @@ impl ListLLMObsProjectsOptionalParams { } } +/// CreateLLMObsAnnotationQueueError is a struct for typed errors of method [`LLMObservabilityAPI::create_llm_obs_annotation_queue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateLLMObsAnnotationQueueError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// CreateLLMObsAnnotationQueueInteractionsError is a struct for typed errors of method [`LLMObservabilityAPI::create_llm_obs_annotation_queue_interactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateLLMObsAnnotationQueueInteractionsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// CreateLLMObsDatasetError is a struct for typed errors of method [`LLMObservabilityAPI::create_llm_obs_dataset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -204,6 +245,24 @@ pub enum CreateLLMObsProjectError { UnknownValue(serde_json::Value), } +/// DeleteLLMObsAnnotationQueueError is a struct for typed errors of method [`LLMObservabilityAPI::delete_llm_obs_annotation_queue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteLLMObsAnnotationQueueError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// DeleteLLMObsAnnotationQueueInteractionsError is a struct for typed errors of method [`LLMObservabilityAPI::delete_llm_obs_annotation_queue_interactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteLLMObsAnnotationQueueInteractionsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// DeleteLLMObsDatasetRecordsError is a struct for typed errors of method [`LLMObservabilityAPI::delete_llm_obs_dataset_records`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -240,6 +299,24 @@ pub enum DeleteLLMObsProjectsError { UnknownValue(serde_json::Value), } +/// GetLLMObsAnnotatedInteractionsError is a struct for typed errors of method [`LLMObservabilityAPI::get_llm_obs_annotated_interactions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLLMObsAnnotatedInteractionsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListLLMObsAnnotationQueuesError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_annotation_queues`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListLLMObsAnnotationQueuesError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListLLMObsDatasetRecordsError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_dataset_records`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -276,6 +353,15 @@ pub enum ListLLMObsProjectsError { UnknownValue(serde_json::Value), } +/// UpdateLLMObsAnnotationQueueError is a struct for typed errors of method [`LLMObservabilityAPI::update_llm_obs_annotation_queue`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateLLMObsAnnotationQueueError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// UpdateLLMObsDatasetError is a struct for typed errors of method [`LLMObservabilityAPI::update_llm_obs_dataset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -312,7 +398,7 @@ pub enum UpdateLLMObsProjectError { UnknownValue(serde_json::Value), } -/// Manage LLM Observability projects, datasets, dataset records, and experiments via the Experiments API. +/// Manage LLM Observability projects, datasets, dataset records, experiments, and annotations. #[derive(Debug, Clone)] pub struct LLMObservabilityAPI { config: datadog::Configuration, @@ -386,17 +472,17 @@ impl LLMObservabilityAPI { Self { config, client } } - /// Create a new LLM Observability dataset within the specified project. - pub async fn create_llm_obs_dataset( + /// Create a new annotation queue. Only `name`, `project_id`, and `description` are accepted. + /// Fields such as `created_by`, `owned_by`, `created_at`, `modified_by`, and `modified_at` are inferred by the backend. + pub async fn create_llm_obs_annotation_queue( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsDatasetRequest, + body: crate::datadogV2::model::LLMObsAnnotationQueueRequest, ) -> Result< - crate::datadogV2::model::LLMObsDatasetResponse, - datadog::Error, + crate::datadogV2::model::LLMObsAnnotationQueueResponse, + datadog::Error, > { match self - .create_llm_obs_dataset_with_http_info(project_id, body) + .create_llm_obs_annotation_queue_with_http_info(body) .await { Ok(response_content) => { @@ -412,22 +498,22 @@ impl LLMObservabilityAPI { } } - /// Create a new LLM Observability dataset within the specified project. - pub async fn create_llm_obs_dataset_with_http_info( + /// Create a new annotation queue. Only `name`, `project_id`, and `description` are accepted. + /// Fields such as `created_by`, `owned_by`, `created_at`, `modified_by`, and `modified_at` are inferred by the backend. + pub async fn create_llm_obs_annotation_queue_with_http_info( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsDatasetRequest, + body: crate::datadogV2::model::LLMObsAnnotationQueueRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_llm_obs_dataset"; + let operation_id = "v2.create_llm_obs_annotation_queue"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_llm_obs_dataset' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_annotation_queue' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -435,9 +521,8 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id) + "{}/api/v2/llm-obs/v1/annotation-queues", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -531,7 +616,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -544,7 +629,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -555,18 +640,18 @@ impl LLMObservabilityAPI { } } - /// Append one or more records to an LLM Observability dataset. - pub async fn create_llm_obs_dataset_records( + /// Add one or more interactions (traces) to an annotation queue. + /// At least one interaction must be provided. + pub async fn create_llm_obs_annotation_queue_interactions( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRecordsRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsRequest, ) -> Result< - crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, - datadog::Error, + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsResponse, + datadog::Error, > { match self - .create_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) + .create_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body) .await { Ok(response_content) => { @@ -582,23 +667,26 @@ impl LLMObservabilityAPI { } } - /// Append one or more records to an LLM Observability dataset. - pub async fn create_llm_obs_dataset_records_with_http_info( + /// Add one or more interactions (traces) to an annotation queue. + /// At least one interaction must be provided. + pub async fn create_llm_obs_annotation_queue_interactions_with_http_info( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRecordsRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_llm_obs_dataset_records"; + let operation_id = "v2.create_llm_obs_annotation_queue_interactions"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_llm_obs_dataset_records' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_annotation_queue_interactions' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -606,10 +694,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -704,7 +791,7 @@ impl LLMObservabilityAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsResponse, >(&local_content) { Ok(e) => { @@ -717,7 +804,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -728,15 +815,19 @@ impl LLMObservabilityAPI { } } - /// Create a new LLM Observability experiment. - pub async fn create_llm_obs_experiment( + /// Create a new LLM Observability dataset within the specified project. + pub async fn create_llm_obs_dataset( &self, - body: crate::datadogV2::model::LLMObsExperimentRequest, + project_id: String, + body: crate::datadogV2::model::LLMObsDatasetRequest, ) -> Result< - crate::datadogV2::model::LLMObsExperimentResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetResponse, + datadog::Error, > { - match self.create_llm_obs_experiment_with_http_info(body).await { + match self + .create_llm_obs_dataset_with_http_info(project_id, body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -750,21 +841,22 @@ impl LLMObservabilityAPI { } } - /// Create a new LLM Observability experiment. - pub async fn create_llm_obs_experiment_with_http_info( + /// Create a new LLM Observability dataset within the specified project. + pub async fn create_llm_obs_dataset_with_http_info( &self, - body: crate::datadogV2::model::LLMObsExperimentRequest, + project_id: String, + body: crate::datadogV2::model::LLMObsDatasetRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_llm_obs_experiment"; + let operation_id = "v2.create_llm_obs_dataset"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_llm_obs_experiment' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_dataset' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -772,8 +864,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -867,7 +960,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -880,7 +973,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -891,35 +984,50 @@ impl LLMObservabilityAPI { } } - /// Push spans and metrics for an LLM Observability experiment. - pub async fn create_llm_obs_experiment_events( + /// Append one or more records to an LLM Observability dataset. + pub async fn create_llm_obs_dataset_records( &self, - experiment_id: String, - body: crate::datadogV2::model::LLMObsExperimentEventsRequest, - ) -> Result<(), datadog::Error> { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRecordsRequest, + ) -> Result< + crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, + datadog::Error, + > { match self - .create_llm_obs_experiment_events_with_http_info(experiment_id, body) + .create_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) .await { - Ok(_) => Ok(()), + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Push spans and metrics for an LLM Observability experiment. - pub async fn create_llm_obs_experiment_events_with_http_info( + /// Append one or more records to an LLM Observability dataset. + pub async fn create_llm_obs_dataset_records_with_http_info( &self, - experiment_id: String, - body: crate::datadogV2::model::LLMObsExperimentEventsRequest, - ) -> Result, datadog::Error> - { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRecordsRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.create_llm_obs_experiment_events"; + let operation_id = "v2.create_llm_obs_dataset_records"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_llm_obs_experiment_events' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_dataset_records' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -927,9 +1035,10 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments/{experiment_id}/events", + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", local_configuration.get_operation_host(operation_id), - experiment_id = datadog::urlencode(experiment_id) + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -937,7 +1046,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -1023,13 +1132,21 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::< + crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -1040,15 +1157,15 @@ impl LLMObservabilityAPI { } } - /// Create a new LLM Observability project. Returns the existing project if a name conflict occurs. - pub async fn create_llm_obs_project( + /// Create a new LLM Observability experiment. + pub async fn create_llm_obs_experiment( &self, - body: crate::datadogV2::model::LLMObsProjectRequest, + body: crate::datadogV2::model::LLMObsExperimentRequest, ) -> Result< - crate::datadogV2::model::LLMObsProjectResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentResponse, + datadog::Error, > { - match self.create_llm_obs_project_with_http_info(body).await { + match self.create_llm_obs_experiment_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -1062,21 +1179,21 @@ impl LLMObservabilityAPI { } } - /// Create a new LLM Observability project. Returns the existing project if a name conflict occurs. - pub async fn create_llm_obs_project_with_http_info( + /// Create a new LLM Observability experiment. + pub async fn create_llm_obs_experiment_with_http_info( &self, - body: crate::datadogV2::model::LLMObsProjectRequest, + body: crate::datadogV2::model::LLMObsExperimentRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.create_llm_obs_project"; + let operation_id = "v2.create_llm_obs_experiment"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_llm_obs_project' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_experiment' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -1084,7 +1201,7 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/projects", + "{}/api/v2/llm-obs/v1/experiments", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -1179,7 +1296,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -1192,7 +1309,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -1203,15 +1320,579 @@ impl LLMObservabilityAPI { } } - /// Delete one or more records from an LLM Observability dataset. - pub async fn delete_llm_obs_dataset_records( + /// Push spans and metrics for an LLM Observability experiment. + pub async fn create_llm_obs_experiment_events( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, - ) -> Result<(), datadog::Error> { - match self - .delete_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) + experiment_id: String, + body: crate::datadogV2::model::LLMObsExperimentEventsRequest, + ) -> Result<(), datadog::Error> { + match self + .create_llm_obs_experiment_events_with_http_info(experiment_id, body) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Push spans and metrics for an LLM Observability experiment. + pub async fn create_llm_obs_experiment_events_with_http_info( + &self, + experiment_id: String, + body: crate::datadogV2::model::LLMObsExperimentEventsRequest, + ) -> Result, datadog::Error> + { + let local_configuration = &self.config; + let operation_id = "v2.create_llm_obs_experiment_events"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_llm_obs_experiment_events' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/experiments/{experiment_id}/events", + local_configuration.get_operation_host(operation_id), + experiment_id = datadog::urlencode(experiment_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Create a new LLM Observability project. Returns the existing project if a name conflict occurs. + pub async fn create_llm_obs_project( + &self, + body: crate::datadogV2::model::LLMObsProjectRequest, + ) -> Result< + crate::datadogV2::model::LLMObsProjectResponse, + datadog::Error, + > { + match self.create_llm_obs_project_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Create a new LLM Observability project. Returns the existing project if a name conflict occurs. + pub async fn create_llm_obs_project_with_http_info( + &self, + body: crate::datadogV2::model::LLMObsProjectRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_llm_obs_project"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_llm_obs_project' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/projects", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete an annotation queue by its ID. + pub async fn delete_llm_obs_annotation_queue( + &self, + queue_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_annotation_queue_with_http_info(queue_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete an annotation queue by its ID. + pub async fn delete_llm_obs_annotation_queue_with_http_info( + &self, + queue_id: String, + ) -> Result, datadog::Error> + { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_annotation_queue"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_annotation_queue' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete one or more interactions from an annotation queue. + pub async fn delete_llm_obs_annotation_queue_interactions( + &self, + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete one or more interactions from an annotation queue. + pub async fn delete_llm_obs_annotation_queue_interactions_with_http_info( + &self, + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, + ) -> Result< + datadog::ResponseContent<()>, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_annotation_queue_interactions"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_annotation_queue_interactions' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions/delete", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete one or more records from an LLM Observability dataset. + pub async fn delete_llm_obs_dataset_records( + &self, + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) .await { Ok(_) => Ok(()), @@ -1633,7 +2314,269 @@ impl LLMObservabilityAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete one or more LLM Observability projects. + pub async fn delete_llm_obs_projects( + &self, + body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, + ) -> Result<(), datadog::Error> { + match self.delete_llm_obs_projects_with_http_info(body).await { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete one or more LLM Observability projects. + pub async fn delete_llm_obs_projects_with_http_info( + &self, + body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_projects"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_projects' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/projects/delete", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Retrieve all interactions and their annotations for a given annotation queue. + pub async fn get_llm_obs_annotated_interactions( + &self, + queue_id: String, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotatedInteractionsResponse, + datadog::Error, + > { + match self + .get_llm_obs_annotated_interactions_with_http_info(queue_id) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Retrieve all interactions and their annotations for a given annotation queue. + pub async fn get_llm_obs_annotated_interactions_with_http_info( + &self, + queue_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_annotated_interactions"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_llm_obs_annotated_interactions' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -1644,46 +2587,78 @@ impl LLMObservabilityAPI { } } - /// Delete one or more LLM Observability projects. - pub async fn delete_llm_obs_projects( + /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. + /// If neither is provided, all queues in the organization are returned. + pub async fn list_llm_obs_annotation_queues( &self, - body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, - ) -> Result<(), datadog::Error> { - match self.delete_llm_obs_projects_with_http_info(body).await { - Ok(_) => Ok(()), + params: ListLLMObsAnnotationQueuesOptionalParams, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotationQueuesResponse, + datadog::Error, + > { + match self + .list_llm_obs_annotation_queues_with_http_info(params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Delete one or more LLM Observability projects. - pub async fn delete_llm_obs_projects_with_http_info( + /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. + /// If neither is provided, all queues in the organization are returned. + pub async fn list_llm_obs_annotation_queues_with_http_info( &self, - body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, - ) -> Result, datadog::Error> { + params: ListLLMObsAnnotationQueuesOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_projects"; + let operation_id = "v2.list_llm_obs_annotation_queues"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_projects' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_annotation_queues' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let project_id = params.project_id; + let queue_ids = params.queue_ids; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/projects/delete", + "{}/api/v2/llm-obs/v1/annotation-queues", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = project_id { + local_req_builder = + local_req_builder.query(&[("projectId", &local_query_param.to_string())]); + }; + if let Some(ref local) = queue_ids { + for param in local { + local_req_builder = local_req_builder.query(&[("queueIds", ¶m.to_string())]); + } + }; // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -1713,52 +2688,6 @@ impl LLMObservabilityAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -1769,13 +2698,20 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -2357,6 +3293,175 @@ impl LLMObservabilityAPI { } } + /// Partially update an annotation queue. Only `name` and `description` can be updated. + pub async fn update_llm_obs_annotation_queue( + &self, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotationQueueResponse, + datadog::Error, + > { + match self + .update_llm_obs_annotation_queue_with_http_info(queue_id, body) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Partially update an annotation queue. Only `name` and `description` can be updated. + pub async fn update_llm_obs_annotation_queue_with_http_info( + &self, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.update_llm_obs_annotation_queue"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.update_llm_obs_annotation_queue' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Partially update an existing LLM Observability dataset within the specified project. pub async fn update_llm_obs_dataset( &self, diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 4a7f746e34..9100eabfc6 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -4224,6 +4224,66 @@ pub mod model_ip_allowlist_type; pub use self::model_ip_allowlist_type::IPAllowlistType; pub mod model_ip_allowlist_update_request; pub use self::model_ip_allowlist_update_request::IPAllowlistUpdateRequest; +pub mod model_llm_obs_annotation_queues_response; +pub use self::model_llm_obs_annotation_queues_response::LLMObsAnnotationQueuesResponse; +pub mod model_llm_obs_annotation_queue_data_response; +pub use self::model_llm_obs_annotation_queue_data_response::LLMObsAnnotationQueueDataResponse; +pub mod model_llm_obs_annotation_queue_data_attributes_response; +pub use self::model_llm_obs_annotation_queue_data_attributes_response::LLMObsAnnotationQueueDataAttributesResponse; +pub mod model_llm_obs_annotation_queue_type; +pub use self::model_llm_obs_annotation_queue_type::LLMObsAnnotationQueueType; +pub mod model_llm_obs_annotation_queue_request; +pub use self::model_llm_obs_annotation_queue_request::LLMObsAnnotationQueueRequest; +pub mod model_llm_obs_annotation_queue_data_request; +pub use self::model_llm_obs_annotation_queue_data_request::LLMObsAnnotationQueueDataRequest; +pub mod model_llm_obs_annotation_queue_data_attributes_request; +pub use self::model_llm_obs_annotation_queue_data_attributes_request::LLMObsAnnotationQueueDataAttributesRequest; +pub mod model_llm_obs_annotation_queue_response; +pub use self::model_llm_obs_annotation_queue_response::LLMObsAnnotationQueueResponse; +pub mod model_llm_obs_annotation_queue_update_request; +pub use self::model_llm_obs_annotation_queue_update_request::LLMObsAnnotationQueueUpdateRequest; +pub mod model_llm_obs_annotation_queue_update_data_request; +pub use self::model_llm_obs_annotation_queue_update_data_request::LLMObsAnnotationQueueUpdateDataRequest; +pub mod model_llm_obs_annotation_queue_update_data_attributes_request; +pub use self::model_llm_obs_annotation_queue_update_data_attributes_request::LLMObsAnnotationQueueUpdateDataAttributesRequest; +pub mod model_llm_obs_annotated_interactions_response; +pub use self::model_llm_obs_annotated_interactions_response::LLMObsAnnotatedInteractionsResponse; +pub mod model_llm_obs_annotated_interactions_data_response; +pub use self::model_llm_obs_annotated_interactions_data_response::LLMObsAnnotatedInteractionsDataResponse; +pub mod model_llm_obs_annotated_interactions_data_attributes_response; +pub use self::model_llm_obs_annotated_interactions_data_attributes_response::LLMObsAnnotatedInteractionsDataAttributesResponse; +pub mod model_llm_obs_annotated_interaction_item; +pub use self::model_llm_obs_annotated_interaction_item::LLMObsAnnotatedInteractionItem; +pub mod model_llm_obs_annotation_item; +pub use self::model_llm_obs_annotation_item::LLMObsAnnotationItem; +pub mod model_llm_obs_interaction_type; +pub use self::model_llm_obs_interaction_type::LLMObsInteractionType; +pub mod model_llm_obs_annotated_interactions_type; +pub use self::model_llm_obs_annotated_interactions_type::LLMObsAnnotatedInteractionsType; +pub mod model_llm_obs_annotation_queue_interactions_request; +pub use self::model_llm_obs_annotation_queue_interactions_request::LLMObsAnnotationQueueInteractionsRequest; +pub mod model_llm_obs_annotation_queue_interactions_data_request; +pub use self::model_llm_obs_annotation_queue_interactions_data_request::LLMObsAnnotationQueueInteractionsDataRequest; +pub mod model_llm_obs_annotation_queue_interactions_data_attributes_request; +pub use self::model_llm_obs_annotation_queue_interactions_data_attributes_request::LLMObsAnnotationQueueInteractionsDataAttributesRequest; +pub mod model_llm_obs_annotation_queue_interaction_item; +pub use self::model_llm_obs_annotation_queue_interaction_item::LLMObsAnnotationQueueInteractionItem; +pub mod model_llm_obs_annotation_queue_interactions_type; +pub use self::model_llm_obs_annotation_queue_interactions_type::LLMObsAnnotationQueueInteractionsType; +pub mod model_llm_obs_annotation_queue_interactions_response; +pub use self::model_llm_obs_annotation_queue_interactions_response::LLMObsAnnotationQueueInteractionsResponse; +pub mod model_llm_obs_annotation_queue_interactions_data_response; +pub use self::model_llm_obs_annotation_queue_interactions_data_response::LLMObsAnnotationQueueInteractionsDataResponse; +pub mod model_llm_obs_annotation_queue_interactions_data_attributes_response; +pub use self::model_llm_obs_annotation_queue_interactions_data_attributes_response::LLMObsAnnotationQueueInteractionsDataAttributesResponse; +pub mod model_llm_obs_annotation_queue_interaction_response_item; +pub use self::model_llm_obs_annotation_queue_interaction_response_item::LLMObsAnnotationQueueInteractionResponseItem; +pub mod model_llm_obs_delete_annotation_queue_interactions_request; +pub use self::model_llm_obs_delete_annotation_queue_interactions_request::LLMObsDeleteAnnotationQueueInteractionsRequest; +pub mod model_llm_obs_delete_annotation_queue_interactions_data_request; +pub use self::model_llm_obs_delete_annotation_queue_interactions_data_request::LLMObsDeleteAnnotationQueueInteractionsDataRequest; +pub mod model_llm_obs_delete_annotation_queue_interactions_data_attributes_request; +pub use self::model_llm_obs_delete_annotation_queue_interactions_data_attributes_request::LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest; pub mod model_llm_obs_experiments_response; pub use self::model_llm_obs_experiments_response::LLMObsExperimentsResponse; pub mod model_llm_obs_experiment_data_response; diff --git a/src/datadogV2/model/model_llm_obs_annotated_interaction_item.rs b/src/datadogV2/model/model_llm_obs_annotated_interaction_item.rs new file mode 100644 index 0000000000..d26001eeff --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotated_interaction_item.rs @@ -0,0 +1,138 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// An interaction with its associated annotations. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotatedInteractionItem { + /// List of annotations for this interaction. + #[serde(rename = "annotations")] + pub annotations: Vec, + /// Identifier of the content for this interaction. + #[serde(rename = "content_id")] + pub content_id: String, + /// Unique identifier of the interaction. + #[serde(rename = "id")] + pub id: String, + /// Type of interaction in an annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsInteractionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotatedInteractionItem { + pub fn new( + annotations: Vec, + content_id: String, + id: String, + type_: crate::datadogV2::model::LLMObsInteractionType, + ) -> LLMObsAnnotatedInteractionItem { + LLMObsAnnotatedInteractionItem { + annotations, + content_id, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotatedInteractionItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotatedInteractionItemVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotatedInteractionItemVisitor { + type Value = LLMObsAnnotatedInteractionItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut annotations: Option> = + None; + let mut content_id: Option = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "annotations" => { + annotations = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "content_id" => { + content_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsInteractionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let annotations = + annotations.ok_or_else(|| M::Error::missing_field("annotations"))?; + let content_id = content_id.ok_or_else(|| M::Error::missing_field("content_id"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotatedInteractionItem { + annotations, + content_id, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotatedInteractionItemVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotated_interactions_data_attributes_response.rs b/src/datadogV2/model/model_llm_obs_annotated_interactions_data_attributes_response.rs new file mode 100644 index 0000000000..7b6e1ea1e6 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotated_interactions_data_attributes_response.rs @@ -0,0 +1,98 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes containing the list of annotated interactions. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotatedInteractionsDataAttributesResponse { + /// List of interactions with their annotations. + #[serde(rename = "annotated_interactions")] + pub annotated_interactions: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotatedInteractionsDataAttributesResponse { + pub fn new( + annotated_interactions: Vec, + ) -> LLMObsAnnotatedInteractionsDataAttributesResponse { + LLMObsAnnotatedInteractionsDataAttributesResponse { + annotated_interactions, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotatedInteractionsDataAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotatedInteractionsDataAttributesResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotatedInteractionsDataAttributesResponseVisitor { + type Value = LLMObsAnnotatedInteractionsDataAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut annotated_interactions: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "annotated_interactions" => { + annotated_interactions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let annotated_interactions = annotated_interactions + .ok_or_else(|| M::Error::missing_field("annotated_interactions"))?; + + let content = LLMObsAnnotatedInteractionsDataAttributesResponse { + annotated_interactions, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotatedInteractionsDataAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotated_interactions_data_response.rs b/src/datadogV2/model/model_llm_obs_annotated_interactions_data_response.rs new file mode 100644 index 0000000000..8711a5f6b6 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotated_interactions_data_response.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for annotated interactions. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotatedInteractionsDataResponse { + /// Attributes containing the list of annotated interactions. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsAnnotatedInteractionsDataAttributesResponse, + /// The queue ID. + #[serde(rename = "id")] + pub id: String, + /// Resource type for annotated interactions. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotatedInteractionsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotatedInteractionsDataResponse { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotatedInteractionsDataAttributesResponse, + id: String, + type_: crate::datadogV2::model::LLMObsAnnotatedInteractionsType, + ) -> LLMObsAnnotatedInteractionsDataResponse { + LLMObsAnnotatedInteractionsDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotatedInteractionsDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotatedInteractionsDataResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotatedInteractionsDataResponseVisitor { + type Value = LLMObsAnnotatedInteractionsDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsAnnotatedInteractionsDataAttributesResponse, + > = None; + let mut id: Option = None; + let mut type_: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotatedInteractionsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotatedInteractionsDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotatedInteractionsDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotated_interactions_response.rs b/src/datadogV2/model/model_llm_obs_annotated_interactions_response.rs new file mode 100644 index 0000000000..4a8458fcd4 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotated_interactions_response.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing the annotated interactions for an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotatedInteractionsResponse { + /// Data object for annotated interactions. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotatedInteractionsDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotatedInteractionsResponse { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotatedInteractionsDataResponse, + ) -> LLMObsAnnotatedInteractionsResponse { + LLMObsAnnotatedInteractionsResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotatedInteractionsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotatedInteractionsResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotatedInteractionsResponseVisitor { + type Value = LLMObsAnnotatedInteractionsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::LLMObsAnnotatedInteractionsDataResponse, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotatedInteractionsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotatedInteractionsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotated_interactions_type.rs b/src/datadogV2/model/model_llm_obs_annotated_interactions_type.rs new file mode 100644 index 0000000000..b633c357ed --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotated_interactions_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsAnnotatedInteractionsType { + ANNOTATED_INTERACTIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsAnnotatedInteractionsType { + fn to_string(&self) -> String { + match self { + Self::ANNOTATED_INTERACTIONS => String::from("annotated_interactions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsAnnotatedInteractionsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotatedInteractionsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "annotated_interactions" => Self::ANNOTATED_INTERACTIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_item.rs b/src/datadogV2/model/model_llm_obs_annotation_item.rs new file mode 100644 index 0000000000..c2a6ce95df --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_item.rs @@ -0,0 +1,170 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single annotation on an interaction. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationItem { + /// Timestamp when the annotation was created. + #[serde(rename = "created_at")] + pub created_at: chrono::DateTime, + /// Identifier of the user who created the annotation. + #[serde(rename = "created_by")] + pub created_by: String, + /// Unique identifier of the annotation. + #[serde(rename = "id")] + pub id: String, + /// Identifier of the interaction this annotation belongs to. + #[serde(rename = "interaction_id")] + pub interaction_id: String, + /// The label values for this annotation. + #[serde(rename = "label_values")] + pub label_values: std::collections::BTreeMap, + /// Timestamp when the annotation was last modified. + #[serde(rename = "modified_at")] + pub modified_at: chrono::DateTime, + /// Identifier of the user who last modified the annotation. + #[serde(rename = "modified_by")] + pub modified_by: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationItem { + pub fn new( + created_at: chrono::DateTime, + created_by: String, + id: String, + interaction_id: String, + label_values: std::collections::BTreeMap, + modified_at: chrono::DateTime, + modified_by: String, + ) -> LLMObsAnnotationItem { + LLMObsAnnotationItem { + created_at, + created_by, + id, + interaction_id, + label_values, + modified_at, + modified_by, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationItemVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationItemVisitor { + type Value = LLMObsAnnotationItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option> = None; + let mut created_by: Option = None; + let mut id: Option = None; + let mut interaction_id: Option = None; + let mut label_values: Option< + std::collections::BTreeMap, + > = None; + let mut modified_at: Option> = None; + let mut modified_by: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "interaction_id" => { + interaction_id = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "label_values" => { + label_values = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let interaction_id = + interaction_id.ok_or_else(|| M::Error::missing_field("interaction_id"))?; + let label_values = + label_values.ok_or_else(|| M::Error::missing_field("label_values"))?; + let modified_at = + modified_at.ok_or_else(|| M::Error::missing_field("modified_at"))?; + let modified_by = + modified_by.ok_or_else(|| M::Error::missing_field("modified_by"))?; + + let content = LLMObsAnnotationItem { + created_at, + created_by, + id, + interaction_id, + label_values, + modified_at, + modified_by, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationItemVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_request.rs new file mode 100644 index 0000000000..77d176383b --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_request.rs @@ -0,0 +1,120 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueDataAttributesRequest { + /// Description of the annotation queue. + #[serde(rename = "description")] + pub description: Option, + /// Name of the annotation queue. + #[serde(rename = "name")] + pub name: String, + /// Identifier of the project this queue belongs to. + #[serde(rename = "project_id")] + pub project_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueDataAttributesRequest { + pub fn new(name: String, project_id: String) -> LLMObsAnnotationQueueDataAttributesRequest { + LLMObsAnnotationQueueDataAttributesRequest { + description: None, + name, + project_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueDataAttributesRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueDataAttributesRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueDataAttributesRequestVisitor { + type Value = LLMObsAnnotationQueueDataAttributesRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut name: Option = None; + let mut project_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + + let content = LLMObsAnnotationQueueDataAttributesRequest { + description, + name, + project_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueDataAttributesRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_response.rs new file mode 100644 index 0000000000..dc80550c5f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_data_attributes_response.rs @@ -0,0 +1,177 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueDataAttributesResponse { + /// Timestamp when the queue was created. + #[serde(rename = "created_at")] + pub created_at: chrono::DateTime, + /// Identifier of the user who created the queue. + #[serde(rename = "created_by")] + pub created_by: String, + /// Description of the annotation queue. + #[serde(rename = "description")] + pub description: String, + /// Timestamp when the queue was last modified. + #[serde(rename = "modified_at")] + pub modified_at: chrono::DateTime, + /// Identifier of the user who last modified the queue. + #[serde(rename = "modified_by")] + pub modified_by: String, + /// Name of the annotation queue. + #[serde(rename = "name")] + pub name: String, + /// Identifier of the user who owns the queue. + #[serde(rename = "owned_by")] + pub owned_by: String, + /// Identifier of the project this queue belongs to. + #[serde(rename = "project_id")] + pub project_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueDataAttributesResponse { + pub fn new( + created_at: chrono::DateTime, + created_by: String, + description: String, + modified_at: chrono::DateTime, + modified_by: String, + name: String, + owned_by: String, + project_id: String, + ) -> LLMObsAnnotationQueueDataAttributesResponse { + LLMObsAnnotationQueueDataAttributesResponse { + created_at, + created_by, + description, + modified_at, + modified_by, + name, + owned_by, + project_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueDataAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueDataAttributesResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueDataAttributesResponseVisitor { + type Value = LLMObsAnnotationQueueDataAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut created_at: Option> = None; + let mut created_by: Option = None; + let mut description: Option = None; + let mut modified_at: Option> = None; + let mut modified_by: Option = None; + let mut name: Option = None; + let mut owned_by: Option = None; + let mut project_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "created_at" => { + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_by" => { + created_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_at" => { + modified_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "modified_by" => { + modified_by = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "owned_by" => { + owned_by = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "project_id" => { + project_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let created_at = created_at.ok_or_else(|| M::Error::missing_field("created_at"))?; + let created_by = created_by.ok_or_else(|| M::Error::missing_field("created_by"))?; + let description = + description.ok_or_else(|| M::Error::missing_field("description"))?; + let modified_at = + modified_at.ok_or_else(|| M::Error::missing_field("modified_at"))?; + let modified_by = + modified_by.ok_or_else(|| M::Error::missing_field("modified_by"))?; + let name = name.ok_or_else(|| M::Error::missing_field("name"))?; + let owned_by = owned_by.ok_or_else(|| M::Error::missing_field("owned_by"))?; + let project_id = project_id.ok_or_else(|| M::Error::missing_field("project_id"))?; + + let content = LLMObsAnnotationQueueDataAttributesResponse { + created_at, + created_by, + description, + modified_at, + modified_by, + name, + owned_by, + project_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueDataAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_data_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_data_request.rs new file mode 100644 index 0000000000..4164dfa4d6 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_data_request.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for creating an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueDataRequest { + /// Attributes for creating an LLM Observability annotation queue. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesRequest, + /// Resource type of an LLM Observability annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueDataRequest { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesRequest, + type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + ) -> LLMObsAnnotationQueueDataRequest { + LLMObsAnnotationQueueDataRequest { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueDataRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueDataRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueDataRequestVisitor { + type Value = LLMObsAnnotationQueueDataRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesRequest, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueDataRequest { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueDataRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_data_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_data_response.rs new file mode 100644 index 0000000000..d5e0317520 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_data_response.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueDataResponse { + /// Attributes of an LLM Observability annotation queue. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesResponse, + /// Unique identifier of the annotation queue. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueDataResponse { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesResponse, + id: String, + type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + ) -> LLMObsAnnotationQueueDataResponse { + LLMObsAnnotationQueueDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueDataResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueDataResponseVisitor { + type Value = LLMObsAnnotationQueueDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsAnnotationQueueDataAttributesResponse, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_item.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_item.rs new file mode 100644 index 0000000000..4145b1b879 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_item.rs @@ -0,0 +1,113 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single interaction to add to an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionItem { + /// Identifier of the content (such as trace ID) for this interaction. + #[serde(rename = "content_id")] + pub content_id: String, + /// Type of interaction in an annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsInteractionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionItem { + pub fn new( + content_id: String, + type_: crate::datadogV2::model::LLMObsInteractionType, + ) -> LLMObsAnnotationQueueInteractionItem { + LLMObsAnnotationQueueInteractionItem { + content_id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionItemVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionItemVisitor { + type Value = LLMObsAnnotationQueueInteractionItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut content_id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "content_id" => { + content_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsInteractionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let content_id = content_id.ok_or_else(|| M::Error::missing_field("content_id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueInteractionItem { + content_id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionItemVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_response_item.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_response_item.rs new file mode 100644 index 0000000000..35702d1c6f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interaction_response_item.rs @@ -0,0 +1,137 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single interaction result. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionResponseItem { + /// Whether this interaction already existed in the queue. + #[serde(rename = "already_existed")] + pub already_existed: bool, + /// Identifier of the content for this interaction. + #[serde(rename = "content_id")] + pub content_id: String, + /// Unique identifier of the interaction. + #[serde(rename = "id")] + pub id: String, + /// Type of interaction in an annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsInteractionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionResponseItem { + pub fn new( + already_existed: bool, + content_id: String, + id: String, + type_: crate::datadogV2::model::LLMObsInteractionType, + ) -> LLMObsAnnotationQueueInteractionResponseItem { + LLMObsAnnotationQueueInteractionResponseItem { + already_existed, + content_id, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionResponseItem { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionResponseItemVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionResponseItemVisitor { + type Value = LLMObsAnnotationQueueInteractionResponseItem; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut already_existed: Option = None; + let mut content_id: Option = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "already_existed" => { + already_existed = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "content_id" => { + content_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsInteractionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let already_existed = + already_existed.ok_or_else(|| M::Error::missing_field("already_existed"))?; + let content_id = content_id.ok_or_else(|| M::Error::missing_field("content_id"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueInteractionResponseItem { + already_existed, + content_id, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionResponseItemVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_request.rs new file mode 100644 index 0000000000..5620db19b1 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_request.rs @@ -0,0 +1,98 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for adding interactions to an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsDataAttributesRequest { + /// List of interactions to add to the queue. Must contain at least one item. + #[serde(rename = "interactions")] + pub interactions: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsDataAttributesRequest { + pub fn new( + interactions: Vec, + ) -> LLMObsAnnotationQueueInteractionsDataAttributesRequest { + LLMObsAnnotationQueueInteractionsDataAttributesRequest { + interactions, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsDataAttributesRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsDataAttributesRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsDataAttributesRequestVisitor { + type Value = LLMObsAnnotationQueueInteractionsDataAttributesRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut interactions: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "interactions" => { + interactions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let interactions = + interactions.ok_or_else(|| M::Error::missing_field("interactions"))?; + + let content = LLMObsAnnotationQueueInteractionsDataAttributesRequest { + interactions, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsDataAttributesRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_response.rs new file mode 100644 index 0000000000..e30d5c579c --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_attributes_response.rs @@ -0,0 +1,98 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of the interaction addition response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsDataAttributesResponse { + /// List of interactions that were processed. + #[serde(rename = "interactions")] + pub interactions: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsDataAttributesResponse { + pub fn new( + interactions: Vec, + ) -> LLMObsAnnotationQueueInteractionsDataAttributesResponse { + LLMObsAnnotationQueueInteractionsDataAttributesResponse { + interactions, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsDataAttributesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsDataAttributesResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsDataAttributesResponseVisitor { + type Value = LLMObsAnnotationQueueInteractionsDataAttributesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut interactions: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "interactions" => { + interactions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let interactions = + interactions.ok_or_else(|| M::Error::missing_field("interactions"))?; + + let content = LLMObsAnnotationQueueInteractionsDataAttributesResponse { + interactions, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsDataAttributesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_request.rs new file mode 100644 index 0000000000..2277c6c619 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_request.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for adding interactions to an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsDataRequest { + /// Attributes for adding interactions to an annotation queue. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesRequest, + /// Resource type for annotation queue interactions. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsDataRequest { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesRequest, + type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + ) -> LLMObsAnnotationQueueInteractionsDataRequest { + LLMObsAnnotationQueueInteractionsDataRequest { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsDataRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsDataRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsDataRequestVisitor { + type Value = LLMObsAnnotationQueueInteractionsDataRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesRequest, + > = None; + let mut type_: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueInteractionsDataRequest { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsDataRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_response.rs new file mode 100644 index 0000000000..1d00c7f89f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_data_response.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for the interaction addition response. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsDataResponse { + /// Attributes of the interaction addition response. + #[serde(rename = "attributes")] + pub attributes: + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesResponse, + /// The queue ID the interactions were added to. + #[serde(rename = "id")] + pub id: String, + /// Resource type for annotation queue interactions. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsDataResponse { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataAttributesResponse, + id: String, + type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + ) -> LLMObsAnnotationQueueInteractionsDataResponse { + LLMObsAnnotationQueueInteractionsDataResponse { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsDataResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsDataResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsDataResponseVisitor { + type Value = LLMObsAnnotationQueueInteractionsDataResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = None; + let mut id: Option = None; + let mut type_: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueInteractionsDataResponse { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsDataResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_request.rs new file mode 100644 index 0000000000..8c178055fd --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_request.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to add interactions to an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsRequest { + /// Data object for adding interactions to an annotation queue. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataRequest, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataRequest, + ) -> LLMObsAnnotationQueueInteractionsRequest { + LLMObsAnnotationQueueInteractionsRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsRequestVisitor { + type Value = LLMObsAnnotationQueueInteractionsRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataRequest, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueueInteractionsRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_response.rs new file mode 100644 index 0000000000..b016c5207b --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_response.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing the result of adding interactions to an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueInteractionsResponse { + /// Data object for the interaction addition response. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueInteractionsResponse { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataResponse, + ) -> LLMObsAnnotationQueueInteractionsResponse { + LLMObsAnnotationQueueInteractionsResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueInteractionsResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueInteractionsResponseVisitor { + type Value = LLMObsAnnotationQueueInteractionsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsDataResponse, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueueInteractionsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueInteractionsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_type.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_type.rs new file mode 100644 index 0000000000..7e208b949b --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_interactions_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsAnnotationQueueInteractionsType { + INTERACTIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsAnnotationQueueInteractionsType { + fn to_string(&self) -> String { + match self { + Self::INTERACTIONS => String::from("interactions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsAnnotationQueueInteractionsType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueInteractionsType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "interactions" => Self::INTERACTIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_request.rs new file mode 100644 index 0000000000..2631a7876c --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_request.rs @@ -0,0 +1,95 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to create an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueRequest { + /// Data object for creating an LLM Observability annotation queue. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotationQueueDataRequest, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotationQueueDataRequest, + ) -> LLMObsAnnotationQueueRequest { + LLMObsAnnotationQueueRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueRequestVisitor { + type Value = LLMObsAnnotationQueueRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueueRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_response.rs new file mode 100644 index 0000000000..8d65dfd5ab --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_response.rs @@ -0,0 +1,95 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a single LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueResponse { + /// Data object for an LLM Observability annotation queue. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotationQueueDataResponse, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueResponse { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotationQueueDataResponse, + ) -> LLMObsAnnotationQueueResponse { + LLMObsAnnotationQueueResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueResponseVisitor { + type Value = LLMObsAnnotationQueueResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueueResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_type.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_type.rs new file mode 100644 index 0000000000..dcb08634e3 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsAnnotationQueueType { + QUEUES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsAnnotationQueueType { + fn to_string(&self) -> String { + match self { + Self::QUEUES => String::from("queues"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsAnnotationQueueType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "queues" => Self::QUEUES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_attributes_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_attributes_request.rs new file mode 100644 index 0000000000..a4bee29924 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_attributes_request.rs @@ -0,0 +1,123 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for updating an LLM Observability annotation queue. All fields are optional. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueUpdateDataAttributesRequest { + /// Updated description of the annotation queue. + #[serde(rename = "description")] + pub description: Option, + /// Updated name of the annotation queue. + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueUpdateDataAttributesRequest { + pub fn new() -> LLMObsAnnotationQueueUpdateDataAttributesRequest { + LLMObsAnnotationQueueUpdateDataAttributesRequest { + description: None, + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for LLMObsAnnotationQueueUpdateDataAttributesRequest { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueUpdateDataAttributesRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueUpdateDataAttributesRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueUpdateDataAttributesRequestVisitor { + type Value = LLMObsAnnotationQueueUpdateDataAttributesRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + let content = LLMObsAnnotationQueueUpdateDataAttributesRequest { + description, + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueUpdateDataAttributesRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_request.rs new file mode 100644 index 0000000000..633638da22 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_update_data_request.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for updating an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueUpdateDataRequest { + /// Attributes for updating an LLM Observability annotation queue. All fields are optional. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataAttributesRequest, + /// Resource type of an LLM Observability annotation queue. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueUpdateDataRequest { + pub fn new( + attributes: crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataAttributesRequest, + type_: crate::datadogV2::model::LLMObsAnnotationQueueType, + ) -> LLMObsAnnotationQueueUpdateDataRequest { + LLMObsAnnotationQueueUpdateDataRequest { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueUpdateDataRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueUpdateDataRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueUpdateDataRequestVisitor { + type Value = LLMObsAnnotationQueueUpdateDataRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataAttributesRequest, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsAnnotationQueueUpdateDataRequest { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueUpdateDataRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queue_update_request.rs b/src/datadogV2/model/model_llm_obs_annotation_queue_update_request.rs new file mode 100644 index 0000000000..5e5b578b06 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queue_update_request.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to update an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueueUpdateRequest { + /// Data object for updating an LLM Observability annotation queue. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataRequest, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueueUpdateRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataRequest, + ) -> LLMObsAnnotationQueueUpdateRequest { + LLMObsAnnotationQueueUpdateRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueueUpdateRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueueUpdateRequestVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueueUpdateRequestVisitor { + type Value = LLMObsAnnotationQueueUpdateRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::LLMObsAnnotationQueueUpdateDataRequest, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueueUpdateRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueueUpdateRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_annotation_queues_response.rs b/src/datadogV2/model/model_llm_obs_annotation_queues_response.rs new file mode 100644 index 0000000000..e757762f2f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_annotation_queues_response.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a list of LLM Observability annotation queues. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsAnnotationQueuesResponse { + /// List of annotation queues. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsAnnotationQueuesResponse { + pub fn new( + data: Vec, + ) -> LLMObsAnnotationQueuesResponse { + LLMObsAnnotationQueuesResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsAnnotationQueuesResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsAnnotationQueuesResponseVisitor; + impl<'a> Visitor<'a> for LLMObsAnnotationQueuesResponseVisitor { + type Value = LLMObsAnnotationQueuesResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + Vec, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsAnnotationQueuesResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsAnnotationQueuesResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_attributes_request.rs b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_attributes_request.rs new file mode 100644 index 0000000000..ae86fe1234 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_attributes_request.rs @@ -0,0 +1,97 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for deleting interactions from an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + /// List of interaction IDs to delete. Must contain at least one item. + #[serde(rename = "interaction_ids")] + pub interaction_ids: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + pub fn new( + interaction_ids: Vec, + ) -> LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + interaction_ids, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequestVisitor; + impl<'a> Visitor<'a> for LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequestVisitor { + type Value = LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut interaction_ids: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "interaction_ids" => { + interaction_ids = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let interaction_ids = + interaction_ids.ok_or_else(|| M::Error::missing_field("interaction_ids"))?; + + let content = LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest { + interaction_ids, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer + .deserialize_any(LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_request.rs b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_request.rs new file mode 100644 index 0000000000..fec27bc74e --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_data_request.rs @@ -0,0 +1,116 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for deleting interactions from an annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeleteAnnotationQueueInteractionsDataRequest { + /// Attributes for deleting interactions from an annotation queue. + #[serde(rename = "attributes")] + pub attributes: + crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest, + /// Resource type for annotation queue interactions. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeleteAnnotationQueueInteractionsDataRequest { + pub fn new( + attributes: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataAttributesRequest, + type_: crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + ) -> LLMObsDeleteAnnotationQueueInteractionsDataRequest { + LLMObsDeleteAnnotationQueueInteractionsDataRequest { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeleteAnnotationQueueInteractionsDataRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeleteAnnotationQueueInteractionsDataRequestVisitor; + impl<'a> Visitor<'a> for LLMObsDeleteAnnotationQueueInteractionsDataRequestVisitor { + type Value = LLMObsDeleteAnnotationQueueInteractionsDataRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = None; + let mut type_: Option< + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsAnnotationQueueInteractionsType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsDeleteAnnotationQueueInteractionsDataRequest { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsDeleteAnnotationQueueInteractionsDataRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_request.rs b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_request.rs new file mode 100644 index 0000000000..c82c9328ec --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_delete_annotation_queue_interactions_request.rs @@ -0,0 +1,96 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to delete interactions from an LLM Observability annotation queue. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeleteAnnotationQueueInteractionsRequest { + /// Data object for deleting interactions from an annotation queue. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataRequest, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeleteAnnotationQueueInteractionsRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataRequest, + ) -> LLMObsDeleteAnnotationQueueInteractionsRequest { + LLMObsDeleteAnnotationQueueInteractionsRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeleteAnnotationQueueInteractionsRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeleteAnnotationQueueInteractionsRequestVisitor; + impl<'a> Visitor<'a> for LLMObsDeleteAnnotationQueueInteractionsRequestVisitor { + type Value = LLMObsDeleteAnnotationQueueInteractionsRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option< + crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsDataRequest, + > = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsDeleteAnnotationQueueInteractionsRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsDeleteAnnotationQueueInteractionsRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_interaction_type.rs b/src/datadogV2/model/model_llm_obs_interaction_type.rs new file mode 100644 index 0000000000..3129ba29f1 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_interaction_type.rs @@ -0,0 +1,51 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsInteractionType { + TRACE, + EXPERIMENT_TRACE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsInteractionType { + fn to_string(&self) -> String { + match self { + Self::TRACE => String::from("trace"), + Self::EXPERIMENT_TRACE => String::from("experiment_trace"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsInteractionType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsInteractionType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "trace" => Self::TRACE, + "experiment_trace" => Self::EXPERIMENT_TRACE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/tests/scenarios/features/v2/llm_observability.feature b/tests/scenarios/features/v2/llm_observability.feature index f1a56f818d..a390628998 100644 --- a/tests/scenarios/features/v2/llm_observability.feature +++ b/tests/scenarios/features/v2/llm_observability.feature @@ -1,13 +1,40 @@ @endpoint(llm-observability) @endpoint(llm-observability-v2) Feature: LLM Observability - Manage LLM Observability projects, datasets, dataset records, and - experiments via the Experiments API. + Manage LLM Observability projects, datasets, dataset records, experiments, + and annotations. Background: Given a valid "apiKeyAuth" key in the system And a valid "appKeyAuth" key in the system And an instance of "LLMObservability" API + @generated @skip @team:DataDog/ml-observability + Scenario: Add annotation queue interactions returns "Bad Request" response + Given operation "CreateLLMObsAnnotationQueueInteractions" enabled + And new "CreateLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interactions": [{"content_id": "trace-abc-123", "type": "trace"}]}, "type": "interactions"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Add annotation queue interactions returns "Created" response + Given operation "CreateLLMObsAnnotationQueueInteractions" enabled + And new "CreateLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interactions": [{"content_id": "trace-abc-123", "type": "trace"}]}, "type": "interactions"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/ml-observability + Scenario: Add annotation queue interactions returns "Not Found" response + Given operation "CreateLLMObsAnnotationQueueInteractions" enabled + And new "CreateLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interactions": [{"content_id": "trace-abc-123", "type": "trace"}]}, "type": "interactions"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/ml-observability Scenario: Append records to an LLM Observability dataset returns "Bad Request" response Given operation "CreateLLMObsDatasetRecords" enabled @@ -48,6 +75,22 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: Create an LLM Observability annotation queue returns "Bad Request" response + Given operation "CreateLLMObsAnnotationQueue" enabled + And new "CreateLLMObsAnnotationQueue" request + And body with value {"data": {"attributes": {"description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "a33671aa-24fd-4dcd-9b33-a8ec7dde7751"}, "type": "queues"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Create an LLM Observability annotation queue returns "Created" response + Given operation "CreateLLMObsAnnotationQueue" enabled + And new "CreateLLMObsAnnotationQueue" request + And body with value {"data": {"attributes": {"description": "Queue for annotating customer support traces", "name": "My annotation queue", "project_id": "a33671aa-24fd-4dcd-9b33-a8ec7dde7751"}, "type": "queues"}} + When the request is sent + Then the response status is 201 Created + @generated @skip @team:DataDog/ml-observability Scenario: Create an LLM Observability dataset returns "Bad Request" response Given operation "CreateLLMObsDataset" enabled @@ -221,6 +264,87 @@ Feature: LLM Observability When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/ml-observability + Scenario: Delete an LLM Observability annotation queue returns "No Content" response + Given operation "DeleteLLMObsAnnotationQueue" enabled + And new "DeleteLLMObsAnnotationQueue" request + And request contains "queue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete an LLM Observability annotation queue returns "Not Found" response + Given operation "DeleteLLMObsAnnotationQueue" enabled + And new "DeleteLLMObsAnnotationQueue" request + And request contains "queue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete annotation queue interactions returns "Bad Request" response + Given operation "DeleteLLMObsAnnotationQueueInteractions" enabled + And new "DeleteLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interaction_ids": ["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001"]}, "type": "interactions"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete annotation queue interactions returns "No Content" response + Given operation "DeleteLLMObsAnnotationQueueInteractions" enabled + And new "DeleteLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interaction_ids": ["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001"]}, "type": "interactions"}} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete annotation queue interactions returns "Not Found" response + Given operation "DeleteLLMObsAnnotationQueueInteractions" enabled + And new "DeleteLLMObsAnnotationQueueInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"interaction_ids": ["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000001"]}, "type": "interactions"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Get annotated queue interactions returns "Bad Request" response + Given operation "GetLLMObsAnnotatedInteractions" enabled + And new "GetLLMObsAnnotatedInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Get annotated queue interactions returns "Not Found" response + Given operation "GetLLMObsAnnotatedInteractions" enabled + And new "GetLLMObsAnnotatedInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Get annotated queue interactions returns "OK" response + Given operation "GetLLMObsAnnotatedInteractions" enabled + And new "GetLLMObsAnnotatedInteractions" request + And request contains "queue_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/ml-observability + Scenario: List LLM Observability annotation queues returns "Bad Request" response + Given operation "ListLLMObsAnnotationQueues" enabled + And new "ListLLMObsAnnotationQueues" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: List LLM Observability annotation queues returns "OK" response + Given operation "ListLLMObsAnnotationQueues" enabled + And new "ListLLMObsAnnotationQueues" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: List LLM Observability dataset records returns "Bad Request" response Given operation "ListLLMObsDatasetRecords" enabled @@ -357,6 +481,33 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: Update an LLM Observability annotation queue returns "Bad Request" response + Given operation "UpdateLLMObsAnnotationQueue" enabled + And new "UpdateLLMObsAnnotationQueue" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Update an LLM Observability annotation queue returns "Not Found" response + Given operation "UpdateLLMObsAnnotationQueue" enabled + And new "UpdateLLMObsAnnotationQueue" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Update an LLM Observability annotation queue returns "OK" response + Given operation "UpdateLLMObsAnnotationQueue" enabled + And new "UpdateLLMObsAnnotationQueue" request + And request contains "queue_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"description": "Updated description", "name": "Updated queue name"}, "type": "queues"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Update an LLM Observability dataset returns "Bad Request" response Given operation "UpdateLLMObsDataset" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 02afc91a4b..078ced2bd8 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -3087,6 +3087,66 @@ "type": "idempotent" } }, + "ListLLMObsAnnotationQueues": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "CreateLLMObsAnnotationQueue": { + "tag": "LLM Observability", + "undo": { + "operationId": "DeleteLLMObsAnnotationQueue", + "parameters": [ + { + "name": "queue_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteLLMObsAnnotationQueue": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, + "UpdateLLMObsAnnotationQueue": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, + "GetLLMObsAnnotatedInteractions": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "CreateLLMObsAnnotationQueueInteractions": { + "tag": "LLM Observability", + "undo": { + "operationId": "DeleteLLMObsAnnotationQueueInteractions", + "parameters": [ + { + "name": "queue_id", + "source": "path.queue_id" + }, + { + "name": "body", + "template": "{\"data\": {\"type\": \"interactions\", \"attributes\": {\"interaction_ids\": [\"{{ data.attributes.interactions[0].id }}\"]}}}" + } + ], + "type": "unsafe" + } + }, + "DeleteLLMObsAnnotationQueueInteractions": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, "ListLLMObsExperiments": { "tag": "LLM Observability", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index a538507143..40d6f7cbff 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -4100,6 +4100,34 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.UpdateIPAllowlist".into(), test_v2_update_ip_allowlist); + world.function_mappings.insert( + "v2.ListLLMObsAnnotationQueues".into(), + test_v2_list_llm_obs_annotation_queues, + ); + world.function_mappings.insert( + "v2.CreateLLMObsAnnotationQueue".into(), + test_v2_create_llm_obs_annotation_queue, + ); + world.function_mappings.insert( + "v2.DeleteLLMObsAnnotationQueue".into(), + test_v2_delete_llm_obs_annotation_queue, + ); + world.function_mappings.insert( + "v2.UpdateLLMObsAnnotationQueue".into(), + test_v2_update_llm_obs_annotation_queue, + ); + world.function_mappings.insert( + "v2.GetLLMObsAnnotatedInteractions".into(), + test_v2_get_llm_obs_annotated_interactions, + ); + world.function_mappings.insert( + "v2.CreateLLMObsAnnotationQueueInteractions".into(), + test_v2_create_llm_obs_annotation_queue_interactions, + ); + world.function_mappings.insert( + "v2.DeleteLLMObsAnnotationQueueInteractions".into(), + test_v2_delete_llm_obs_annotation_queue_interactions, + ); world.function_mappings.insert( "v2.ListLLMObsExperiments".into(), test_v2_list_llm_obs_experiments, @@ -30672,6 +30700,219 @@ fn test_v2_update_ip_allowlist(world: &mut DatadogWorld, _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let project_id = _parameters + .get("projectId") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let queue_ids = _parameters + .get("queueIds") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = + datadogV2::api_llm_observability::ListLLMObsAnnotationQueuesOptionalParams::default(); + params.project_id = project_id; + params.queue_ids = queue_ids; + let response = match block_on(api.list_llm_obs_annotation_queues_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_llm_obs_annotation_queue( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_llm_obs_annotation_queue_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_llm_obs_annotation_queue( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let queue_id = serde_json::from_value(_parameters.get("queue_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_llm_obs_annotation_queue_with_http_info(queue_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_llm_obs_annotation_queue( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let queue_id = serde_json::from_value(_parameters.get("queue_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = + match block_on(api.update_llm_obs_annotation_queue_with_http_info(queue_id, body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_llm_obs_annotated_interactions( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let queue_id = serde_json::from_value(_parameters.get("queue_id").unwrap().clone()).unwrap(); + let response = match block_on(api.get_llm_obs_annotated_interactions_with_http_info(queue_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_llm_obs_annotation_queue_interactions( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let queue_id = serde_json::from_value(_parameters.get("queue_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.create_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_llm_obs_annotation_queue_interactions( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let queue_id = serde_json::from_value(_parameters.get("queue_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.delete_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_llm_obs_experiments( world: &mut DatadogWorld, _parameters: &HashMap,