diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 39623cac69e..b0ee5756e15 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -39902,33 +39902,19 @@ components: 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 (trace ID or session ID) 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 + oneOf: + - $ref: "#/components/schemas/LLMObsTraceAnnotatedInteractionItem" + - $ref: "#/components/schemas/LLMObsDisplayBlockAnnotatedInteractionItem" LLMObsAnnotatedInteractionsDataAttributesResponse: description: Attributes containing the list of annotated interactions. properties: annotated_interactions: description: List of interactions with their annotations. + example: + - annotations: [] + content_id: trace-abc-123 + id: "interaction-456" + type: trace items: $ref: "#/components/schemas/LLMObsAnnotatedInteractionItem" type: array @@ -40110,45 +40096,22 @@ components: type: object LLMObsAnnotationQueueInteractionItem: description: A single interaction to add to an annotation queue. - properties: - content_id: - description: Identifier of the content (trace ID or session ID) for this interaction. - example: "trace-abc-123" - type: string - type: - $ref: "#/components/schemas/LLMObsInteractionType" - required: - - type - - content_id - type: object + oneOf: + - $ref: "#/components/schemas/LLMObsTraceInteractionItem" + - $ref: "#/components/schemas/LLMObsDisplayBlockInteractionItem" 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 (trace ID or session ID) 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 + oneOf: + - $ref: "#/components/schemas/LLMObsTraceInteractionResponseItem" + - $ref: "#/components/schemas/LLMObsDisplayBlockInteractionResponseItem" 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. + example: + - content_id: trace-abc-123 + type: trace items: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionItem" minItems: 1 @@ -40161,6 +40124,11 @@ components: properties: interactions: description: List of interactions that were processed. + example: + - already_existed: false + content_id: trace-abc-123 + id: "00000000-0000-0000-0000-000000000000" + type: trace items: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionResponseItem" type: array @@ -40356,6 +40324,144 @@ components: required: - label_schemas type: object + LLMObsContentBlock: + description: |- + A single content block rendered inside a `display_block` interaction. + `type` discriminates which other fields are meaningful: + + - `markdown` / `text`: `content` must be a string. + - `header`: `content` must be a string; `level`, when set, must be one of `sm`, `md`, `lg`, `xl`. + - `json`: `content` must be a well-formed JSON value (object, array, or scalar). + - `image`: `url` is required. + - `widget`: `tileDef` is required (any well-formed JSON; the frontend owns the renderable schema). + - `llmobs_trace`: `traceId` is required; `interactionType`, when set, must be `trace` or `experiment_trace`. + + `height`, when set, must be positive. + properties: + alt: + description: Alternative text for an `image` block. + example: "Example image" + type: string + content: + description: |- + Block payload. A string for `markdown`, `header`, and `text`; an + arbitrary JSON value (object, array, or scalar) for `json`. Omitted + for `image`, `widget`, and `llmobs_trace`. + example: "## Triage Instructions" + height: + description: Optional rendered height. Must be positive when set. + example: 240 + format: int64 + type: integer + interactionType: + $ref: "#/components/schemas/LLMObsContentBlockLLMObsTraceInteractionType" + label: + description: Optional label rendered alongside the block. + example: "Triage Instructions" + type: string + level: + $ref: "#/components/schemas/LLMObsContentBlockHeaderLevel" + tileDef: + description: |- + Tile definition for a `widget` block. Required for `widget`. The + schema is owned by the frontend renderer. + example: + requests: + - queries: + - data_source: metrics + name: q + query: "avg:system.cpu.user{*}" + response_format: timeseries + type: line + viz: timeseries + timeFrame: + $ref: "#/components/schemas/LLMObsContentBlockTimeFrame" + traceId: + description: Trace identifier. Required for `llmobs_trace` blocks. + example: "69fcc2bb0000000003113989d83069ba" + type: string + type: + $ref: "#/components/schemas/LLMObsContentBlockType" + url: + description: URL of the image. Required for `image` blocks. + example: "https://example.com/image.png" + type: string + required: + - type + type: object + LLMObsContentBlockHeaderLevel: + description: Visual size for a `header` block. + enum: + - sm + - md + - lg + - xl + example: md + type: string + x-enum-varnames: + - SM + - MD + - LG + - XL + LLMObsContentBlockLLMObsTraceInteractionType: + description: |- + Upstream interaction type referenced by an `llmobs_trace` block. + Restricted to `trace` or `experiment_trace`. + enum: + - trace + - experiment_trace + example: trace + type: string + x-enum-varnames: + - TRACE + - EXPERIMENT_TRACE + LLMObsContentBlockTimeFrame: + description: Unix-millis time range used by chart blocks. + properties: + end: + description: End of the range, in Unix milliseconds. + example: 1705315800000 + format: int64 + type: integer + start: + description: Start of the range, in Unix milliseconds. + example: 1705312200000 + format: int64 + type: integer + required: + - start + - end + type: object + LLMObsContentBlockType: + description: |- + Discriminator for a single `display_block` content block. Adding a + variant requires coordinated changes in the frontend renderer. + enum: + - markdown + - header + - text + - json + - image + - widget + - llmobs_trace + example: markdown + type: string + x-enum-varnames: + - MARKDOWN + - HEADER + - TEXT + - JSON + - IMAGE + - WIDGET + - LLMOBS_TRACE + LLMObsContentBlocks: + description: |- + List of content blocks that make up a `display_block` interaction. + Must contain at least one block. + items: + $ref: "#/components/schemas/LLMObsContentBlock" + minItems: 1 + type: array LLMObsCursorMeta: description: Pagination cursor metadata. properties: @@ -41266,6 +41372,81 @@ components: required: - data type: object + LLMObsDisplayBlockAnnotatedInteractionItem: + description: A display_block interaction with its associated annotations. + properties: + annotations: + description: List of annotations for this interaction. + items: + $ref: "#/components/schemas/LLMObsAnnotationItem" + type: array + content_id: + description: Server-generated deterministic identifier derived from the block list. + example: "9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2" + type: string + display_block: + $ref: "#/components/schemas/LLMObsContentBlocks" + id: + description: Unique identifier of the interaction. + example: "interaction-456" + type: string + type: + $ref: "#/components/schemas/LLMObsDisplayBlockInteractionType" + required: + - id + - type + - content_id + - annotations + - display_block + type: object + LLMObsDisplayBlockInteractionItem: + description: |- + An interaction whose rendered content is supplied directly as a list + of display blocks. The server generates `content_id` deterministically + from the block list. + properties: + display_block: + $ref: "#/components/schemas/LLMObsContentBlocks" + type: + $ref: "#/components/schemas/LLMObsDisplayBlockInteractionType" + required: + - type + - display_block + type: object + LLMObsDisplayBlockInteractionResponseItem: + description: A display_block 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 block list. + example: "9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2" + type: string + display_block: + $ref: "#/components/schemas/LLMObsContentBlocks" + id: + description: Unique identifier of the interaction. + example: "00000000-0000-0000-0000-000000000000" + type: string + type: + $ref: "#/components/schemas/LLMObsDisplayBlockInteractionType" + required: + - id + - type + - content_id + - already_existed + - display_block + type: object + LLMObsDisplayBlockInteractionType: + description: Type discriminator for a `display_block` interaction. + enum: + - display_block + example: display_block + type: string + x-enum-varnames: + - DISPLAY_BLOCK LLMObsEventType: description: Resource type for LLM Observability experiment events. enum: @@ -41643,18 +41824,6 @@ components: required: - data type: object - LLMObsInteractionType: - description: Type of interaction in an annotation queue. - enum: - - trace - - experiment_trace - - session - example: trace - type: string - x-enum-varnames: - - TRACE - - EXPERIMENT_TRACE - - SESSION LLMObsLabelSchema: description: Schema definition for a single label in an annotation queue. properties: @@ -41896,6 +42065,78 @@ components: type: string x-enum-varnames: - RECORDS + LLMObsTraceAnnotatedInteractionItem: + description: A trace, experiment trace, or session interaction with its associated annotations. + properties: + annotations: + description: List of annotations for this interaction. + items: + $ref: "#/components/schemas/LLMObsAnnotationItem" + type: array + content_id: + description: Upstream entity identifier supplied by the caller. + example: "trace-abc-123" + type: string + id: + description: Unique identifier of the interaction. + example: "interaction-456" + type: string + type: + $ref: "#/components/schemas/LLMObsTraceInteractionType" + required: + - id + - type + - content_id + - annotations + type: object + LLMObsTraceInteractionItem: + description: An interaction that references an upstream trace, experiment trace, or session. + properties: + content_id: + description: Upstream entity identifier (trace, experiment trace, or session ID). + example: "trace-abc-123" + type: string + type: + $ref: "#/components/schemas/LLMObsTraceInteractionType" + required: + - type + - content_id + type: object + LLMObsTraceInteractionResponseItem: + description: A trace, experiment trace, or session interaction result. + properties: + already_existed: + description: Whether this interaction already existed in the queue. + example: false + type: boolean + content_id: + description: Upstream entity identifier supplied by the caller. + 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/LLMObsTraceInteractionType" + required: + - id + - type + - content_id + - already_existed + type: object + LLMObsTraceInteractionType: + description: Type of an upstream-entity interaction. + enum: + - trace + - experiment_trace + - session + example: trace + type: string + x-enum-varnames: + - TRACE + - EXPERIMENT_TRACE + - SESSION Language: description: Programming language enum: @@ -113835,8 +114076,16 @@ paths: /api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions: post: description: |- - Add one or more interactions (traces or sessions) to an annotation queue. - At least one interaction must be provided. + Add one or more interactions to an annotation queue. At least one + interaction must be provided. Each interaction has a `type`: + + - `trace`, `experiment_trace`, `session`: `content_id` references the + upstream entity; the server fetches the actual content. + - `display_block`: omit `content_id` and provide the rendered content + in `display_block`. The server generates `content_id` as a + deterministic hash of the block list. + + Items of different types can be mixed in a single request. operationId: CreateLLMObsAnnotationQueueInteractions parameters: - $ref: "#/components/parameters/LLMObsAnnotationQueueIDPathParameter" @@ -113852,6 +114101,24 @@ paths: - content_id: trace-abc-123 type: trace type: interactions + display_block: + summary: Add a display_block interaction + value: + data: + attributes: + interactions: + - display_block: + - content: "## Triage Instructions" + type: markdown + - content: "Inputs" + level: md + type: header + - content: + experiment_id: abc-123 + label: "Experiments" + type: json + type: display_block + type: interactions schema: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsRequest" description: Add interactions payload. @@ -113872,6 +114139,21 @@ paths: type: trace id: 00000000-0000-0000-0000-000000000001 type: interactions + display_block: + summary: display_block response + value: + data: + attributes: + interactions: + - already_existed: false + content_id: 9a87f3e2b1d4c5a6f8b3e2d1c4a7b5f6e3d2a1c4b7e5f8a3d6c2e1b4a7d5f8c2 + display_block: + - content: "## Triage Instructions" + type: markdown + id: 00000000-0000-0000-0000-000000000000 + type: display_block + id: 00000000-0000-0000-0000-000000000001 + type: interactions schema: $ref: "#/components/schemas/LLMObsAnnotationQueueInteractionsResponse" description: Created diff --git a/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.java b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.java index 47e40bd6ad9..400656c4915 100644 --- a/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.java +++ b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.java @@ -9,7 +9,8 @@ import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsRequest; import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsResponse; import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsType; -import com.datadog.api.client.v2.model.LLMObsInteractionType; +import com.datadog.api.client.v2.model.LLMObsTraceInteractionItem; +import com.datadog.api.client.v2.model.LLMObsTraceInteractionType; import java.util.Collections; public class Example { @@ -26,9 +27,10 @@ public static void main(String[] args) { new LLMObsAnnotationQueueInteractionsDataAttributesRequest() .interactions( Collections.singletonList( - new LLMObsAnnotationQueueInteractionItem() - .contentId("trace-abc-123") - .type(LLMObsInteractionType.TRACE)))) + new LLMObsAnnotationQueueInteractionItem( + new LLMObsTraceInteractionItem() + .contentId("trace-abc-123") + .type(LLMObsTraceInteractionType.TRACE))))) .type(LLMObsAnnotationQueueInteractionsType.INTERACTIONS)); try { diff --git a/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.java b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.java new file mode 100644 index 00000000000..88745c70b28 --- /dev/null +++ b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.java @@ -0,0 +1,56 @@ +// Add a display_block interaction returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.LlmObservabilityApi; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionItem; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsDataAttributesRequest; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsDataRequest; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsRequest; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsResponse; +import com.datadog.api.client.v2.model.LLMObsAnnotationQueueInteractionsType; +import com.datadog.api.client.v2.model.LLMObsContentBlock; +import com.datadog.api.client.v2.model.LLMObsContentBlockType; +import com.datadog.api.client.v2.model.LLMObsDisplayBlockInteractionItem; +import com.datadog.api.client.v2.model.LLMObsDisplayBlockInteractionType; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createLLMObsAnnotationQueueInteractions", true); + LlmObservabilityApi apiInstance = new LlmObservabilityApi(defaultClient); + + LLMObsAnnotationQueueInteractionsRequest body = + new LLMObsAnnotationQueueInteractionsRequest() + .data( + new LLMObsAnnotationQueueInteractionsDataRequest() + .attributes( + new LLMObsAnnotationQueueInteractionsDataAttributesRequest() + .interactions( + Collections.singletonList( + new LLMObsAnnotationQueueInteractionItem( + new LLMObsDisplayBlockInteractionItem() + .type(LLMObsDisplayBlockInteractionType.DISPLAY_BLOCK) + .displayBlock( + Collections.singletonList( + new LLMObsContentBlock() + .type(LLMObsContentBlockType.MARKDOWN) + .content("## Triage Instructions"))))))) + .type(LLMObsAnnotationQueueInteractionsType.INTERACTIONS)); + + try { + LLMObsAnnotationQueueInteractionsResponse result = + apiInstance.createLLMObsAnnotationQueueInteractions( + "00000000-0000-0000-0000-000000000001", body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling LlmObservabilityApi#createLLMObsAnnotationQueueInteractions"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/LlmObservabilityApi.java b/src/main/java/com/datadog/api/client/v2/api/LlmObservabilityApi.java index 011ce54a62b..bae5f4b4864 100644 --- a/src/main/java/com/datadog/api/client/v2/api/LlmObservabilityApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/LlmObservabilityApi.java @@ -269,8 +269,18 @@ public LLMObsAnnotationQueueInteractionsResponse createLLMObsAnnotationQueueInte } /** - * Add one or more interactions (traces or sessions) to an annotation queue. At least one - * interaction must be provided. + * Add one or more interactions to an annotation queue. At least one interaction must be provided. + * Each interaction has a type: + * + * + * + *

Items of different types can be mixed in a single request. * * @param queueId The ID of the LLM Observability annotation queue. (required) * @param body Add interactions payload. (required) diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotatedInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotatedInteractionItem.java index 00665914307..3b88978fe1e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotatedInteractionItem.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotatedInteractionItem.java @@ -6,243 +6,302 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import java.util.ArrayList; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; import java.util.HashMap; -import java.util.List; +import java.util.HashSet; import java.util.Map; -import java.util.Objects; - -/** An interaction with its associated annotations. */ -@JsonPropertyOrder({ - LLMObsAnnotatedInteractionItem.JSON_PROPERTY_ANNOTATIONS, - LLMObsAnnotatedInteractionItem.JSON_PROPERTY_CONTENT_ID, - LLMObsAnnotatedInteractionItem.JSON_PROPERTY_ID, - LLMObsAnnotatedInteractionItem.JSON_PROPERTY_TYPE -}) +import java.util.logging.Level; +import java.util.logging.Logger; + @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class LLMObsAnnotatedInteractionItem { +@JsonDeserialize( + using = LLMObsAnnotatedInteractionItem.LLMObsAnnotatedInteractionItemDeserializer.class) +@JsonSerialize( + using = LLMObsAnnotatedInteractionItem.LLMObsAnnotatedInteractionItemSerializer.class) +public class LLMObsAnnotatedInteractionItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(LLMObsAnnotatedInteractionItem.class.getName()); + @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ANNOTATIONS = "annotations"; - private List annotations = new ArrayList<>(); - - public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; - private String contentId; - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - - public static final String JSON_PROPERTY_TYPE = "type"; - private LLMObsInteractionType type; - - public LLMObsAnnotatedInteractionItem() {} - - @JsonCreator - public LLMObsAnnotatedInteractionItem( - @JsonProperty(required = true, value = JSON_PROPERTY_ANNOTATIONS) - List annotations, - @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, - @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsInteractionType type) { - this.annotations = annotations; - this.contentId = contentId; - this.id = id; - this.type = type; - this.unparsed |= !type.isValid(); - } - public LLMObsAnnotatedInteractionItem annotations(List annotations) { - this.annotations = annotations; - for (LLMObsAnnotationItem item : annotations) { - this.unparsed |= item.unparsed; + public static class LLMObsAnnotatedInteractionItemSerializer + extends StdSerializer { + public LLMObsAnnotatedInteractionItemSerializer(Class t) { + super(t); } - return this; - } - public LLMObsAnnotatedInteractionItem addAnnotationsItem(LLMObsAnnotationItem annotationsItem) { - this.annotations.add(annotationsItem); - this.unparsed |= annotationsItem.unparsed; - return this; - } + public LLMObsAnnotatedInteractionItemSerializer() { + this(null); + } - /** - * List of annotations for this interaction. - * - * @return annotations - */ - @JsonProperty(JSON_PROPERTY_ANNOTATIONS) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public List getAnnotations() { - return annotations; + @Override + public void serialize( + LLMObsAnnotatedInteractionItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } } - public void setAnnotations(List annotations) { - this.annotations = annotations; - } + public static class LLMObsAnnotatedInteractionItemDeserializer + extends StdDeserializer { + public LLMObsAnnotatedInteractionItemDeserializer() { + this(LLMObsAnnotatedInteractionItem.class); + } - public LLMObsAnnotatedInteractionItem contentId(String contentId) { - this.contentId = contentId; - return this; - } + public LLMObsAnnotatedInteractionItemDeserializer(Class vc) { + super(vc); + } - /** - * Identifier of the content (trace ID or session ID) for this interaction. - * - * @return contentId - */ - @JsonProperty(JSON_PROPERTY_CONTENT_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getContentId() { - return contentId; - } + @Override + public LLMObsAnnotatedInteractionItem deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LLMObsTraceAnnotatedInteractionItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsTraceAnnotatedInteractionItem.class.equals(Integer.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Long.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Float.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Double.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Boolean.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsTraceAnnotatedInteractionItem.class.equals(Integer.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsTraceAnnotatedInteractionItem.class.equals(Float.class) + || LLMObsTraceAnnotatedInteractionItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsTraceAnnotatedInteractionItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsTraceAnnotatedInteractionItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsTraceAnnotatedInteractionItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsTraceAnnotatedInteractionItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsTraceAnnotatedInteractionItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LLMObsTraceAnnotatedInteractionItem'", + e); + } - public void setContentId(String contentId) { - this.contentId = contentId; - } + // deserialize LLMObsDisplayBlockAnnotatedInteractionItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Integer.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Long.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Float.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Double.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Boolean.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Integer.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Float.class) + || LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsDisplayBlockAnnotatedInteractionItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(LLMObsDisplayBlockAnnotatedInteractionItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsDisplayBlockAnnotatedInteractionItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, + "Input data matches schema 'LLMObsDisplayBlockAnnotatedInteractionItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LLMObsDisplayBlockAnnotatedInteractionItem'", + e); + } - public LLMObsAnnotatedInteractionItem id(String id) { - this.id = id; - return this; - } + LLMObsAnnotatedInteractionItem ret = new LLMObsAnnotatedInteractionItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } - /** - * Unique identifier of the interaction. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; + /** Handle deserialization of the 'null' value. */ + @Override + public LLMObsAnnotatedInteractionItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "LLMObsAnnotatedInteractionItem cannot be null"); + } } - public void setId(String id) { - this.id = id; + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LLMObsAnnotatedInteractionItem() { + super("oneOf", Boolean.FALSE); } - public LLMObsAnnotatedInteractionItem type(LLMObsInteractionType type) { - this.type = type; - this.unparsed |= !type.isValid(); - return this; + public LLMObsAnnotatedInteractionItem(LLMObsTraceAnnotatedInteractionItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - /** - * Type of interaction in an annotation queue. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public LLMObsInteractionType getType() { - return type; + public LLMObsAnnotatedInteractionItem(LLMObsDisplayBlockAnnotatedInteractionItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - public void setType(LLMObsInteractionType type) { - if (!type.isValid()) { - this.unparsed = true; - } - this.type = type; + static { + schemas.put( + "LLMObsTraceAnnotatedInteractionItem", + new GenericType() {}); + schemas.put( + "LLMObsDisplayBlockAnnotatedInteractionItem", + new GenericType() {}); + JSON.registerDescendants( + LLMObsAnnotatedInteractionItem.class, Collections.unmodifiableMap(schemas)); } - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; + @Override + public Map getSchemas() { + return LLMObsAnnotatedInteractionItem.schemas; + } /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LLMObsTraceAnnotatedInteractionItem, + * LLMObsDisplayBlockAnnotatedInteractionItem * - * @param key The arbitrary key to set - * @param value The associated value - * @return LLMObsAnnotatedInteractionItem + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). */ - @JsonAnySetter - public LLMObsAnnotatedInteractionItem putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + LLMObsTraceAnnotatedInteractionItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LLMObsDisplayBlockAnnotatedInteractionItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - this.additionalProperties.put(key, value); - return this; + throw new RuntimeException( + "Invalid instance type. Must be LLMObsTraceAnnotatedInteractionItem," + + " LLMObsDisplayBlockAnnotatedInteractionItem"); } /** - * Return the additional (undeclared) property. + * Get the actual instance, which can be the following: LLMObsTraceAnnotatedInteractionItem, + * LLMObsDisplayBlockAnnotatedInteractionItem * - * @return The additional properties + * @return The actual instance (LLMObsTraceAnnotatedInteractionItem, + * LLMObsDisplayBlockAnnotatedInteractionItem) */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; + @Override + public Object getActualInstance() { + return super.getActualInstance(); } /** - * Return the additional (undeclared) property with the specified name. + * Get the actual instance of `LLMObsTraceAnnotatedInteractionItem`. If the actual instance is not + * `LLMObsTraceAnnotatedInteractionItem`, the ClassCastException will be thrown. * - * @param key The arbitrary key to get - * @return The specific additional property for the given key + * @return The actual instance of `LLMObsTraceAnnotatedInteractionItem` + * @throws ClassCastException if the instance is not `LLMObsTraceAnnotatedInteractionItem` */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this LLMObsAnnotatedInteractionItem object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LLMObsAnnotatedInteractionItem llmObsAnnotatedInteractionItem = - (LLMObsAnnotatedInteractionItem) o; - return Objects.equals(this.annotations, llmObsAnnotatedInteractionItem.annotations) - && Objects.equals(this.contentId, llmObsAnnotatedInteractionItem.contentId) - && Objects.equals(this.id, llmObsAnnotatedInteractionItem.id) - && Objects.equals(this.type, llmObsAnnotatedInteractionItem.type) - && Objects.equals( - this.additionalProperties, llmObsAnnotatedInteractionItem.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(annotations, contentId, id, type, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class LLMObsAnnotatedInteractionItem {\n"); - sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); - sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); + public LLMObsTraceAnnotatedInteractionItem getLLMObsTraceAnnotatedInteractionItem() + throws ClassCastException { + return (LLMObsTraceAnnotatedInteractionItem) super.getActualInstance(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Get the actual instance of `LLMObsDisplayBlockAnnotatedInteractionItem`. If the actual instance + * is not `LLMObsDisplayBlockAnnotatedInteractionItem`, the ClassCastException will be thrown. + * + * @return The actual instance of `LLMObsDisplayBlockAnnotatedInteractionItem` + * @throws ClassCastException if the instance is not `LLMObsDisplayBlockAnnotatedInteractionItem` */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + public LLMObsDisplayBlockAnnotatedInteractionItem getLLMObsDisplayBlockAnnotatedInteractionItem() + throws ClassCastException { + return (LLMObsDisplayBlockAnnotatedInteractionItem) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionItem.java index 2bd8ce70366..1a9df63394d 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionItem.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionItem.java @@ -6,175 +6,290 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; -import java.util.Objects; +import java.util.logging.Level; +import java.util.logging.Logger; -/** A single interaction to add to an annotation queue. */ -@JsonPropertyOrder({ - LLMObsAnnotationQueueInteractionItem.JSON_PROPERTY_CONTENT_ID, - LLMObsAnnotationQueueInteractionItem.JSON_PROPERTY_TYPE -}) @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class LLMObsAnnotationQueueInteractionItem { +@JsonDeserialize( + using = + LLMObsAnnotationQueueInteractionItem.LLMObsAnnotationQueueInteractionItemDeserializer.class) +@JsonSerialize( + using = + LLMObsAnnotationQueueInteractionItem.LLMObsAnnotationQueueInteractionItemSerializer.class) +public class LLMObsAnnotationQueueInteractionItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(LLMObsAnnotationQueueInteractionItem.class.getName()); + @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; - private String contentId; - public static final String JSON_PROPERTY_TYPE = "type"; - private LLMObsInteractionType type; + public static class LLMObsAnnotationQueueInteractionItemSerializer + extends StdSerializer { + public LLMObsAnnotationQueueInteractionItemSerializer( + Class t) { + super(t); + } - public LLMObsAnnotationQueueInteractionItem() {} + public LLMObsAnnotationQueueInteractionItemSerializer() { + this(null); + } - @JsonCreator - public LLMObsAnnotationQueueInteractionItem( - @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsInteractionType type) { - this.contentId = contentId; - this.type = type; - this.unparsed |= !type.isValid(); + @Override + public void serialize( + LLMObsAnnotationQueueInteractionItem value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } } - public LLMObsAnnotationQueueInteractionItem contentId(String contentId) { - this.contentId = contentId; - return this; - } + public static class LLMObsAnnotationQueueInteractionItemDeserializer + extends StdDeserializer { + public LLMObsAnnotationQueueInteractionItemDeserializer() { + this(LLMObsAnnotationQueueInteractionItem.class); + } - /** - * Identifier of the content (trace ID or session ID) for this interaction. - * - * @return contentId - */ - @JsonProperty(JSON_PROPERTY_CONTENT_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getContentId() { - return contentId; + public LLMObsAnnotationQueueInteractionItemDeserializer(Class vc) { + super(vc); + } + + @Override + public LLMObsAnnotationQueueInteractionItem deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LLMObsTraceInteractionItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsTraceInteractionItem.class.equals(Integer.class) + || LLMObsTraceInteractionItem.class.equals(Long.class) + || LLMObsTraceInteractionItem.class.equals(Float.class) + || LLMObsTraceInteractionItem.class.equals(Double.class) + || LLMObsTraceInteractionItem.class.equals(Boolean.class) + || LLMObsTraceInteractionItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsTraceInteractionItem.class.equals(Integer.class) + || LLMObsTraceInteractionItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsTraceInteractionItem.class.equals(Float.class) + || LLMObsTraceInteractionItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsTraceInteractionItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsTraceInteractionItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsTraceInteractionItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsTraceInteractionItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsTraceInteractionItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'LLMObsTraceInteractionItem'", e); + } + + // deserialize LLMObsDisplayBlockInteractionItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsDisplayBlockInteractionItem.class.equals(Integer.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Long.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Float.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Double.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Boolean.class) + || LLMObsDisplayBlockInteractionItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsDisplayBlockInteractionItem.class.equals(Integer.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsDisplayBlockInteractionItem.class.equals(Float.class) + || LLMObsDisplayBlockInteractionItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsDisplayBlockInteractionItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsDisplayBlockInteractionItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsDisplayBlockInteractionItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsDisplayBlockInteractionItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsDisplayBlockInteractionItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, "Input data does not match schema 'LLMObsDisplayBlockInteractionItem'", e); + } + + LLMObsAnnotationQueueInteractionItem ret = new LLMObsAnnotationQueueInteractionItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LLMObsAnnotationQueueInteractionItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "LLMObsAnnotationQueueInteractionItem cannot be null"); + } } - public void setContentId(String contentId) { - this.contentId = contentId; + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LLMObsAnnotationQueueInteractionItem() { + super("oneOf", Boolean.FALSE); } - public LLMObsAnnotationQueueInteractionItem type(LLMObsInteractionType type) { - this.type = type; - this.unparsed |= !type.isValid(); - return this; + public LLMObsAnnotationQueueInteractionItem(LLMObsTraceInteractionItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - /** - * Type of interaction in an annotation queue. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public LLMObsInteractionType getType() { - return type; + public LLMObsAnnotationQueueInteractionItem(LLMObsDisplayBlockInteractionItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - public void setType(LLMObsInteractionType type) { - if (!type.isValid()) { - this.unparsed = true; - } - this.type = type; + static { + schemas.put("LLMObsTraceInteractionItem", new GenericType() {}); + schemas.put( + "LLMObsDisplayBlockInteractionItem", + new GenericType() {}); + JSON.registerDescendants( + LLMObsAnnotationQueueInteractionItem.class, Collections.unmodifiableMap(schemas)); } - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; + @Override + public Map getSchemas() { + return LLMObsAnnotationQueueInteractionItem.schemas; + } /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LLMObsTraceInteractionItem, LLMObsDisplayBlockInteractionItem * - * @param key The arbitrary key to set - * @param value The associated value - * @return LLMObsAnnotationQueueInteractionItem + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). */ - @JsonAnySetter - public LLMObsAnnotationQueueInteractionItem putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(LLMObsTraceInteractionItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + LLMObsDisplayBlockInteractionItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - this.additionalProperties.put(key, value); - return this; + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be LLMObsTraceInteractionItem," + + " LLMObsDisplayBlockInteractionItem"); } /** - * Return the additional (undeclared) property. + * Get the actual instance, which can be the following: LLMObsTraceInteractionItem, + * LLMObsDisplayBlockInteractionItem * - * @return The additional properties + * @return The actual instance (LLMObsTraceInteractionItem, LLMObsDisplayBlockInteractionItem) */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; + @Override + public Object getActualInstance() { + return super.getActualInstance(); } /** - * Return the additional (undeclared) property with the specified name. + * Get the actual instance of `LLMObsTraceInteractionItem`. If the actual instance is not + * `LLMObsTraceInteractionItem`, the ClassCastException will be thrown. * - * @param key The arbitrary key to get - * @return The specific additional property for the given key + * @return The actual instance of `LLMObsTraceInteractionItem` + * @throws ClassCastException if the instance is not `LLMObsTraceInteractionItem` */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this LLMObsAnnotationQueueInteractionItem object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LLMObsAnnotationQueueInteractionItem llmObsAnnotationQueueInteractionItem = - (LLMObsAnnotationQueueInteractionItem) o; - return Objects.equals(this.contentId, llmObsAnnotationQueueInteractionItem.contentId) - && Objects.equals(this.type, llmObsAnnotationQueueInteractionItem.type) - && Objects.equals( - this.additionalProperties, llmObsAnnotationQueueInteractionItem.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(contentId, type, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class LLMObsAnnotationQueueInteractionItem {\n"); - sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); + public LLMObsTraceInteractionItem getLLMObsTraceInteractionItem() throws ClassCastException { + return (LLMObsTraceInteractionItem) super.getActualInstance(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Get the actual instance of `LLMObsDisplayBlockInteractionItem`. If the actual instance is not + * `LLMObsDisplayBlockInteractionItem`, the ClassCastException will be thrown. + * + * @return The actual instance of `LLMObsDisplayBlockInteractionItem` + * @throws ClassCastException if the instance is not `LLMObsDisplayBlockInteractionItem` */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + public LLMObsDisplayBlockInteractionItem getLLMObsDisplayBlockInteractionItem() + throws ClassCastException { + return (LLMObsDisplayBlockInteractionItem) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionResponseItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionResponseItem.java index f9ba12973b1..8d4aed402f4 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionResponseItem.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsAnnotationQueueInteractionResponseItem.java @@ -6,234 +6,309 @@ package com.datadog.api.client.v2.model; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonCreator; +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; -import java.util.Objects; - -/** A single interaction result. */ -@JsonPropertyOrder({ - LLMObsAnnotationQueueInteractionResponseItem.JSON_PROPERTY_ALREADY_EXISTED, - LLMObsAnnotationQueueInteractionResponseItem.JSON_PROPERTY_CONTENT_ID, - LLMObsAnnotationQueueInteractionResponseItem.JSON_PROPERTY_ID, - LLMObsAnnotationQueueInteractionResponseItem.JSON_PROPERTY_TYPE -}) +import java.util.logging.Level; +import java.util.logging.Logger; + @jakarta.annotation.Generated( value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") -public class LLMObsAnnotationQueueInteractionResponseItem { +@JsonDeserialize( + using = + LLMObsAnnotationQueueInteractionResponseItem + .LLMObsAnnotationQueueInteractionResponseItemDeserializer.class) +@JsonSerialize( + using = + LLMObsAnnotationQueueInteractionResponseItem + .LLMObsAnnotationQueueInteractionResponseItemSerializer.class) +public class LLMObsAnnotationQueueInteractionResponseItem extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(LLMObsAnnotationQueueInteractionResponseItem.class.getName()); + @JsonIgnore public boolean unparsed = false; - public static final String JSON_PROPERTY_ALREADY_EXISTED = "already_existed"; - private Boolean alreadyExisted; - - public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; - private String contentId; - - public static final String JSON_PROPERTY_ID = "id"; - private String id; - - public static final String JSON_PROPERTY_TYPE = "type"; - private LLMObsInteractionType type; - - public LLMObsAnnotationQueueInteractionResponseItem() {} - - @JsonCreator - public LLMObsAnnotationQueueInteractionResponseItem( - @JsonProperty(required = true, value = JSON_PROPERTY_ALREADY_EXISTED) Boolean alreadyExisted, - @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, - @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, - @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsInteractionType type) { - this.alreadyExisted = alreadyExisted; - this.contentId = contentId; - this.id = id; - this.type = type; - this.unparsed |= !type.isValid(); - } - public LLMObsAnnotationQueueInteractionResponseItem alreadyExisted(Boolean alreadyExisted) { - this.alreadyExisted = alreadyExisted; - return this; - } + public static class LLMObsAnnotationQueueInteractionResponseItemSerializer + extends StdSerializer { + public LLMObsAnnotationQueueInteractionResponseItemSerializer( + Class t) { + super(t); + } - /** - * Whether this interaction already existed in the queue. - * - * @return alreadyExisted - */ - @JsonProperty(JSON_PROPERTY_ALREADY_EXISTED) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Boolean getAlreadyExisted() { - return alreadyExisted; - } + public LLMObsAnnotationQueueInteractionResponseItemSerializer() { + this(null); + } - public void setAlreadyExisted(Boolean alreadyExisted) { - this.alreadyExisted = alreadyExisted; + @Override + public void serialize( + LLMObsAnnotationQueueInteractionResponseItem value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } } - public LLMObsAnnotationQueueInteractionResponseItem contentId(String contentId) { - this.contentId = contentId; - return this; - } + public static class LLMObsAnnotationQueueInteractionResponseItemDeserializer + extends StdDeserializer { + public LLMObsAnnotationQueueInteractionResponseItemDeserializer() { + this(LLMObsAnnotationQueueInteractionResponseItem.class); + } - /** - * Identifier of the content (trace ID or session ID) for this interaction. - * - * @return contentId - */ - @JsonProperty(JSON_PROPERTY_CONTENT_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getContentId() { - return contentId; - } + public LLMObsAnnotationQueueInteractionResponseItemDeserializer(Class vc) { + super(vc); + } - public void setContentId(String contentId) { - this.contentId = contentId; - } + @Override + public LLMObsAnnotationQueueInteractionResponseItem deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize LLMObsTraceInteractionResponseItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsTraceInteractionResponseItem.class.equals(Integer.class) + || LLMObsTraceInteractionResponseItem.class.equals(Long.class) + || LLMObsTraceInteractionResponseItem.class.equals(Float.class) + || LLMObsTraceInteractionResponseItem.class.equals(Double.class) + || LLMObsTraceInteractionResponseItem.class.equals(Boolean.class) + || LLMObsTraceInteractionResponseItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsTraceInteractionResponseItem.class.equals(Integer.class) + || LLMObsTraceInteractionResponseItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsTraceInteractionResponseItem.class.equals(Float.class) + || LLMObsTraceInteractionResponseItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsTraceInteractionResponseItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsTraceInteractionResponseItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(LLMObsTraceInteractionResponseItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsTraceInteractionResponseItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'LLMObsTraceInteractionResponseItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LLMObsTraceInteractionResponseItem'", + e); + } - public LLMObsAnnotationQueueInteractionResponseItem id(String id) { - this.id = id; - return this; - } + // deserialize LLMObsDisplayBlockInteractionResponseItem + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (LLMObsDisplayBlockInteractionResponseItem.class.equals(Integer.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Long.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Float.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Double.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Boolean.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((LLMObsDisplayBlockInteractionResponseItem.class.equals(Integer.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((LLMObsDisplayBlockInteractionResponseItem.class.equals(Float.class) + || LLMObsDisplayBlockInteractionResponseItem.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (LLMObsDisplayBlockInteractionResponseItem.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (LLMObsDisplayBlockInteractionResponseItem.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = + tree.traverse(jp.getCodec()) + .readValueAs(LLMObsDisplayBlockInteractionResponseItem.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((LLMObsDisplayBlockInteractionResponseItem) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log( + Level.FINER, "Input data matches schema 'LLMObsDisplayBlockInteractionResponseItem'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'LLMObsDisplayBlockInteractionResponseItem'", + e); + } - /** - * Unique identifier of the interaction. - * - * @return id - */ - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public String getId() { - return id; + LLMObsAnnotationQueueInteractionResponseItem ret = + new LLMObsAnnotationQueueInteractionResponseItem(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public LLMObsAnnotationQueueInteractionResponseItem getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "LLMObsAnnotationQueueInteractionResponseItem cannot be null"); + } } - public void setId(String id) { - this.id = id; + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public LLMObsAnnotationQueueInteractionResponseItem() { + super("oneOf", Boolean.FALSE); } - public LLMObsAnnotationQueueInteractionResponseItem type(LLMObsInteractionType type) { - this.type = type; - this.unparsed |= !type.isValid(); - return this; + public LLMObsAnnotationQueueInteractionResponseItem(LLMObsTraceInteractionResponseItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - /** - * Type of interaction in an annotation queue. - * - * @return type - */ - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public LLMObsInteractionType getType() { - return type; + public LLMObsAnnotationQueueInteractionResponseItem(LLMObsDisplayBlockInteractionResponseItem o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - public void setType(LLMObsInteractionType type) { - if (!type.isValid()) { - this.unparsed = true; - } - this.type = type; + static { + schemas.put( + "LLMObsTraceInteractionResponseItem", + new GenericType() {}); + schemas.put( + "LLMObsDisplayBlockInteractionResponseItem", + new GenericType() {}); + JSON.registerDescendants( + LLMObsAnnotationQueueInteractionResponseItem.class, Collections.unmodifiableMap(schemas)); } - /** - * A container for additional, undeclared properties. This is a holder for any undeclared - * properties as specified with the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; + @Override + public Map getSchemas() { + return LLMObsAnnotationQueueInteractionResponseItem.schemas; + } /** - * Set the additional (undeclared) property with the specified name and value. If the property - * does not already exist, create it otherwise replace it. + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: LLMObsTraceInteractionResponseItem, + * LLMObsDisplayBlockInteractionResponseItem * - * @param key The arbitrary key to set - * @param value The associated value - * @return LLMObsAnnotationQueueInteractionResponseItem + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). */ - @JsonAnySetter - public LLMObsAnnotationQueueInteractionResponseItem putAdditionalProperty( - String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf( + LLMObsTraceInteractionResponseItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; } - this.additionalProperties.put(key, value); - return this; + if (JSON.isInstanceOf( + LLMObsDisplayBlockInteractionResponseItem.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be LLMObsTraceInteractionResponseItem," + + " LLMObsDisplayBlockInteractionResponseItem"); } /** - * Return the additional (undeclared) property. + * Get the actual instance, which can be the following: LLMObsTraceInteractionResponseItem, + * LLMObsDisplayBlockInteractionResponseItem * - * @return The additional properties + * @return The actual instance (LLMObsTraceInteractionResponseItem, + * LLMObsDisplayBlockInteractionResponseItem) */ - @JsonAnyGetter - public Map getAdditionalProperties() { - return additionalProperties; + @Override + public Object getActualInstance() { + return super.getActualInstance(); } /** - * Return the additional (undeclared) property with the specified name. + * Get the actual instance of `LLMObsTraceInteractionResponseItem`. If the actual instance is not + * `LLMObsTraceInteractionResponseItem`, the ClassCastException will be thrown. * - * @param key The arbitrary key to get - * @return The specific additional property for the given key + * @return The actual instance of `LLMObsTraceInteractionResponseItem` + * @throws ClassCastException if the instance is not `LLMObsTraceInteractionResponseItem` */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - /** Return true if this LLMObsAnnotationQueueInteractionResponseItem object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - LLMObsAnnotationQueueInteractionResponseItem llmObsAnnotationQueueInteractionResponseItem = - (LLMObsAnnotationQueueInteractionResponseItem) o; - return Objects.equals( - this.alreadyExisted, llmObsAnnotationQueueInteractionResponseItem.alreadyExisted) - && Objects.equals(this.contentId, llmObsAnnotationQueueInteractionResponseItem.contentId) - && Objects.equals(this.id, llmObsAnnotationQueueInteractionResponseItem.id) - && Objects.equals(this.type, llmObsAnnotationQueueInteractionResponseItem.type) - && Objects.equals( - this.additionalProperties, - llmObsAnnotationQueueInteractionResponseItem.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(alreadyExisted, contentId, id, type, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class LLMObsAnnotationQueueInteractionResponseItem {\n"); - sb.append(" alreadyExisted: ").append(toIndentedString(alreadyExisted)).append("\n"); - sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" additionalProperties: ") - .append(toIndentedString(additionalProperties)) - .append("\n"); - sb.append('}'); - return sb.toString(); + public LLMObsTraceInteractionResponseItem getLLMObsTraceInteractionResponseItem() + throws ClassCastException { + return (LLMObsTraceInteractionResponseItem) super.getActualInstance(); } /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). + * Get the actual instance of `LLMObsDisplayBlockInteractionResponseItem`. If the actual instance + * is not `LLMObsDisplayBlockInteractionResponseItem`, the ClassCastException will be thrown. + * + * @return The actual instance of `LLMObsDisplayBlockInteractionResponseItem` + * @throws ClassCastException if the instance is not `LLMObsDisplayBlockInteractionResponseItem` */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + public LLMObsDisplayBlockInteractionResponseItem getLLMObsDisplayBlockInteractionResponseItem() + throws ClassCastException { + return (LLMObsDisplayBlockInteractionResponseItem) super.getActualInstance(); } } diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlock.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlock.java new file mode 100644 index 00000000000..3fd923e8a55 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlock.java @@ -0,0 +1,465 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * A single content block rendered inside a display_block interaction. type + * discriminates which other fields are meaningful: + * + *

+ * + *

height, when set, must be positive. + */ +@JsonPropertyOrder({ + LLMObsContentBlock.JSON_PROPERTY_ALT, + LLMObsContentBlock.JSON_PROPERTY_CONTENT, + LLMObsContentBlock.JSON_PROPERTY_HEIGHT, + LLMObsContentBlock.JSON_PROPERTY_INTERACTION_TYPE, + LLMObsContentBlock.JSON_PROPERTY_LABEL, + LLMObsContentBlock.JSON_PROPERTY_LEVEL, + LLMObsContentBlock.JSON_PROPERTY_TILE_DEF, + LLMObsContentBlock.JSON_PROPERTY_TIME_FRAME, + LLMObsContentBlock.JSON_PROPERTY_TRACE_ID, + LLMObsContentBlock.JSON_PROPERTY_TYPE, + LLMObsContentBlock.JSON_PROPERTY_URL +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsContentBlock { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALT = "alt"; + private String alt; + + public static final String JSON_PROPERTY_CONTENT = "content"; + private Object content = null; + + public static final String JSON_PROPERTY_HEIGHT = "height"; + private Long height; + + public static final String JSON_PROPERTY_INTERACTION_TYPE = "interactionType"; + private LLMObsContentBlockLLMObsTraceInteractionType interactionType; + + public static final String JSON_PROPERTY_LABEL = "label"; + private String label; + + public static final String JSON_PROPERTY_LEVEL = "level"; + private LLMObsContentBlockHeaderLevel level; + + public static final String JSON_PROPERTY_TILE_DEF = "tileDef"; + private Object tileDef = null; + + public static final String JSON_PROPERTY_TIME_FRAME = "timeFrame"; + private LLMObsContentBlockTimeFrame timeFrame; + + public static final String JSON_PROPERTY_TRACE_ID = "traceId"; + private String traceId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsContentBlockType type; + + public static final String JSON_PROPERTY_URL = "url"; + private String url; + + public LLMObsContentBlock() {} + + @JsonCreator + public LLMObsContentBlock( + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsContentBlockType type) { + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsContentBlock alt(String alt) { + this.alt = alt; + return this; + } + + /** + * Alternative text for an image block. + * + * @return alt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ALT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getAlt() { + return alt; + } + + public void setAlt(String alt) { + this.alt = alt; + } + + public LLMObsContentBlock content(Object content) { + this.content = content; + return this; + } + + /** + * Block payload. A string for markdown, header, and text; + * an arbitrary JSON value (object, array, or scalar) for json. Omitted for + * image, widget, and llmobs_trace. + * + * @return content + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CONTENT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getContent() { + return content; + } + + public void setContent(Object content) { + this.content = content; + } + + public LLMObsContentBlock height(Long height) { + this.height = height; + return this; + } + + /** + * Optional rendered height. Must be positive when set. + * + * @return height + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_HEIGHT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getHeight() { + return height; + } + + public void setHeight(Long height) { + this.height = height; + } + + public LLMObsContentBlock interactionType( + LLMObsContentBlockLLMObsTraceInteractionType interactionType) { + this.interactionType = interactionType; + this.unparsed |= !interactionType.isValid(); + return this; + } + + /** + * Upstream interaction type referenced by an llmobs_trace block. Restricted to + * trace or experiment_trace. + * + * @return interactionType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INTERACTION_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LLMObsContentBlockLLMObsTraceInteractionType getInteractionType() { + return interactionType; + } + + public void setInteractionType(LLMObsContentBlockLLMObsTraceInteractionType interactionType) { + if (!interactionType.isValid()) { + this.unparsed = true; + } + this.interactionType = interactionType; + } + + public LLMObsContentBlock label(String label) { + this.label = label; + return this; + } + + /** + * Optional label rendered alongside the block. + * + * @return label + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LABEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public LLMObsContentBlock level(LLMObsContentBlockHeaderLevel level) { + this.level = level; + this.unparsed |= !level.isValid(); + return this; + } + + /** + * Visual size for a header block. + * + * @return level + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LEVEL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LLMObsContentBlockHeaderLevel getLevel() { + return level; + } + + public void setLevel(LLMObsContentBlockHeaderLevel level) { + if (!level.isValid()) { + this.unparsed = true; + } + this.level = level; + } + + public LLMObsContentBlock tileDef(Object tileDef) { + this.tileDef = tileDef; + return this; + } + + /** + * Tile definition for a widget block. Required for widget. The schema + * is owned by the frontend renderer. + * + * @return tileDef + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TILE_DEF) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Object getTileDef() { + return tileDef; + } + + public void setTileDef(Object tileDef) { + this.tileDef = tileDef; + } + + public LLMObsContentBlock timeFrame(LLMObsContentBlockTimeFrame timeFrame) { + this.timeFrame = timeFrame; + this.unparsed |= timeFrame.unparsed; + return this; + } + + /** + * Unix-millis time range used by chart blocks. + * + * @return timeFrame + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIME_FRAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LLMObsContentBlockTimeFrame getTimeFrame() { + return timeFrame; + } + + public void setTimeFrame(LLMObsContentBlockTimeFrame timeFrame) { + this.timeFrame = timeFrame; + } + + public LLMObsContentBlock traceId(String traceId) { + this.traceId = traceId; + return this; + } + + /** + * Trace identifier. Required for llmobs_trace blocks. + * + * @return traceId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TRACE_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + public LLMObsContentBlock type(LLMObsContentBlockType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Discriminator for a single display_block content block. Adding a variant requires + * coordinated changes in the frontend renderer. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsContentBlockType getType() { + return type; + } + + public void setType(LLMObsContentBlockType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public LLMObsContentBlock url(String url) { + this.url = url; + return this; + } + + /** + * URL of the image. Required for image blocks. + * + * @return url + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsContentBlock + */ + @JsonAnySetter + public LLMObsContentBlock putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsContentBlock object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsContentBlock llmObsContentBlock = (LLMObsContentBlock) o; + return Objects.equals(this.alt, llmObsContentBlock.alt) + && Objects.equals(this.content, llmObsContentBlock.content) + && Objects.equals(this.height, llmObsContentBlock.height) + && Objects.equals(this.interactionType, llmObsContentBlock.interactionType) + && Objects.equals(this.label, llmObsContentBlock.label) + && Objects.equals(this.level, llmObsContentBlock.level) + && Objects.equals(this.tileDef, llmObsContentBlock.tileDef) + && Objects.equals(this.timeFrame, llmObsContentBlock.timeFrame) + && Objects.equals(this.traceId, llmObsContentBlock.traceId) + && Objects.equals(this.type, llmObsContentBlock.type) + && Objects.equals(this.url, llmObsContentBlock.url) + && Objects.equals(this.additionalProperties, llmObsContentBlock.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + alt, + content, + height, + interactionType, + label, + level, + tileDef, + timeFrame, + traceId, + type, + url, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsContentBlock {\n"); + sb.append(" alt: ").append(toIndentedString(alt)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" interactionType: ").append(toIndentedString(interactionType)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" level: ").append(toIndentedString(level)).append("\n"); + sb.append(" tileDef: ").append(toIndentedString(tileDef)).append("\n"); + sb.append(" timeFrame: ").append(toIndentedString(timeFrame)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockHeaderLevel.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockHeaderLevel.java new file mode 100644 index 00000000000..1d4356e6cf3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockHeaderLevel.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Visual size for a header block. */ +@JsonSerialize(using = LLMObsContentBlockHeaderLevel.LLMObsContentBlockHeaderLevelSerializer.class) +public class LLMObsContentBlockHeaderLevel extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("sm", "md", "lg", "xl")); + + public static final LLMObsContentBlockHeaderLevel SM = new LLMObsContentBlockHeaderLevel("sm"); + public static final LLMObsContentBlockHeaderLevel MD = new LLMObsContentBlockHeaderLevel("md"); + public static final LLMObsContentBlockHeaderLevel LG = new LLMObsContentBlockHeaderLevel("lg"); + public static final LLMObsContentBlockHeaderLevel XL = new LLMObsContentBlockHeaderLevel("xl"); + + LLMObsContentBlockHeaderLevel(String value) { + super(value, allowedValues); + } + + public static class LLMObsContentBlockHeaderLevelSerializer + extends StdSerializer { + public LLMObsContentBlockHeaderLevelSerializer(Class t) { + super(t); + } + + public LLMObsContentBlockHeaderLevelSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsContentBlockHeaderLevel value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsContentBlockHeaderLevel fromValue(String value) { + return new LLMObsContentBlockHeaderLevel(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockLLMObsTraceInteractionType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockLLMObsTraceInteractionType.java new file mode 100644 index 00000000000..00af8495fe0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockLLMObsTraceInteractionType.java @@ -0,0 +1,68 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Upstream interaction type referenced by an llmobs_trace block. Restricted to + * trace or experiment_trace. + */ +@JsonSerialize( + using = + LLMObsContentBlockLLMObsTraceInteractionType + .LLMObsContentBlockLLMObsTraceInteractionTypeSerializer.class) +public class LLMObsContentBlockLLMObsTraceInteractionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("trace", "experiment_trace")); + + public static final LLMObsContentBlockLLMObsTraceInteractionType TRACE = + new LLMObsContentBlockLLMObsTraceInteractionType("trace"); + public static final LLMObsContentBlockLLMObsTraceInteractionType EXPERIMENT_TRACE = + new LLMObsContentBlockLLMObsTraceInteractionType("experiment_trace"); + + LLMObsContentBlockLLMObsTraceInteractionType(String value) { + super(value, allowedValues); + } + + public static class LLMObsContentBlockLLMObsTraceInteractionTypeSerializer + extends StdSerializer { + public LLMObsContentBlockLLMObsTraceInteractionTypeSerializer( + Class t) { + super(t); + } + + public LLMObsContentBlockLLMObsTraceInteractionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsContentBlockLLMObsTraceInteractionType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsContentBlockLLMObsTraceInteractionType fromValue(String value) { + return new LLMObsContentBlockLLMObsTraceInteractionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockTimeFrame.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockTimeFrame.java new file mode 100644 index 00000000000..34e600a7632 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockTimeFrame.java @@ -0,0 +1,174 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Unix-millis time range used by chart blocks. */ +@JsonPropertyOrder({ + LLMObsContentBlockTimeFrame.JSON_PROPERTY_END, + LLMObsContentBlockTimeFrame.JSON_PROPERTY_START +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsContentBlockTimeFrame { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_END = "end"; + private Long end; + + public static final String JSON_PROPERTY_START = "start"; + private Long start; + + public LLMObsContentBlockTimeFrame() {} + + @JsonCreator + public LLMObsContentBlockTimeFrame( + @JsonProperty(required = true, value = JSON_PROPERTY_END) Long end, + @JsonProperty(required = true, value = JSON_PROPERTY_START) Long start) { + this.end = end; + this.start = start; + } + + public LLMObsContentBlockTimeFrame end(Long end) { + this.end = end; + return this; + } + + /** + * End of the range, in Unix milliseconds. + * + * @return end + */ + @JsonProperty(JSON_PROPERTY_END) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getEnd() { + return end; + } + + public void setEnd(Long end) { + this.end = end; + } + + public LLMObsContentBlockTimeFrame start(Long start) { + this.start = start; + return this; + } + + /** + * Start of the range, in Unix milliseconds. + * + * @return start + */ + @JsonProperty(JSON_PROPERTY_START) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getStart() { + return start; + } + + public void setStart(Long start) { + this.start = start; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsContentBlockTimeFrame + */ + @JsonAnySetter + public LLMObsContentBlockTimeFrame putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsContentBlockTimeFrame object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsContentBlockTimeFrame llmObsContentBlockTimeFrame = (LLMObsContentBlockTimeFrame) o; + return Objects.equals(this.end, llmObsContentBlockTimeFrame.end) + && Objects.equals(this.start, llmObsContentBlockTimeFrame.start) + && Objects.equals( + this.additionalProperties, llmObsContentBlockTimeFrame.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(end, start, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsContentBlockTimeFrame {\n"); + sb.append(" end: ").append(toIndentedString(end)).append("\n"); + sb.append(" start: ").append(toIndentedString(start)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockType.java new file mode 100644 index 00000000000..a5033b69659 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockType.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Discriminator for a single display_block content block. Adding a variant requires + * coordinated changes in the frontend renderer. + */ +@JsonSerialize(using = LLMObsContentBlockType.LLMObsContentBlockTypeSerializer.class) +public class LLMObsContentBlockType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("markdown", "header", "text", "json", "image", "widget", "llmobs_trace")); + + public static final LLMObsContentBlockType MARKDOWN = new LLMObsContentBlockType("markdown"); + public static final LLMObsContentBlockType HEADER = new LLMObsContentBlockType("header"); + public static final LLMObsContentBlockType TEXT = new LLMObsContentBlockType("text"); + public static final LLMObsContentBlockType JSON = new LLMObsContentBlockType("json"); + public static final LLMObsContentBlockType IMAGE = new LLMObsContentBlockType("image"); + public static final LLMObsContentBlockType WIDGET = new LLMObsContentBlockType("widget"); + public static final LLMObsContentBlockType LLMOBS_TRACE = + new LLMObsContentBlockType("llmobs_trace"); + + LLMObsContentBlockType(String value) { + super(value, allowedValues); + } + + public static class LLMObsContentBlockTypeSerializer + extends StdSerializer { + public LLMObsContentBlockTypeSerializer(Class t) { + super(t); + } + + public LLMObsContentBlockTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsContentBlockType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsContentBlockType fromValue(String value) { + return new LLMObsContentBlockType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockAnnotatedInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockAnnotatedInteractionItem.java new file mode 100644 index 00000000000..282e00b2cfa --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockAnnotatedInteractionItem.java @@ -0,0 +1,295 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A display_block interaction with its associated annotations. */ +@JsonPropertyOrder({ + LLMObsDisplayBlockAnnotatedInteractionItem.JSON_PROPERTY_ANNOTATIONS, + LLMObsDisplayBlockAnnotatedInteractionItem.JSON_PROPERTY_CONTENT_ID, + LLMObsDisplayBlockAnnotatedInteractionItem.JSON_PROPERTY_DISPLAY_BLOCK, + LLMObsDisplayBlockAnnotatedInteractionItem.JSON_PROPERTY_ID, + LLMObsDisplayBlockAnnotatedInteractionItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsDisplayBlockAnnotatedInteractionItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANNOTATIONS = "annotations"; + private List annotations = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; + private String contentId; + + public static final String JSON_PROPERTY_DISPLAY_BLOCK = "display_block"; + private List displayBlock = new ArrayList<>(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsDisplayBlockInteractionType type; + + public LLMObsDisplayBlockAnnotatedInteractionItem() {} + + @JsonCreator + public LLMObsDisplayBlockAnnotatedInteractionItem( + @JsonProperty(required = true, value = JSON_PROPERTY_ANNOTATIONS) + List annotations, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_BLOCK) + List displayBlock, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LLMObsDisplayBlockInteractionType type) { + this.annotations = annotations; + this.contentId = contentId; + this.displayBlock = displayBlock; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsDisplayBlockAnnotatedInteractionItem annotations( + List annotations) { + this.annotations = annotations; + for (LLMObsAnnotationItem item : annotations) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem addAnnotationsItem( + LLMObsAnnotationItem annotationsItem) { + this.annotations.add(annotationsItem); + this.unparsed |= annotationsItem.unparsed; + return this; + } + + /** + * List of annotations for this interaction. + * + * @return annotations + */ + @JsonProperty(JSON_PROPERTY_ANNOTATIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAnnotations() { + return annotations; + } + + public void setAnnotations(List annotations) { + this.annotations = annotations; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Server-generated deterministic identifier derived from the block list. + * + * @return contentId + */ + @JsonProperty(JSON_PROPERTY_CONTENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContentId() { + return contentId; + } + + public void setContentId(String contentId) { + this.contentId = contentId; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem displayBlock( + List displayBlock) { + this.displayBlock = displayBlock; + for (LLMObsContentBlock item : displayBlock) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem addDisplayBlockItem( + LLMObsContentBlock displayBlockItem) { + this.displayBlock.add(displayBlockItem); + this.unparsed |= displayBlockItem.unparsed; + return this; + } + + /** + * List of content blocks that make up a display_block interaction. Must contain at + * least one block. + * + * @return displayBlock + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_BLOCK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDisplayBlock() { + return displayBlock; + } + + public void setDisplayBlock(List displayBlock) { + this.displayBlock = displayBlock; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the interaction. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public LLMObsDisplayBlockAnnotatedInteractionItem type(LLMObsDisplayBlockInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type discriminator for a display_block interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsDisplayBlockInteractionType getType() { + return type; + } + + public void setType(LLMObsDisplayBlockInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsDisplayBlockAnnotatedInteractionItem + */ + @JsonAnySetter + public LLMObsDisplayBlockAnnotatedInteractionItem putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsDisplayBlockAnnotatedInteractionItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsDisplayBlockAnnotatedInteractionItem llmObsDisplayBlockAnnotatedInteractionItem = + (LLMObsDisplayBlockAnnotatedInteractionItem) o; + return Objects.equals(this.annotations, llmObsDisplayBlockAnnotatedInteractionItem.annotations) + && Objects.equals(this.contentId, llmObsDisplayBlockAnnotatedInteractionItem.contentId) + && Objects.equals( + this.displayBlock, llmObsDisplayBlockAnnotatedInteractionItem.displayBlock) + && Objects.equals(this.id, llmObsDisplayBlockAnnotatedInteractionItem.id) + && Objects.equals(this.type, llmObsDisplayBlockAnnotatedInteractionItem.type) + && Objects.equals( + this.additionalProperties, + llmObsDisplayBlockAnnotatedInteractionItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(annotations, contentId, displayBlock, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsDisplayBlockAnnotatedInteractionItem {\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); + sb.append(" displayBlock: ").append(toIndentedString(displayBlock)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionItem.java new file mode 100644 index 00000000000..915c2c0fc4b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionItem.java @@ -0,0 +1,198 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * An interaction whose rendered content is supplied directly as a list of display blocks. The + * server generates content_id deterministically from the block list. + */ +@JsonPropertyOrder({ + LLMObsDisplayBlockInteractionItem.JSON_PROPERTY_DISPLAY_BLOCK, + LLMObsDisplayBlockInteractionItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsDisplayBlockInteractionItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DISPLAY_BLOCK = "display_block"; + private List displayBlock = new ArrayList<>(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsDisplayBlockInteractionType type; + + public LLMObsDisplayBlockInteractionItem() {} + + @JsonCreator + public LLMObsDisplayBlockInteractionItem( + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_BLOCK) + List displayBlock, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LLMObsDisplayBlockInteractionType type) { + this.displayBlock = displayBlock; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsDisplayBlockInteractionItem displayBlock(List displayBlock) { + this.displayBlock = displayBlock; + for (LLMObsContentBlock item : displayBlock) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LLMObsDisplayBlockInteractionItem addDisplayBlockItem( + LLMObsContentBlock displayBlockItem) { + this.displayBlock.add(displayBlockItem); + this.unparsed |= displayBlockItem.unparsed; + return this; + } + + /** + * List of content blocks that make up a display_block interaction. Must contain at + * least one block. + * + * @return displayBlock + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_BLOCK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDisplayBlock() { + return displayBlock; + } + + public void setDisplayBlock(List displayBlock) { + this.displayBlock = displayBlock; + } + + public LLMObsDisplayBlockInteractionItem type(LLMObsDisplayBlockInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type discriminator for a display_block interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsDisplayBlockInteractionType getType() { + return type; + } + + public void setType(LLMObsDisplayBlockInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsDisplayBlockInteractionItem + */ + @JsonAnySetter + public LLMObsDisplayBlockInteractionItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsDisplayBlockInteractionItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsDisplayBlockInteractionItem llmObsDisplayBlockInteractionItem = + (LLMObsDisplayBlockInteractionItem) o; + return Objects.equals(this.displayBlock, llmObsDisplayBlockInteractionItem.displayBlock) + && Objects.equals(this.type, llmObsDisplayBlockInteractionItem.type) + && Objects.equals( + this.additionalProperties, llmObsDisplayBlockInteractionItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(displayBlock, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsDisplayBlockInteractionItem {\n"); + sb.append(" displayBlock: ").append(toIndentedString(displayBlock)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionResponseItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionResponseItem.java new file mode 100644 index 00000000000..2945e0db8de --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionResponseItem.java @@ -0,0 +1,282 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A display_block interaction result. */ +@JsonPropertyOrder({ + LLMObsDisplayBlockInteractionResponseItem.JSON_PROPERTY_ALREADY_EXISTED, + LLMObsDisplayBlockInteractionResponseItem.JSON_PROPERTY_CONTENT_ID, + LLMObsDisplayBlockInteractionResponseItem.JSON_PROPERTY_DISPLAY_BLOCK, + LLMObsDisplayBlockInteractionResponseItem.JSON_PROPERTY_ID, + LLMObsDisplayBlockInteractionResponseItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsDisplayBlockInteractionResponseItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALREADY_EXISTED = "already_existed"; + private Boolean alreadyExisted; + + public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; + private String contentId; + + public static final String JSON_PROPERTY_DISPLAY_BLOCK = "display_block"; + private List displayBlock = new ArrayList<>(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsDisplayBlockInteractionType type; + + public LLMObsDisplayBlockInteractionResponseItem() {} + + @JsonCreator + public LLMObsDisplayBlockInteractionResponseItem( + @JsonProperty(required = true, value = JSON_PROPERTY_ALREADY_EXISTED) Boolean alreadyExisted, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, + @JsonProperty(required = true, value = JSON_PROPERTY_DISPLAY_BLOCK) + List displayBlock, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + LLMObsDisplayBlockInteractionType type) { + this.alreadyExisted = alreadyExisted; + this.contentId = contentId; + this.displayBlock = displayBlock; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsDisplayBlockInteractionResponseItem alreadyExisted(Boolean alreadyExisted) { + this.alreadyExisted = alreadyExisted; + return this; + } + + /** + * Whether this interaction already existed in the queue. + * + * @return alreadyExisted + */ + @JsonProperty(JSON_PROPERTY_ALREADY_EXISTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAlreadyExisted() { + return alreadyExisted; + } + + public void setAlreadyExisted(Boolean alreadyExisted) { + this.alreadyExisted = alreadyExisted; + } + + public LLMObsDisplayBlockInteractionResponseItem contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Server-generated deterministic identifier derived from the block list. + * + * @return contentId + */ + @JsonProperty(JSON_PROPERTY_CONTENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContentId() { + return contentId; + } + + public void setContentId(String contentId) { + this.contentId = contentId; + } + + public LLMObsDisplayBlockInteractionResponseItem displayBlock( + List displayBlock) { + this.displayBlock = displayBlock; + for (LLMObsContentBlock item : displayBlock) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LLMObsDisplayBlockInteractionResponseItem addDisplayBlockItem( + LLMObsContentBlock displayBlockItem) { + this.displayBlock.add(displayBlockItem); + this.unparsed |= displayBlockItem.unparsed; + return this; + } + + /** + * List of content blocks that make up a display_block interaction. Must contain at + * least one block. + * + * @return displayBlock + */ + @JsonProperty(JSON_PROPERTY_DISPLAY_BLOCK) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getDisplayBlock() { + return displayBlock; + } + + public void setDisplayBlock(List displayBlock) { + this.displayBlock = displayBlock; + } + + public LLMObsDisplayBlockInteractionResponseItem id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the interaction. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public LLMObsDisplayBlockInteractionResponseItem type(LLMObsDisplayBlockInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type discriminator for a display_block interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsDisplayBlockInteractionType getType() { + return type; + } + + public void setType(LLMObsDisplayBlockInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsDisplayBlockInteractionResponseItem + */ + @JsonAnySetter + public LLMObsDisplayBlockInteractionResponseItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsDisplayBlockInteractionResponseItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsDisplayBlockInteractionResponseItem llmObsDisplayBlockInteractionResponseItem = + (LLMObsDisplayBlockInteractionResponseItem) o; + return Objects.equals( + this.alreadyExisted, llmObsDisplayBlockInteractionResponseItem.alreadyExisted) + && Objects.equals(this.contentId, llmObsDisplayBlockInteractionResponseItem.contentId) + && Objects.equals(this.displayBlock, llmObsDisplayBlockInteractionResponseItem.displayBlock) + && Objects.equals(this.id, llmObsDisplayBlockInteractionResponseItem.id) + && Objects.equals(this.type, llmObsDisplayBlockInteractionResponseItem.type) + && Objects.equals( + this.additionalProperties, + llmObsDisplayBlockInteractionResponseItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(alreadyExisted, contentId, displayBlock, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsDisplayBlockInteractionResponseItem {\n"); + sb.append(" alreadyExisted: ").append(toIndentedString(alreadyExisted)).append("\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); + sb.append(" displayBlock: ").append(toIndentedString(displayBlock)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionType.java new file mode 100644 index 00000000000..7e87b91cd3b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsDisplayBlockInteractionType.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Type discriminator for a display_block interaction. */ +@JsonSerialize( + using = LLMObsDisplayBlockInteractionType.LLMObsDisplayBlockInteractionTypeSerializer.class) +public class LLMObsDisplayBlockInteractionType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("display_block")); + + public static final LLMObsDisplayBlockInteractionType DISPLAY_BLOCK = + new LLMObsDisplayBlockInteractionType("display_block"); + + LLMObsDisplayBlockInteractionType(String value) { + super(value, allowedValues); + } + + public static class LLMObsDisplayBlockInteractionTypeSerializer + extends StdSerializer { + public LLMObsDisplayBlockInteractionTypeSerializer(Class t) { + super(t); + } + + public LLMObsDisplayBlockInteractionTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsDisplayBlockInteractionType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsDisplayBlockInteractionType fromValue(String value) { + return new LLMObsDisplayBlockInteractionType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceAnnotatedInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceAnnotatedInteractionItem.java new file mode 100644 index 00000000000..c008e785db1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceAnnotatedInteractionItem.java @@ -0,0 +1,249 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A trace, experiment trace, or session interaction with its associated annotations. */ +@JsonPropertyOrder({ + LLMObsTraceAnnotatedInteractionItem.JSON_PROPERTY_ANNOTATIONS, + LLMObsTraceAnnotatedInteractionItem.JSON_PROPERTY_CONTENT_ID, + LLMObsTraceAnnotatedInteractionItem.JSON_PROPERTY_ID, + LLMObsTraceAnnotatedInteractionItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsTraceAnnotatedInteractionItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ANNOTATIONS = "annotations"; + private List annotations = new ArrayList<>(); + + public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; + private String contentId; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsTraceInteractionType type; + + public LLMObsTraceAnnotatedInteractionItem() {} + + @JsonCreator + public LLMObsTraceAnnotatedInteractionItem( + @JsonProperty(required = true, value = JSON_PROPERTY_ANNOTATIONS) + List annotations, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsTraceInteractionType type) { + this.annotations = annotations; + this.contentId = contentId; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsTraceAnnotatedInteractionItem annotations(List annotations) { + this.annotations = annotations; + for (LLMObsAnnotationItem item : annotations) { + this.unparsed |= item.unparsed; + } + return this; + } + + public LLMObsTraceAnnotatedInteractionItem addAnnotationsItem( + LLMObsAnnotationItem annotationsItem) { + this.annotations.add(annotationsItem); + this.unparsed |= annotationsItem.unparsed; + return this; + } + + /** + * List of annotations for this interaction. + * + * @return annotations + */ + @JsonProperty(JSON_PROPERTY_ANNOTATIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getAnnotations() { + return annotations; + } + + public void setAnnotations(List annotations) { + this.annotations = annotations; + } + + public LLMObsTraceAnnotatedInteractionItem contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Upstream entity identifier supplied by the caller. + * + * @return contentId + */ + @JsonProperty(JSON_PROPERTY_CONTENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContentId() { + return contentId; + } + + public void setContentId(String contentId) { + this.contentId = contentId; + } + + public LLMObsTraceAnnotatedInteractionItem id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the interaction. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public LLMObsTraceAnnotatedInteractionItem type(LLMObsTraceInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of an upstream-entity interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsTraceInteractionType getType() { + return type; + } + + public void setType(LLMObsTraceInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsTraceAnnotatedInteractionItem + */ + @JsonAnySetter + public LLMObsTraceAnnotatedInteractionItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsTraceAnnotatedInteractionItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsTraceAnnotatedInteractionItem llmObsTraceAnnotatedInteractionItem = + (LLMObsTraceAnnotatedInteractionItem) o; + return Objects.equals(this.annotations, llmObsTraceAnnotatedInteractionItem.annotations) + && Objects.equals(this.contentId, llmObsTraceAnnotatedInteractionItem.contentId) + && Objects.equals(this.id, llmObsTraceAnnotatedInteractionItem.id) + && Objects.equals(this.type, llmObsTraceAnnotatedInteractionItem.type) + && Objects.equals( + this.additionalProperties, llmObsTraceAnnotatedInteractionItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(annotations, contentId, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsTraceAnnotatedInteractionItem {\n"); + sb.append(" annotations: ").append(toIndentedString(annotations)).append("\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionItem.java new file mode 100644 index 00000000000..8c04c7ca718 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionItem.java @@ -0,0 +1,179 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** An interaction that references an upstream trace, experiment trace, or session. */ +@JsonPropertyOrder({ + LLMObsTraceInteractionItem.JSON_PROPERTY_CONTENT_ID, + LLMObsTraceInteractionItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsTraceInteractionItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; + private String contentId; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsTraceInteractionType type; + + public LLMObsTraceInteractionItem() {} + + @JsonCreator + public LLMObsTraceInteractionItem( + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsTraceInteractionType type) { + this.contentId = contentId; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsTraceInteractionItem contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Upstream entity identifier (trace, experiment trace, or session ID). + * + * @return contentId + */ + @JsonProperty(JSON_PROPERTY_CONTENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContentId() { + return contentId; + } + + public void setContentId(String contentId) { + this.contentId = contentId; + } + + public LLMObsTraceInteractionItem type(LLMObsTraceInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of an upstream-entity interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsTraceInteractionType getType() { + return type; + } + + public void setType(LLMObsTraceInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsTraceInteractionItem + */ + @JsonAnySetter + public LLMObsTraceInteractionItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsTraceInteractionItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsTraceInteractionItem llmObsTraceInteractionItem = (LLMObsTraceInteractionItem) o; + return Objects.equals(this.contentId, llmObsTraceInteractionItem.contentId) + && Objects.equals(this.type, llmObsTraceInteractionItem.type) + && Objects.equals( + this.additionalProperties, llmObsTraceInteractionItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(contentId, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsTraceInteractionItem {\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionResponseItem.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionResponseItem.java new file mode 100644 index 00000000000..47caf491a1b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionResponseItem.java @@ -0,0 +1,236 @@ +/* + * 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. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A trace, experiment trace, or session interaction result. */ +@JsonPropertyOrder({ + LLMObsTraceInteractionResponseItem.JSON_PROPERTY_ALREADY_EXISTED, + LLMObsTraceInteractionResponseItem.JSON_PROPERTY_CONTENT_ID, + LLMObsTraceInteractionResponseItem.JSON_PROPERTY_ID, + LLMObsTraceInteractionResponseItem.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsTraceInteractionResponseItem { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALREADY_EXISTED = "already_existed"; + private Boolean alreadyExisted; + + public static final String JSON_PROPERTY_CONTENT_ID = "content_id"; + private String contentId; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsTraceInteractionType type; + + public LLMObsTraceInteractionResponseItem() {} + + @JsonCreator + public LLMObsTraceInteractionResponseItem( + @JsonProperty(required = true, value = JSON_PROPERTY_ALREADY_EXISTED) Boolean alreadyExisted, + @JsonProperty(required = true, value = JSON_PROPERTY_CONTENT_ID) String contentId, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) LLMObsTraceInteractionType type) { + this.alreadyExisted = alreadyExisted; + this.contentId = contentId; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public LLMObsTraceInteractionResponseItem alreadyExisted(Boolean alreadyExisted) { + this.alreadyExisted = alreadyExisted; + return this; + } + + /** + * Whether this interaction already existed in the queue. + * + * @return alreadyExisted + */ + @JsonProperty(JSON_PROPERTY_ALREADY_EXISTED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAlreadyExisted() { + return alreadyExisted; + } + + public void setAlreadyExisted(Boolean alreadyExisted) { + this.alreadyExisted = alreadyExisted; + } + + public LLMObsTraceInteractionResponseItem contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * Upstream entity identifier supplied by the caller. + * + * @return contentId + */ + @JsonProperty(JSON_PROPERTY_CONTENT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getContentId() { + return contentId; + } + + public void setContentId(String contentId) { + this.contentId = contentId; + } + + public LLMObsTraceInteractionResponseItem id(String id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the interaction. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public LLMObsTraceInteractionResponseItem type(LLMObsTraceInteractionType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type of an upstream-entity interaction. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LLMObsTraceInteractionType getType() { + return type; + } + + public void setType(LLMObsTraceInteractionType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return LLMObsTraceInteractionResponseItem + */ + @JsonAnySetter + public LLMObsTraceInteractionResponseItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this LLMObsTraceInteractionResponseItem object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsTraceInteractionResponseItem llmObsTraceInteractionResponseItem = + (LLMObsTraceInteractionResponseItem) o; + return Objects.equals(this.alreadyExisted, llmObsTraceInteractionResponseItem.alreadyExisted) + && Objects.equals(this.contentId, llmObsTraceInteractionResponseItem.contentId) + && Objects.equals(this.id, llmObsTraceInteractionResponseItem.id) + && Objects.equals(this.type, llmObsTraceInteractionResponseItem.type) + && Objects.equals( + this.additionalProperties, llmObsTraceInteractionResponseItem.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(alreadyExisted, contentId, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsTraceInteractionResponseItem {\n"); + sb.append(" alreadyExisted: ").append(toIndentedString(alreadyExisted)).append("\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsInteractionType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionType.java similarity index 52% rename from src/main/java/com/datadog/api/client/v2/model/LLMObsInteractionType.java rename to src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionType.java index 957e41a999f..56fc2f20f5e 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsInteractionType.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsTraceInteractionType.java @@ -18,41 +18,43 @@ import java.util.HashSet; import java.util.Set; -/** Type of interaction in an annotation queue. */ -@JsonSerialize(using = LLMObsInteractionType.LLMObsInteractionTypeSerializer.class) -public class LLMObsInteractionType extends ModelEnum { +/** Type of an upstream-entity interaction. */ +@JsonSerialize(using = LLMObsTraceInteractionType.LLMObsTraceInteractionTypeSerializer.class) +public class LLMObsTraceInteractionType extends ModelEnum { private static final Set allowedValues = new HashSet(Arrays.asList("trace", "experiment_trace", "session")); - public static final LLMObsInteractionType TRACE = new LLMObsInteractionType("trace"); - public static final LLMObsInteractionType EXPERIMENT_TRACE = - new LLMObsInteractionType("experiment_trace"); - public static final LLMObsInteractionType SESSION = new LLMObsInteractionType("session"); + public static final LLMObsTraceInteractionType TRACE = new LLMObsTraceInteractionType("trace"); + public static final LLMObsTraceInteractionType EXPERIMENT_TRACE = + new LLMObsTraceInteractionType("experiment_trace"); + public static final LLMObsTraceInteractionType SESSION = + new LLMObsTraceInteractionType("session"); - LLMObsInteractionType(String value) { + LLMObsTraceInteractionType(String value) { super(value, allowedValues); } - public static class LLMObsInteractionTypeSerializer extends StdSerializer { - public LLMObsInteractionTypeSerializer(Class t) { + public static class LLMObsTraceInteractionTypeSerializer + extends StdSerializer { + public LLMObsTraceInteractionTypeSerializer(Class t) { super(t); } - public LLMObsInteractionTypeSerializer() { + public LLMObsTraceInteractionTypeSerializer() { this(null); } @Override public void serialize( - LLMObsInteractionType value, JsonGenerator jgen, SerializerProvider provider) + LLMObsTraceInteractionType value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.value); } } @JsonCreator - public static LLMObsInteractionType fromValue(String value) { - return new LLMObsInteractionType(value); + public static LLMObsTraceInteractionType fromValue(String value) { + return new LLMObsTraceInteractionType(value); } } diff --git a/src/test/resources/com/datadog/api/client/v2/api/llm_observability.feature b/src/test/resources/com/datadog/api/client/v2/api/llm_observability.feature index 639121ad238..20b95487da8 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/llm_observability.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/llm_observability.feature @@ -8,6 +8,24 @@ Feature: LLM Observability And a valid "appKeyAuth" key in the system And an instance of "LLMObservability" API + @skip @team:DataDog/ml-observability + Scenario: Add a display_block interaction 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": [{"type": "display_block", "display_block": [{"type": "markdown", "content": "## Triage Instructions"}]}]}, "type": "interactions"}} + When the request is sent + Then the response status is 201 Created + + @skip @team:DataDog/ml-observability + Scenario: Add a display_block interaction with an image block missing url 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": [{"type": "display_block", "display_block": [{"type": "image"}]}]}, "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 "Bad Request" response Given operation "CreateLLMObsAnnotationQueueInteractions" enabled