diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 1a0972d5a21..ef3ae811327 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -57962,6 +57962,9 @@ components: type: string type: object LLMObsContentBlock: + anyOf: + - $ref: '#/components/schemas/LLMObsFrontendContentBlock' + - $ref: '#/components/schemas/LLMObsLegacyContentBlock' description: |- A single content block rendered inside a `display_block` interaction. `type` discriminates which other fields are meaningful: @@ -57972,6 +57975,7 @@ components: - `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`. + - `frontend`: `code` is required and must be a non-empty string; `label` is optional. `height`, when set, must be positive. properties: @@ -57979,11 +57983,13 @@ components: description: Alternative text for an `image` block. example: "Example image" type: string + code: + $ref: '#/components/schemas/LLMObsFrontendContentBlockCode' 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`. + for `image`, `widget`, `llmobs_trace`, and `frontend`. example: "## Triage Instructions" height: description: Optional rendered height. Must be positive when set. @@ -57993,7 +57999,7 @@ components: interactionType: $ref: '#/components/schemas/LLMObsContentBlockLLMObsTraceInteractionType' label: - description: Optional label rendered alongside the block. + description: Optional label rendered alongside a `frontend` block. example: "Triage Instructions" type: string level: @@ -58081,6 +58087,7 @@ components: - image - widget - llmobs_trace + - frontend example: markdown type: string x-enum-varnames: @@ -58091,6 +58098,7 @@ components: - IMAGE - WIDGET - LLMOBS_TRACE + - FRONTEND LLMObsContentBlocks: description: |- List of content blocks that make up a `display_block` interaction. @@ -60915,6 +60923,29 @@ components: required: - data type: object + LLMObsFrontendContentBlock: + description: Validation requirements for a `frontend` display block. + properties: + code: + $ref: '#/components/schemas/LLMObsFrontendContentBlockCode' + type: + $ref: '#/components/schemas/LLMObsFrontendContentBlockType' + required: + - code + type: object + LLMObsFrontendContentBlockCode: + description: HTML code rendered by a `frontend` block. Required for `frontend` blocks. + example: '
Ready for review
' + minLength: 1 + type: string + LLMObsFrontendContentBlockType: + description: Type discriminator for a `frontend` display block. + enum: + - frontend + example: frontend + type: string + x-enum-varnames: + - FRONTEND LLMObsInferenceCode: description: A generated code snippet for running an inference request programmatically. properties: @@ -61520,6 +61551,32 @@ components: - CATEGORICAL - BOOLEAN - TEXT + LLMObsLegacyContentBlock: + description: Validation requirements for an existing non-frontend display block. + properties: + type: + $ref: '#/components/schemas/LLMObsLegacyContentBlockType' + type: object + LLMObsLegacyContentBlockType: + description: Type discriminator for an existing non-frontend display block. + enum: + - markdown + - header + - text + - json + - image + - widget + - llmobs_trace + example: markdown + type: string + x-enum-varnames: + - MARKDOWN + - HEADER + - TEXT + - JSON + - IMAGE + - WIDGET + - LLMOBS_TRACE LLMObsMetricAssessment: description: Assessment result for an Agent Observability experiment metric. enum: @@ -169960,6 +170017,9 @@ paths: experiment_id: abc-123 label: "Experiments" type: json + - code: '
Ready for review
' + label: "Review status" + type: frontend type: display_block type: interactions schema: 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 index f28719cbd88..e57253cb2c5 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlock.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlock.java @@ -32,12 +32,15 @@ * owns the renderable schema). *
  • llmobs_trace: traceId is required; interactionType, * when set, must be trace or experiment_trace. + *
  • frontend: code is required and must be a non-empty string; + * label is optional. * * *

    height, when set, must be positive. */ @JsonPropertyOrder({ LLMObsContentBlock.JSON_PROPERTY_ALT, + LLMObsContentBlock.JSON_PROPERTY_CODE, LLMObsContentBlock.JSON_PROPERTY_CONTENT, LLMObsContentBlock.JSON_PROPERTY_HEIGHT, LLMObsContentBlock.JSON_PROPERTY_INTERACTION_TYPE, @@ -56,6 +59,9 @@ public class LLMObsContentBlock { public static final String JSON_PROPERTY_ALT = "alt"; private String alt; + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + public static final String JSON_PROPERTY_CONTENT = "content"; private Object content = null; @@ -116,6 +122,27 @@ public void setAlt(String alt) { this.alt = alt; } + public LLMObsContentBlock code(String code) { + this.code = code; + return this; + } + + /** + * HTML code rendered by a frontend block. Required for frontend blocks. + * + * @return code + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public LLMObsContentBlock content(Object content) { this.content = content; return this; @@ -124,7 +151,7 @@ public LLMObsContentBlock content(Object content) { /** * 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. + * image, widget, llmobs_trace, and frontend. * * @return content */ @@ -193,7 +220,7 @@ public LLMObsContentBlock label(String label) { } /** - * Optional label rendered alongside the block. + * Optional label rendered alongside a frontend block. * * @return label */ @@ -404,6 +431,7 @@ public boolean equals(Object o) { } LLMObsContentBlock llmObsContentBlock = (LLMObsContentBlock) o; return Objects.equals(this.alt, llmObsContentBlock.alt) + && Objects.equals(this.code, llmObsContentBlock.code) && Objects.equals(this.content, llmObsContentBlock.content) && Objects.equals(this.height, llmObsContentBlock.height) && Objects.equals(this.interactionType, llmObsContentBlock.interactionType) @@ -421,6 +449,7 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash( alt, + code, content, height, interactionType, @@ -439,6 +468,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class LLMObsContentBlock {\n"); sb.append(" alt: ").append(toIndentedString(alt)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).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"); 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 index a5033b69659..e65cf323892 100644 --- a/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockType.java +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsContentBlockType.java @@ -27,7 +27,8 @@ public class LLMObsContentBlockType extends ModelEnum { private static final Set allowedValues = new HashSet( - Arrays.asList("markdown", "header", "text", "json", "image", "widget", "llmobs_trace")); + Arrays.asList( + "markdown", "header", "text", "json", "image", "widget", "llmobs_trace", "frontend")); public static final LLMObsContentBlockType MARKDOWN = new LLMObsContentBlockType("markdown"); public static final LLMObsContentBlockType HEADER = new LLMObsContentBlockType("header"); @@ -37,6 +38,7 @@ public class LLMObsContentBlockType extends ModelEnum { public static final LLMObsContentBlockType WIDGET = new LLMObsContentBlockType("widget"); public static final LLMObsContentBlockType LLMOBS_TRACE = new LLMObsContentBlockType("llmobs_trace"); + public static final LLMObsContentBlockType FRONTEND = new LLMObsContentBlockType("frontend"); LLMObsContentBlockType(String value) { super(value, allowedValues); diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsFrontendContentBlock.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsFrontendContentBlock.java new file mode 100644 index 00000000000..9ee7d2e68a3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsFrontendContentBlock.java @@ -0,0 +1,177 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +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; + +/** Validation requirements for a frontend display block. */ +@JsonPropertyOrder({ + LLMObsFrontendContentBlock.JSON_PROPERTY_CODE, + LLMObsFrontendContentBlock.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsFrontendContentBlock { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CODE = "code"; + private String code; + + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsFrontendContentBlockType type; + + public LLMObsFrontendContentBlock() {} + + @JsonCreator + public LLMObsFrontendContentBlock( + @JsonProperty(required = true, value = JSON_PROPERTY_CODE) String code) { + this.code = code; + } + + public LLMObsFrontendContentBlock code(String code) { + this.code = code; + return this; + } + + /** + * HTML code rendered by a frontend block. Required for frontend blocks. + * + * @return code + */ + @JsonProperty(JSON_PROPERTY_CODE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public LLMObsFrontendContentBlock type(LLMObsFrontendContentBlockType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type discriminator for a frontend display block. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LLMObsFrontendContentBlockType getType() { + return type; + } + + public void setType(LLMObsFrontendContentBlockType 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 LLMObsFrontendContentBlock + */ + @JsonAnySetter + public LLMObsFrontendContentBlock 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 LLMObsFrontendContentBlock object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsFrontendContentBlock llmObsFrontendContentBlock = (LLMObsFrontendContentBlock) o; + return Objects.equals(this.code, llmObsFrontendContentBlock.code) + && Objects.equals(this.type, llmObsFrontendContentBlock.type) + && Objects.equals( + this.additionalProperties, llmObsFrontendContentBlock.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsFrontendContentBlock {\n"); + sb.append(" code: ").append(toIndentedString(code)).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/LLMObsFrontendContentBlockType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsFrontendContentBlockType.java new file mode 100644 index 00000000000..632bc0a458b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsFrontendContentBlockType.java @@ -0,0 +1,57 @@ +/* + * 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 frontend display block. */ +@JsonSerialize( + using = LLMObsFrontendContentBlockType.LLMObsFrontendContentBlockTypeSerializer.class) +public class LLMObsFrontendContentBlockType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("frontend")); + + public static final LLMObsFrontendContentBlockType FRONTEND = + new LLMObsFrontendContentBlockType("frontend"); + + LLMObsFrontendContentBlockType(String value) { + super(value, allowedValues); + } + + public static class LLMObsFrontendContentBlockTypeSerializer + extends StdSerializer { + public LLMObsFrontendContentBlockTypeSerializer(Class t) { + super(t); + } + + public LLMObsFrontendContentBlockTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsFrontendContentBlockType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsFrontendContentBlockType fromValue(String value) { + return new LLMObsFrontendContentBlockType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/LLMObsLegacyContentBlock.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsLegacyContentBlock.java new file mode 100644 index 00000000000..b2f68514cd1 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsLegacyContentBlock.java @@ -0,0 +1,139 @@ +/* + * 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.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; + +/** Validation requirements for an existing non-frontend display block. */ +@JsonPropertyOrder({LLMObsLegacyContentBlock.JSON_PROPERTY_TYPE}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class LLMObsLegacyContentBlock { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_TYPE = "type"; + private LLMObsLegacyContentBlockType type; + + public LLMObsLegacyContentBlock type(LLMObsLegacyContentBlockType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Type discriminator for an existing non-frontend display block. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public LLMObsLegacyContentBlockType getType() { + return type; + } + + public void setType(LLMObsLegacyContentBlockType 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 LLMObsLegacyContentBlock + */ + @JsonAnySetter + public LLMObsLegacyContentBlock 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 LLMObsLegacyContentBlock object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LLMObsLegacyContentBlock llmObsLegacyContentBlock = (LLMObsLegacyContentBlock) o; + return Objects.equals(this.type, llmObsLegacyContentBlock.type) + && Objects.equals(this.additionalProperties, llmObsLegacyContentBlock.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LLMObsLegacyContentBlock {\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/LLMObsLegacyContentBlockType.java b/src/main/java/com/datadog/api/client/v2/model/LLMObsLegacyContentBlockType.java new file mode 100644 index 00000000000..db5ab192002 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/LLMObsLegacyContentBlockType.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; + +/** Type discriminator for an existing non-frontend display block. */ +@JsonSerialize(using = LLMObsLegacyContentBlockType.LLMObsLegacyContentBlockTypeSerializer.class) +public class LLMObsLegacyContentBlockType extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList("markdown", "header", "text", "json", "image", "widget", "llmobs_trace")); + + public static final LLMObsLegacyContentBlockType MARKDOWN = + new LLMObsLegacyContentBlockType("markdown"); + public static final LLMObsLegacyContentBlockType HEADER = + new LLMObsLegacyContentBlockType("header"); + public static final LLMObsLegacyContentBlockType TEXT = new LLMObsLegacyContentBlockType("text"); + public static final LLMObsLegacyContentBlockType JSON = new LLMObsLegacyContentBlockType("json"); + public static final LLMObsLegacyContentBlockType IMAGE = + new LLMObsLegacyContentBlockType("image"); + public static final LLMObsLegacyContentBlockType WIDGET = + new LLMObsLegacyContentBlockType("widget"); + public static final LLMObsLegacyContentBlockType LLMOBS_TRACE = + new LLMObsLegacyContentBlockType("llmobs_trace"); + + LLMObsLegacyContentBlockType(String value) { + super(value, allowedValues); + } + + public static class LLMObsLegacyContentBlockTypeSerializer + extends StdSerializer { + public LLMObsLegacyContentBlockTypeSerializer(Class t) { + super(t); + } + + public LLMObsLegacyContentBlockTypeSerializer() { + this(null); + } + + @Override + public void serialize( + LLMObsLegacyContentBlockType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static LLMObsLegacyContentBlockType fromValue(String value) { + return new LLMObsLegacyContentBlockType(value); + } +}