diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 96018843d061..4b65adabc6a8 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -988,6 +988,14 @@ components: required: true schema: type: string + LLMObsAnnotationQueueInteractionIDPathParameter: + description: The ID of the interaction within the annotation queue. + example: "interaction-456" + in: path + name: interaction_id + required: true + schema: + type: string LLMObsDatasetIDPathParameter: description: The ID of the Agent Observability dataset. example: "9f64e5c7-dc5a-45c8-a17c-1b85f0bec97d" @@ -56046,14 +56054,14 @@ components: annotations: description: List of annotations for this interaction. items: - $ref: "#/components/schemas/LLMObsAnnotationItem" + $ref: "#/components/schemas/LLMObsAnnotationItemResponse" type: array can_annotate: description: Whether the current caller can annotate this interaction. example: true type: boolean content_id: - description: Upstream entity identifier (trace ID, session ID, or deterministic display_block ID). + description: Upstream entity identifier (trace ID, session ID, or deterministic display_block or frontend ID). example: "trace-abc-123" type: string created_at: @@ -56063,6 +56071,8 @@ components: type: string display_block: $ref: "#/components/schemas/LLMObsContentBlocks" + frontend: + $ref: "#/components/schemas/LLMObsFrontendContent" id: description: Unique identifier of the interaction. example: "interaction-456" @@ -56093,11 +56103,44 @@ components: - can_annotate - annotations type: object + LLMObsAnnotatedInteractionDataAttributesResponse: + description: Attributes containing the annotated interaction. + properties: + annotated_interaction: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionItem" + required: + - annotated_interaction + type: object + LLMObsAnnotatedInteractionDataResponse: + description: Data object for a single annotated interaction. + properties: + attributes: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionDataAttributesResponse" + id: + description: The annotation queue ID. + example: "00000000-0000-0000-0000-000000000001" + type: string + type: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionsType" + required: + - id + - type + - attributes + type: object LLMObsAnnotatedInteractionItem: description: An interaction with its associated annotations. oneOf: - $ref: "#/components/schemas/LLMObsTraceAnnotatedInteractionItem" - $ref: "#/components/schemas/LLMObsDisplayBlockAnnotatedInteractionItem" + - $ref: "#/components/schemas/LLMObsFrontendAnnotatedInteractionItem" + LLMObsAnnotatedInteractionResponse: + description: Response containing a single annotated interaction. + properties: + data: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionDataResponse" + required: + - data + type: object LLMObsAnnotatedInteractionsByTraceDataAttributesResponse: description: Attributes of the cross-queue annotated interactions response. properties: @@ -56236,51 +56279,6 @@ components: type: string x-enum-varnames: - PERMISSION_DENIED - 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: Label values for this annotation. - example: - - label_schema_id: "abc-123" - value: "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 LLMObsAnnotationItemResponse: description: A single annotation on an interaction, as returned by the API. properties: @@ -56539,11 +56537,13 @@ components: oneOf: - $ref: "#/components/schemas/LLMObsTraceInteractionItem" - $ref: "#/components/schemas/LLMObsDisplayBlockInteractionItem" + - $ref: "#/components/schemas/LLMObsFrontendInteractionItem" LLMObsAnnotationQueueInteractionResponseItem: description: A single interaction result. oneOf: - $ref: "#/components/schemas/LLMObsTraceInteractionResponseItem" - $ref: "#/components/schemas/LLMObsDisplayBlockInteractionResponseItem" + - $ref: "#/components/schemas/LLMObsFrontendInteractionResponseItem" LLMObsAnnotationQueueInteractionsDataAttributesRequest: description: Attributes for adding interactions to an annotation queue. properties: @@ -56915,6 +56915,7 @@ components: - experiment_trace - session - display_block + - frontend example: trace type: string x-enum-varnames: @@ -56922,6 +56923,7 @@ components: - EXPERIMENT_TRACE - SESSION - DISPLAY_BLOCK + - FRONTEND LLMObsAzureOpenAIMetadata: description: Azure OpenAI-specific metadata for an integration account or inference request. properties: @@ -58619,7 +58621,7 @@ components: annotations: description: List of annotations for this interaction. items: - $ref: "#/components/schemas/LLMObsAnnotationItem" + $ref: "#/components/schemas/LLMObsAnnotationItemResponse" type: array can_annotate: description: Whether the current caller can annotate this interaction. @@ -59900,6 +59902,96 @@ components: required: - data type: object + LLMObsFrontendAnnotatedInteractionItem: + description: A frontend interaction with its associated annotations. + properties: + annotations: + description: List of annotations for this interaction. + items: + $ref: "#/components/schemas/LLMObsAnnotationItemResponse" + type: array + can_annotate: + description: Whether the current caller can annotate this interaction. + example: true + type: boolean + content_id: + description: Server-generated deterministic identifier derived from the content. + example: "9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2" + type: string + frontend: + $ref: "#/components/schemas/LLMObsFrontendContent" + id: + description: Unique identifier of the interaction. + example: "interaction-456" + type: string + type: + $ref: "#/components/schemas/LLMObsFrontendInteractionType" + required: + - id + - type + - content_id + - can_annotate + - annotations + - frontend + type: object + LLMObsFrontendContent: + description: Web content that makes up a `frontend` interaction. + properties: + code: + description: Caller-provided web content. + example: "
Hello world
" + type: string + required: + - code + type: object + LLMObsFrontendInteractionItem: + description: |- + An interaction whose rendered content is supplied directly as web + content. The server generates `content_id` deterministically from the + content. + properties: + frontend: + $ref: "#/components/schemas/LLMObsFrontendContent" + type: + $ref: "#/components/schemas/LLMObsFrontendInteractionType" + required: + - type + - frontend + type: object + LLMObsFrontendInteractionResponseItem: + description: A frontend interaction result. + properties: + already_existed: + description: Whether this interaction already existed in the queue. + example: false + type: boolean + content_id: + description: Server-generated deterministic identifier derived from the content. + example: "9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2" + type: string + frontend: + $ref: "#/components/schemas/LLMObsFrontendContent" + id: + description: Unique identifier of the interaction. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/LLMObsFrontendInteractionType" + required: + - id + - type + - content_id + - already_existed + - frontend + type: object + LLMObsFrontendInteractionType: + description: Type discriminator for a `frontend` interaction. + enum: + - frontend + example: frontend + type: string + x-enum-varnames: + - FRONTEND LLMObsInferenceCode: description: A generated code snippet for running an inference request programmatically. properties: @@ -62630,7 +62722,7 @@ components: annotations: description: List of annotations for this interaction. items: - $ref: "#/components/schemas/LLMObsAnnotationItem" + $ref: "#/components/schemas/LLMObsAnnotationItemResponse" type: array can_annotate: description: Whether the current caller can annotate this interaction. @@ -166054,6 +166146,70 @@ paths: 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/{interaction_id}: + get: + description: Retrieve a single interaction (trace, session, display block, or frontend content) and its annotations for a given annotation queue. + operationId: GetLLMObsAnnotatedInteraction + parameters: + - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" + - $ref: "#/components/parameters/LLMObsAnnotationQueueInteractionIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + annotated_interaction: + annotations: [] + can_annotate: true + content_id: trace-abc-123 + created_at: "2024-01-15T10:30:00Z" + id: interaction-456 + modified_at: "2024-01-15T10:30:00Z" + type: trace + id: 00000000-0000-0000-0000-000000000001 + type: annotated_interactions + schema: + $ref: "#/components/schemas/LLMObsAnnotatedInteractionResponse" + 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 an annotated queue interaction + tags: + - Agent 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}/annotations: post: description: |- @@ -166263,6 +166419,9 @@ paths: - `display_block`: omit `content_id` and provide the rendered content in `display_block`. The server generates `content_id` as a deterministic hash of the block list. + - `frontend`: omit `content_id` and provide the web content in + `frontend`. The server returns a deterministic `content_id` for the + content. Items of different types can be mixed in a single request. operationId: CreateLLMObsAnnotationQueueInteractions @@ -166298,6 +166457,16 @@ paths: type: json type: display_block type: interactions + frontend: + summary: Add a frontend interaction + value: + data: + attributes: + interactions: + - frontend: + code: "
Hello world
" + type: frontend + type: interactions schema: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsRequest" description: Add interactions payload. @@ -166333,6 +166502,20 @@ paths: type: display_block id: 00000000-0000-0000-0000-000000000001 type: interactions + frontend: + summary: frontend response + value: + data: + attributes: + interactions: + - already_existed: false + content_id: 9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2 + frontend: + code: "
Hello world
" + id: 00000000-0000-0000-0000-000000000000 + type: frontend + id: 00000000-0000-0000-0000-000000000001 + type: interactions schema: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsResponse" description: Created diff --git a/examples/v2/agent-observability/GetLLMObsAnnotatedInteraction.ts b/examples/v2/agent-observability/GetLLMObsAnnotatedInteraction.ts new file mode 100644 index 000000000000..1608d38460c8 --- /dev/null +++ b/examples/v2/agent-observability/GetLLMObsAnnotatedInteraction.ts @@ -0,0 +1,23 @@ +/** + * Get an annotated queue interaction returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +configuration.unstableOperations["v2.getLLMObsAnnotatedInteraction"] = true; +const apiInstance = new v2.AgentObservabilityApi(configuration); + +const params: v2.AgentObservabilityApiGetLLMObsAnnotatedInteractionRequest = { + queueId: "queue_id", + interactionId: "interaction_id", +}; + +apiInstance + .getLLMObsAnnotatedInteraction(params) + .then((data: v2.LLMObsAnnotatedInteractionResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/generated-test/test-server b/features/generated-test/test-server index 899230cbccd5..a7224b2c64cd 100755 --- a/features/generated-test/test-server +++ b/features/generated-test/test-server @@ -16,7 +16,7 @@ import re import tempfile import threading import uuid -from datetime import datetime, timezone +from datetime import UTC, datetime from http import HTTPStatus from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path @@ -435,7 +435,8 @@ def _json_contains(actual: Any, expected: Any) -> bool: return all(key in actual and _json_contains(actual[key], value) for key, value in expected.items()) if isinstance(expected, list) and isinstance(actual, list): return len(expected) == len(actual) and all( - _json_contains(actual_item, expected_item) for actual_item, expected_item in zip(actual, expected) + _json_contains(actual_item, expected_item) + for actual_item, expected_item in zip(actual, expected, strict=False) ) return actual == expected @@ -460,7 +461,7 @@ def _slug(value: str) -> str: def _now_iso() -> str: - return datetime.now(timezone.utc).isoformat().replace("+00:00", "Z") + return datetime.now(UTC).isoformat().replace("+00:00", "Z") def _read_json(path: Path) -> dict[str, Any]: diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 52cbb0657038..a77a2c821abc 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -2614,6 +2614,17 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "LLMObsAnnotatedInteractionsResponse", }, + "v2.GetLLMObsAnnotatedInteraction": { + "queueId": { + "type": "string", + "format": "", + }, + "interactionId": { + "type": "string", + "format": "", + }, + "operationResponseType": "LLMObsAnnotatedInteractionResponse", + }, "v2.UpsertLLMObsAnnotations": { "queueId": { "type": "string", diff --git a/features/v2/agent_observability.feature b/features/v2/agent_observability.feature index acf08cf0dd89..3136a1312f52 100644 --- a/features/v2/agent_observability.feature +++ b/features/v2/agent_observability.feature @@ -782,6 +782,33 @@ Feature: Agent Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: Get an annotated queue interaction returns "Bad Request" response + Given operation "GetLLMObsAnnotatedInteraction" enabled + And new "GetLLMObsAnnotatedInteraction" request + And request contains "queue_id" parameter from "REPLACE.ME" + And request contains "interaction_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 an annotated queue interaction returns "Not Found" response + Given operation "GetLLMObsAnnotatedInteraction" enabled + And new "GetLLMObsAnnotatedInteraction" request + And request contains "queue_id" parameter from "REPLACE.ME" + And request contains "interaction_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 an annotated queue interaction returns "OK" response + Given operation "GetLLMObsAnnotatedInteraction" enabled + And new "GetLLMObsAnnotatedInteraction" request + And request contains "queue_id" parameter from "REPLACE.ME" + And request contains "interaction_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Get annotated interactions by content IDs returns "Bad Request" response Given operation "GetLLMObsAnnotatedInteractionsByTraceIDs" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 535ebca0b11d..f73a9089c8e2 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -4636,6 +4636,12 @@ "type": "safe" } }, + "GetLLMObsAnnotatedInteraction": { + "tag": "Agent Observability", + "undo": { + "type": "safe" + } + }, "UpsertLLMObsAnnotations": { "tag": "Agent Observability", "undo": { diff --git a/packages/datadog-api-client-common/configuration.ts b/packages/datadog-api-client-common/configuration.ts index 29587e955555..b1c7f77842d9 100644 --- a/packages/datadog-api-client-common/configuration.ts +++ b/packages/datadog-api-client-common/configuration.ts @@ -260,6 +260,7 @@ export function createConfiguration( "v2.deleteLLMObsProjects": false, "v2.deleteLLMObsPrompt": false, "v2.exportLLMObsDataset": false, + "v2.getLLMObsAnnotatedInteraction": false, "v2.getLLMObsAnnotatedInteractions": false, "v2.getLLMObsAnnotatedInteractionsByTraceIDs": false, "v2.getLLMObsAnnotationQueueLabelSchema": false, diff --git a/packages/datadog-api-client-v2/apis/AgentObservabilityApi.ts b/packages/datadog-api-client-v2/apis/AgentObservabilityApi.ts index e1ebea5dbdba..32ffdcc2ec62 100644 --- a/packages/datadog-api-client-v2/apis/AgentObservabilityApi.ts +++ b/packages/datadog-api-client-v2/apis/AgentObservabilityApi.ts @@ -21,6 +21,7 @@ import { ApiException } from "../../datadog-api-client-common/exception"; import { APIErrorResponse } from "../models/APIErrorResponse"; import { JSONAPIErrorResponse } from "../models/JSONAPIErrorResponse"; +import { LLMObsAnnotatedInteractionResponse } from "../models/LLMObsAnnotatedInteractionResponse"; import { LLMObsAnnotatedInteractionsByTraceResponse } from "../models/LLMObsAnnotatedInteractionsByTraceResponse"; import { LLMObsAnnotatedInteractionsResponse } from "../models/LLMObsAnnotatedInteractionsResponse"; import { LLMObsAnnotationQueueInteractionsRequest } from "../models/LLMObsAnnotationQueueInteractionsRequest"; @@ -1529,6 +1530,57 @@ export class AgentObservabilityApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async getLLMObsAnnotatedInteraction( + queueId: string, + interactionId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + logger.warn("Using unstable operation 'getLLMObsAnnotatedInteraction'"); + if (!_config.unstableOperations["v2.getLLMObsAnnotatedInteraction"]) { + throw new Error( + "Unstable operation 'getLLMObsAnnotatedInteraction' is disabled" + ); + } + + // verify required parameter 'queueId' is not null or undefined + if (queueId === null || queueId === undefined) { + throw new RequiredError("queueId", "getLLMObsAnnotatedInteraction"); + } + + // verify required parameter 'interactionId' is not null or undefined + if (interactionId === null || interactionId === undefined) { + throw new RequiredError("interactionId", "getLLMObsAnnotatedInteraction"); + } + + // Path Params + const localVarPath = + "/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions/{interaction_id}" + .replace("{queue_id}", encodeURIComponent(String(queueId))) + .replace("{interaction_id}", encodeURIComponent(String(interactionId))); + + // Make Request Context + const requestContext = _config + .getServer("v2.AgentObservabilityApi.getLLMObsAnnotatedInteraction") + .makeRequestContext(localVarPath, HttpMethod.GET); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set IaC header + if (_config.isIaC) { + requestContext.setHeaderParam("X-Datadog-Managed-By", "iac"); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async getLLMObsAnnotatedInteractions( queueId: string, _options?: Configuration @@ -6432,6 +6484,94 @@ export class AgentObservabilityApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getLLMObsAnnotatedInteraction + * @throws ApiException if the response code was not in [200, 299] + */ + public async getLLMObsAnnotatedInteraction( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: LLMObsAnnotatedInteractionResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "LLMObsAnnotatedInteractionResponse" + ) as LLMObsAnnotatedInteractionResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 401 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: JSONAPIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "JSONAPIErrorResponse" + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException( + response.httpStatusCode, + body + ); + } + if (response.httpStatusCode === 429) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: LLMObsAnnotatedInteractionResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "LLMObsAnnotatedInteractionResponse", + "" + ) as LLMObsAnnotatedInteractionResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -10847,6 +10987,19 @@ export interface AgentObservabilityApiExportLLMObsDatasetRequest { version?: number; } +export interface AgentObservabilityApiGetLLMObsAnnotatedInteractionRequest { + /** + * The ID of the Agent Observability annotation queue. + * @type string + */ + queueId: string; + /** + * The ID of the interaction within the annotation queue. + * @type string + */ + interactionId: string; +} + export interface AgentObservabilityApiGetLLMObsAnnotatedInteractionsRequest { /** * The ID of the Agent Observability annotation queue. @@ -11689,6 +11842,9 @@ export class AgentObservabilityApi { * - `display_block`: omit `content_id` and provide the rendered content * in `display_block`. The server generates `content_id` as a * deterministic hash of the block list. + * - `frontend`: omit `content_id` and provide the web content in + * `frontend`. The server returns a deterministic `content_id` for the + * content. * * Items of different types can be mixed in a single request. * @param param The request object @@ -12149,6 +12305,31 @@ export class AgentObservabilityApi { }); } + /** + * Retrieve a single interaction (trace, session, display block, or frontend content) and its annotations for a given annotation queue. + * @param param The request object + */ + public getLLMObsAnnotatedInteraction( + param: AgentObservabilityApiGetLLMObsAnnotatedInteractionRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.getLLMObsAnnotatedInteraction( + param.queueId, + param.interactionId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getLLMObsAnnotatedInteraction( + responseContext + ); + }); + }); + } + /** * Retrieve all interactions (traces and sessions) and their annotations for a given annotation queue. * @param param The request object diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index 5d90143066e3..3b4d3d019808 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -94,6 +94,7 @@ export { AgentObservabilityApiDeleteLLMObsProjectsRequest, AgentObservabilityApiDeleteLLMObsPromptRequest, AgentObservabilityApiExportLLMObsDatasetRequest, + AgentObservabilityApiGetLLMObsAnnotatedInteractionRequest, AgentObservabilityApiGetLLMObsAnnotatedInteractionsRequest, AgentObservabilityApiGetLLMObsAnnotatedInteractionsByTraceIDsRequest, AgentObservabilityApiGetLLMObsAnnotationQueueLabelSchemaRequest, @@ -5398,7 +5399,10 @@ export { ListWorkflowsResponse } from "./models/ListWorkflowsResponse"; export { ListWorkflowsResponseMeta } from "./models/ListWorkflowsResponseMeta"; export { ListWorkflowsResponseMetaPage } from "./models/ListWorkflowsResponseMetaPage"; export { LLMObsAnnotatedInteractionByTraceItem } from "./models/LLMObsAnnotatedInteractionByTraceItem"; +export { LLMObsAnnotatedInteractionDataAttributesResponse } from "./models/LLMObsAnnotatedInteractionDataAttributesResponse"; +export { LLMObsAnnotatedInteractionDataResponse } from "./models/LLMObsAnnotatedInteractionDataResponse"; export { LLMObsAnnotatedInteractionItem } from "./models/LLMObsAnnotatedInteractionItem"; +export { LLMObsAnnotatedInteractionResponse } from "./models/LLMObsAnnotatedInteractionResponse"; export { LLMObsAnnotatedInteractionsByTraceDataAttributesResponse } from "./models/LLMObsAnnotatedInteractionsByTraceDataAttributesResponse"; export { LLMObsAnnotatedInteractionsByTraceDataResponse } from "./models/LLMObsAnnotatedInteractionsByTraceDataResponse"; export { LLMObsAnnotatedInteractionsByTraceResponse } from "./models/LLMObsAnnotatedInteractionsByTraceResponse"; @@ -5410,7 +5414,6 @@ export { LLMObsAnnotatedInteractionsType } from "./models/LLMObsAnnotatedInterac export { LLMObsAnnotationAssessment } from "./models/LLMObsAnnotationAssessment"; export { LLMObsAnnotationError } from "./models/LLMObsAnnotationError"; export { LLMObsAnnotationErrorCode } from "./models/LLMObsAnnotationErrorCode"; -export { LLMObsAnnotationItem } from "./models/LLMObsAnnotationItem"; export { LLMObsAnnotationItemResponse } from "./models/LLMObsAnnotationItemResponse"; export { LLMObsAnnotationLabelValue } from "./models/LLMObsAnnotationLabelValue"; export { LLMObsAnnotationLabelValueResponse } from "./models/LLMObsAnnotationLabelValueResponse"; @@ -5633,6 +5636,11 @@ export { LLMObsExperimentUpdateDataAttributesRequest } from "./models/LLMObsExpe export { LLMObsExperimentUpdateDataRequest } from "./models/LLMObsExperimentUpdateDataRequest"; export { LLMObsExperimentUpdateRequest } from "./models/LLMObsExperimentUpdateRequest"; export { LLMObsExperimentUser } from "./models/LLMObsExperimentUser"; +export { LLMObsFrontendAnnotatedInteractionItem } from "./models/LLMObsFrontendAnnotatedInteractionItem"; +export { LLMObsFrontendContent } from "./models/LLMObsFrontendContent"; +export { LLMObsFrontendInteractionItem } from "./models/LLMObsFrontendInteractionItem"; +export { LLMObsFrontendInteractionResponseItem } from "./models/LLMObsFrontendInteractionResponseItem"; +export { LLMObsFrontendInteractionType } from "./models/LLMObsFrontendInteractionType"; export { LLMObsInferenceCode } from "./models/LLMObsInferenceCode"; export { LLMObsInferenceContent } from "./models/LLMObsInferenceContent"; export { LLMObsInferenceContentValue } from "./models/LLMObsInferenceContentValue"; diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionByTraceItem.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionByTraceItem.ts index 888aec155675..601bcf761e39 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionByTraceItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionByTraceItem.ts @@ -3,9 +3,10 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ -import { LLMObsAnnotationItem } from "./LLMObsAnnotationItem"; +import { LLMObsAnnotationItemResponse } from "./LLMObsAnnotationItemResponse"; import { LLMObsAnyInteractionType } from "./LLMObsAnyInteractionType"; import { LLMObsContentBlock } from "./LLMObsContentBlock"; +import { LLMObsFrontendContent } from "./LLMObsFrontendContent"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -16,13 +17,13 @@ export class LLMObsAnnotatedInteractionByTraceItem { /** * List of annotations for this interaction. */ - "annotations": Array; + "annotations": Array; /** * Whether the current caller can annotate this interaction. */ "canAnnotate": boolean; /** - * Upstream entity identifier (trace ID, session ID, or deterministic display_block ID). + * Upstream entity identifier (trace ID, session ID, or deterministic display_block or frontend ID). */ "contentId": string; /** @@ -34,6 +35,10 @@ export class LLMObsAnnotatedInteractionByTraceItem { * Must contain at least one block. */ "displayBlock"?: Array; + /** + * Web content that makes up a `frontend` interaction. + */ + "frontend"?: LLMObsFrontendContent; /** * Unique identifier of the interaction. */ @@ -73,7 +78,7 @@ export class LLMObsAnnotatedInteractionByTraceItem { static readonly attributeTypeMap: AttributeTypeMap = { annotations: { baseName: "annotations", - type: "Array", + type: "Array", required: true, }, canAnnotate: { @@ -96,6 +101,10 @@ export class LLMObsAnnotatedInteractionByTraceItem { baseName: "display_block", type: "Array", }, + frontend: { + baseName: "frontend", + type: "LLMObsFrontendContent", + }, id: { baseName: "id", type: "string", diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataAttributesResponse.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataAttributesResponse.ts new file mode 100644 index 000000000000..b1406a9f8cc8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataAttributesResponse.ts @@ -0,0 +1,54 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LLMObsAnnotatedInteractionItem } from "./LLMObsAnnotatedInteractionItem"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Attributes containing the annotated interaction. + */ +export class LLMObsAnnotatedInteractionDataAttributesResponse { + /** + * An interaction with its associated annotations. + */ + "annotatedInteraction": LLMObsAnnotatedInteractionItem; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + annotatedInteraction: { + baseName: "annotated_interaction", + type: "LLMObsAnnotatedInteractionItem", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsAnnotatedInteractionDataAttributesResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataResponse.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataResponse.ts new file mode 100644 index 000000000000..2ab2f4322209 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionDataResponse.ts @@ -0,0 +1,73 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LLMObsAnnotatedInteractionDataAttributesResponse } from "./LLMObsAnnotatedInteractionDataAttributesResponse"; +import { LLMObsAnnotatedInteractionsType } from "./LLMObsAnnotatedInteractionsType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data object for a single annotated interaction. + */ +export class LLMObsAnnotatedInteractionDataResponse { + /** + * Attributes containing the annotated interaction. + */ + "attributes": LLMObsAnnotatedInteractionDataAttributesResponse; + /** + * The annotation queue ID. + */ + "id": string; + /** + * Resource type for annotated interactions. + */ + "type": LLMObsAnnotatedInteractionsType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "LLMObsAnnotatedInteractionDataAttributesResponse", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "LLMObsAnnotatedInteractionsType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsAnnotatedInteractionDataResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionItem.ts index 932edd6c1341..1338fa13d504 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionItem.ts @@ -4,6 +4,7 @@ * Copyright 2020-Present Datadog, Inc. */ import { LLMObsDisplayBlockAnnotatedInteractionItem } from "./LLMObsDisplayBlockAnnotatedInteractionItem"; +import { LLMObsFrontendAnnotatedInteractionItem } from "./LLMObsFrontendAnnotatedInteractionItem"; import { LLMObsTraceAnnotatedInteractionItem } from "./LLMObsTraceAnnotatedInteractionItem"; import { UnparsedObject } from "../../datadog-api-client-common/util"; @@ -15,4 +16,5 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; export type LLMObsAnnotatedInteractionItem = | LLMObsTraceAnnotatedInteractionItem | LLMObsDisplayBlockAnnotatedInteractionItem + | LLMObsFrontendAnnotatedInteractionItem | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionResponse.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionResponse.ts new file mode 100644 index 000000000000..c6d6f9346d95 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotatedInteractionResponse.ts @@ -0,0 +1,54 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LLMObsAnnotatedInteractionDataResponse } from "./LLMObsAnnotatedInteractionDataResponse"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a single annotated interaction. + */ +export class LLMObsAnnotatedInteractionResponse { + /** + * Data object for a single annotated interaction. + */ + "data": LLMObsAnnotatedInteractionDataResponse; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "LLMObsAnnotatedInteractionDataResponse", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsAnnotatedInteractionResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionItem.ts index 5437d6e32b01..c1a61947d5cf 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionItem.ts @@ -4,6 +4,7 @@ * Copyright 2020-Present Datadog, Inc. */ import { LLMObsDisplayBlockInteractionItem } from "./LLMObsDisplayBlockInteractionItem"; +import { LLMObsFrontendInteractionItem } from "./LLMObsFrontendInteractionItem"; import { LLMObsTraceInteractionItem } from "./LLMObsTraceInteractionItem"; import { UnparsedObject } from "../../datadog-api-client-common/util"; @@ -15,4 +16,5 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; export type LLMObsAnnotationQueueInteractionItem = | LLMObsTraceInteractionItem | LLMObsDisplayBlockInteractionItem + | LLMObsFrontendInteractionItem | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionResponseItem.ts b/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionResponseItem.ts index 4f18044ddc2a..396321bc08f1 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionResponseItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsAnnotationQueueInteractionResponseItem.ts @@ -4,6 +4,7 @@ * Copyright 2020-Present Datadog, Inc. */ import { LLMObsDisplayBlockInteractionResponseItem } from "./LLMObsDisplayBlockInteractionResponseItem"; +import { LLMObsFrontendInteractionResponseItem } from "./LLMObsFrontendInteractionResponseItem"; import { LLMObsTraceInteractionResponseItem } from "./LLMObsTraceInteractionResponseItem"; import { UnparsedObject } from "../../datadog-api-client-common/util"; @@ -15,4 +16,5 @@ import { UnparsedObject } from "../../datadog-api-client-common/util"; export type LLMObsAnnotationQueueInteractionResponseItem = | LLMObsTraceInteractionResponseItem | LLMObsDisplayBlockInteractionResponseItem + | LLMObsFrontendInteractionResponseItem | UnparsedObject; diff --git a/packages/datadog-api-client-v2/models/LLMObsAnyInteractionType.ts b/packages/datadog-api-client-v2/models/LLMObsAnyInteractionType.ts index ec28c1db5d96..e0d811deb1d5 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnyInteractionType.ts +++ b/packages/datadog-api-client-v2/models/LLMObsAnyInteractionType.ts @@ -15,8 +15,10 @@ export type LLMObsAnyInteractionType = | typeof EXPERIMENT_TRACE | typeof SESSION | typeof DISPLAY_BLOCK + | typeof FRONTEND | UnparsedObject; export const TRACE = "trace"; export const EXPERIMENT_TRACE = "experiment_trace"; export const SESSION = "session"; export const DISPLAY_BLOCK = "display_block"; +export const FRONTEND = "frontend"; diff --git a/packages/datadog-api-client-v2/models/LLMObsDisplayBlockAnnotatedInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsDisplayBlockAnnotatedInteractionItem.ts index df9def9f4d00..9485c7f586e4 100644 --- a/packages/datadog-api-client-v2/models/LLMObsDisplayBlockAnnotatedInteractionItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsDisplayBlockAnnotatedInteractionItem.ts @@ -3,7 +3,7 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ -import { LLMObsAnnotationItem } from "./LLMObsAnnotationItem"; +import { LLMObsAnnotationItemResponse } from "./LLMObsAnnotationItemResponse"; import { LLMObsContentBlock } from "./LLMObsContentBlock"; import { LLMObsDisplayBlockInteractionType } from "./LLMObsDisplayBlockInteractionType"; @@ -16,7 +16,7 @@ export class LLMObsDisplayBlockAnnotatedInteractionItem { /** * List of annotations for this interaction. */ - "annotations": Array; + "annotations": Array; /** * Whether the current caller can annotate this interaction. */ @@ -57,7 +57,7 @@ export class LLMObsDisplayBlockAnnotatedInteractionItem { static readonly attributeTypeMap: AttributeTypeMap = { annotations: { baseName: "annotations", - type: "Array", + type: "Array", required: true, }, canAnnotate: { diff --git a/packages/datadog-api-client-v2/models/LLMObsFrontendAnnotatedInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsFrontendAnnotatedInteractionItem.ts new file mode 100644 index 000000000000..bb897b0667d2 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsFrontendAnnotatedInteractionItem.ts @@ -0,0 +1,101 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LLMObsAnnotationItemResponse } from "./LLMObsAnnotationItemResponse"; +import { LLMObsFrontendContent } from "./LLMObsFrontendContent"; +import { LLMObsFrontendInteractionType } from "./LLMObsFrontendInteractionType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * A frontend interaction with its associated annotations. + */ +export class LLMObsFrontendAnnotatedInteractionItem { + /** + * List of annotations for this interaction. + */ + "annotations": Array; + /** + * Whether the current caller can annotate this interaction. + */ + "canAnnotate": boolean; + /** + * Server-generated deterministic identifier derived from the content. + */ + "contentId": string; + /** + * Web content that makes up a `frontend` interaction. + */ + "frontend": LLMObsFrontendContent; + /** + * Unique identifier of the interaction. + */ + "id": string; + /** + * Type discriminator for a `frontend` interaction. + */ + "type": LLMObsFrontendInteractionType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + annotations: { + baseName: "annotations", + type: "Array", + required: true, + }, + canAnnotate: { + baseName: "can_annotate", + type: "boolean", + required: true, + }, + contentId: { + baseName: "content_id", + type: "string", + required: true, + }, + frontend: { + baseName: "frontend", + type: "LLMObsFrontendContent", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "LLMObsFrontendInteractionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsFrontendAnnotatedInteractionItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsFrontendContent.ts b/packages/datadog-api-client-v2/models/LLMObsFrontendContent.ts new file mode 100644 index 000000000000..9454f179637f --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsFrontendContent.ts @@ -0,0 +1,53 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Web content that makes up a `frontend` interaction. + */ +export class LLMObsFrontendContent { + /** + * Caller-provided web content. + */ + "code": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + code: { + baseName: "code", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsFrontendContent.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionItem.ts new file mode 100644 index 000000000000..e30cc9ca9330 --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionItem.ts @@ -0,0 +1,66 @@ +/** + * 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 2020-Present Datadog, Inc. + */ +import { LLMObsFrontendContent } from "./LLMObsFrontendContent"; +import { LLMObsFrontendInteractionType } from "./LLMObsFrontendInteractionType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * An interaction whose rendered content is supplied directly as web + * content. The server generates `content_id` deterministically from the + * content. + */ +export class LLMObsFrontendInteractionItem { + /** + * Web content that makes up a `frontend` interaction. + */ + "frontend": LLMObsFrontendContent; + /** + * Type discriminator for a `frontend` interaction. + */ + "type": LLMObsFrontendInteractionType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + frontend: { + baseName: "frontend", + type: "LLMObsFrontendContent", + required: true, + }, + type: { + baseName: "type", + type: "LLMObsFrontendInteractionType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return LLMObsFrontendInteractionItem.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/LLMObsAnnotationItem.ts b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionResponseItem.ts similarity index 50% rename from packages/datadog-api-client-v2/models/LLMObsAnnotationItem.ts rename to packages/datadog-api-client-v2/models/LLMObsFrontendInteractionResponseItem.ts index 6311c5a6af7f..efea8c76213a 100644 --- a/packages/datadog-api-client-v2/models/LLMObsAnnotationItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionResponseItem.ts @@ -3,41 +3,35 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ +import { LLMObsFrontendContent } from "./LLMObsFrontendContent"; +import { LLMObsFrontendInteractionType } from "./LLMObsFrontendInteractionType"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; /** - * A single annotation on an interaction. + * A frontend interaction result. */ -export class LLMObsAnnotationItem { +export class LLMObsFrontendInteractionResponseItem { /** - * Timestamp when the annotation was created. + * Whether this interaction already existed in the queue. */ - "createdAt": Date; + "alreadyExisted": boolean; /** - * Identifier of the user who created the annotation. + * Server-generated deterministic identifier derived from the content. */ - "createdBy": string; + "contentId": string; /** - * Unique identifier of the annotation. + * Web content that makes up a `frontend` interaction. */ - "id": string; - /** - * Identifier of the interaction this annotation belongs to. - */ - "interactionId": string; - /** - * Label values for this annotation. - */ - "labelValues": { [key: string]: any }; + "frontend": LLMObsFrontendContent; /** - * Timestamp when the annotation was last modified. + * Unique identifier of the interaction. */ - "modifiedAt": Date; + "id": string; /** - * Identifier of the user who last modified the annotation. + * Type discriminator for a `frontend` interaction. */ - "modifiedBy": string; + "type": LLMObsFrontendInteractionType; /** * A container for additional, undeclared properties. @@ -55,41 +49,29 @@ export class LLMObsAnnotationItem { * @ignore */ static readonly attributeTypeMap: AttributeTypeMap = { - createdAt: { - baseName: "created_at", - type: "Date", + alreadyExisted: { + baseName: "already_existed", + type: "boolean", required: true, - format: "date-time", }, - createdBy: { - baseName: "created_by", + contentId: { + baseName: "content_id", type: "string", required: true, }, - id: { - baseName: "id", - type: "string", + frontend: { + baseName: "frontend", + type: "LLMObsFrontendContent", required: true, }, - interactionId: { - baseName: "interaction_id", + id: { + baseName: "id", type: "string", required: true, }, - labelValues: { - baseName: "label_values", - type: "{ [key: string]: any; }", - required: true, - }, - modifiedAt: { - baseName: "modified_at", - type: "Date", - required: true, - format: "date-time", - }, - modifiedBy: { - baseName: "modified_by", - type: "string", + type: { + baseName: "type", + type: "LLMObsFrontendInteractionType", required: true, }, additionalProperties: { @@ -102,7 +84,7 @@ export class LLMObsAnnotationItem { * @ignore */ static getAttributeTypeMap(): AttributeTypeMap { - return LLMObsAnnotationItem.attributeTypeMap; + return LLMObsFrontendInteractionResponseItem.attributeTypeMap; } public constructor() {} diff --git a/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionType.ts b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionType.ts new file mode 100644 index 000000000000..6dfcf3874c6c --- /dev/null +++ b/packages/datadog-api-client-v2/models/LLMObsFrontendInteractionType.ts @@ -0,0 +1,14 @@ +/** + * 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 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Type discriminator for a `frontend` interaction. + */ + +export type LLMObsFrontendInteractionType = typeof FRONTEND | UnparsedObject; +export const FRONTEND = "frontend"; diff --git a/packages/datadog-api-client-v2/models/LLMObsTraceAnnotatedInteractionItem.ts b/packages/datadog-api-client-v2/models/LLMObsTraceAnnotatedInteractionItem.ts index 1dd9f5a0e778..786aca604d0c 100644 --- a/packages/datadog-api-client-v2/models/LLMObsTraceAnnotatedInteractionItem.ts +++ b/packages/datadog-api-client-v2/models/LLMObsTraceAnnotatedInteractionItem.ts @@ -3,7 +3,7 @@ * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2020-Present Datadog, Inc. */ -import { LLMObsAnnotationItem } from "./LLMObsAnnotationItem"; +import { LLMObsAnnotationItemResponse } from "./LLMObsAnnotationItemResponse"; import { LLMObsTraceInteractionType } from "./LLMObsTraceInteractionType"; import { AttributeTypeMap } from "../../datadog-api-client-common/util"; @@ -15,7 +15,7 @@ export class LLMObsTraceAnnotatedInteractionItem { /** * List of annotations for this interaction. */ - "annotations": Array; + "annotations": Array; /** * Whether the current caller can annotate this interaction. */ @@ -59,7 +59,7 @@ export class LLMObsTraceAnnotatedInteractionItem { static readonly attributeTypeMap: AttributeTypeMap = { annotations: { baseName: "annotations", - type: "Array", + type: "Array", required: true, }, canAnnotate: { diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index a05df0e125aa..e185ccc9cde2 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -2603,6 +2603,9 @@ import { KindMetadata } from "./KindMetadata"; import { KindObj } from "./KindObj"; import { KindResponseMeta } from "./KindResponseMeta"; import { LLMObsAnnotatedInteractionByTraceItem } from "./LLMObsAnnotatedInteractionByTraceItem"; +import { LLMObsAnnotatedInteractionDataAttributesResponse } from "./LLMObsAnnotatedInteractionDataAttributesResponse"; +import { LLMObsAnnotatedInteractionDataResponse } from "./LLMObsAnnotatedInteractionDataResponse"; +import { LLMObsAnnotatedInteractionResponse } from "./LLMObsAnnotatedInteractionResponse"; import { LLMObsAnnotatedInteractionsByTraceDataAttributesResponse } from "./LLMObsAnnotatedInteractionsByTraceDataAttributesResponse"; import { LLMObsAnnotatedInteractionsByTraceDataResponse } from "./LLMObsAnnotatedInteractionsByTraceDataResponse"; import { LLMObsAnnotatedInteractionsByTraceResponse } from "./LLMObsAnnotatedInteractionsByTraceResponse"; @@ -2610,7 +2613,6 @@ import { LLMObsAnnotatedInteractionsDataAttributesResponse } from "./LLMObsAnnot import { LLMObsAnnotatedInteractionsDataResponse } from "./LLMObsAnnotatedInteractionsDataResponse"; import { LLMObsAnnotatedInteractionsResponse } from "./LLMObsAnnotatedInteractionsResponse"; import { LLMObsAnnotationError } from "./LLMObsAnnotationError"; -import { LLMObsAnnotationItem } from "./LLMObsAnnotationItem"; import { LLMObsAnnotationItemResponse } from "./LLMObsAnnotationItemResponse"; import { LLMObsAnnotationLabelValue } from "./LLMObsAnnotationLabelValue"; import { LLMObsAnnotationLabelValueResponse } from "./LLMObsAnnotationLabelValueResponse"; @@ -2804,6 +2806,10 @@ import { LLMObsExperimentationSimpleSearchRequest } from "./LLMObsExperimentatio import { LLMObsExperimentationSimpleSearchResponse } from "./LLMObsExperimentationSimpleSearchResponse"; import { LLMObsExperimentationSortField } from "./LLMObsExperimentationSortField"; import { LLMObsExperimentsResponse } from "./LLMObsExperimentsResponse"; +import { LLMObsFrontendAnnotatedInteractionItem } from "./LLMObsFrontendAnnotatedInteractionItem"; +import { LLMObsFrontendContent } from "./LLMObsFrontendContent"; +import { LLMObsFrontendInteractionItem } from "./LLMObsFrontendInteractionItem"; +import { LLMObsFrontendInteractionResponseItem } from "./LLMObsFrontendInteractionResponseItem"; import { LLMObsInferenceCode } from "./LLMObsInferenceCode"; import { LLMObsInferenceContent } from "./LLMObsInferenceContent"; import { LLMObsInferenceContentValue } from "./LLMObsInferenceContentValue"; @@ -7218,6 +7224,7 @@ const enumsMap: { [key: string]: any[] } = { "experiment_trace", "session", "display_block", + "frontend", ], LLMObsContentBlockHeaderLevel: ["sm", "md", "lg", "xl"], LLMObsContentBlockLLMObsTraceInteractionType: ["trace", "experiment_trace"], @@ -7258,6 +7265,7 @@ const enumsMap: { [key: string]: any[] } = { LLMObsExperimentType: ["experiments"], LLMObsExperimentationSortFieldDirection: ["asc", "desc"], LLMObsExperimentationType: ["experimentation"], + LLMObsFrontendInteractionType: ["frontend"], LLMObsIntegrationName: [ "openai", "amazon_bedrock", @@ -12310,6 +12318,11 @@ const typeMap: { [index: string]: any } = { KindObj: KindObj, KindResponseMeta: KindResponseMeta, LLMObsAnnotatedInteractionByTraceItem: LLMObsAnnotatedInteractionByTraceItem, + LLMObsAnnotatedInteractionDataAttributesResponse: + LLMObsAnnotatedInteractionDataAttributesResponse, + LLMObsAnnotatedInteractionDataResponse: + LLMObsAnnotatedInteractionDataResponse, + LLMObsAnnotatedInteractionResponse: LLMObsAnnotatedInteractionResponse, LLMObsAnnotatedInteractionsByTraceDataAttributesResponse: LLMObsAnnotatedInteractionsByTraceDataAttributesResponse, LLMObsAnnotatedInteractionsByTraceDataResponse: @@ -12322,7 +12335,6 @@ const typeMap: { [index: string]: any } = { LLMObsAnnotatedInteractionsDataResponse, LLMObsAnnotatedInteractionsResponse: LLMObsAnnotatedInteractionsResponse, LLMObsAnnotationError: LLMObsAnnotationError, - LLMObsAnnotationItem: LLMObsAnnotationItem, LLMObsAnnotationItemResponse: LLMObsAnnotationItemResponse, LLMObsAnnotationLabelValue: LLMObsAnnotationLabelValue, LLMObsAnnotationLabelValueResponse: LLMObsAnnotationLabelValueResponse, @@ -12576,6 +12588,11 @@ const typeMap: { [index: string]: any } = { LLMObsExperimentationSimpleSearchResponse, LLMObsExperimentationSortField: LLMObsExperimentationSortField, LLMObsExperimentsResponse: LLMObsExperimentsResponse, + LLMObsFrontendAnnotatedInteractionItem: + LLMObsFrontendAnnotatedInteractionItem, + LLMObsFrontendContent: LLMObsFrontendContent, + LLMObsFrontendInteractionItem: LLMObsFrontendInteractionItem, + LLMObsFrontendInteractionResponseItem: LLMObsFrontendInteractionResponseItem, LLMObsInferenceCode: LLMObsInferenceCode, LLMObsInferenceContent: LLMObsInferenceContent, LLMObsInferenceContentValue: LLMObsInferenceContentValue, @@ -16844,6 +16861,7 @@ const oneOfMap: { [index: string]: string[] } = { LLMObsAnnotatedInteractionItem: [ "LLMObsTraceAnnotatedInteractionItem", "LLMObsDisplayBlockAnnotatedInteractionItem", + "LLMObsFrontendAnnotatedInteractionItem", ], LLMObsAnnotationLabelValueValue: [ "number", @@ -16854,10 +16872,12 @@ const oneOfMap: { [index: string]: string[] } = { LLMObsAnnotationQueueInteractionItem: [ "LLMObsTraceInteractionItem", "LLMObsDisplayBlockInteractionItem", + "LLMObsFrontendInteractionItem", ], LLMObsAnnotationQueueInteractionResponseItem: [ "LLMObsTraceInteractionResponseItem", "LLMObsDisplayBlockInteractionResponseItem", + "LLMObsFrontendInteractionResponseItem", ], LLMObsPromptTemplate: ["string", "Array"], LaunchDarklyCredentials: ["LaunchDarklyAPIKey"],