diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 39623cac69e0..b0ee5756e156 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.rb b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.rb index 44cbcd3b61ce..ba908f873220 100644 --- a/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.rb +++ b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.rb @@ -10,9 +10,9 @@ data: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataRequest.new({ attributes: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataAttributesRequest.new({ interactions: [ - DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionItem.new({ + DatadogAPIClient::V2::LLMObsTraceInteractionItem.new({ content_id: "trace-abc-123", - type: DatadogAPIClient::V2::LLMObsInteractionType::TRACE, + type: DatadogAPIClient::V2::LLMObsTraceInteractionType::TRACE, }), ], }), diff --git a/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.rb b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.rb new file mode 100644 index 000000000000..5591e81d6e04 --- /dev/null +++ b/examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions_2021594537.rb @@ -0,0 +1,27 @@ +# Add a display_block interaction returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_llm_obs_annotation_queue_interactions".to_sym] = true +end +api_instance = DatadogAPIClient::V2::LLMObservabilityAPI.new + +body = DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsRequest.new({ + data: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataRequest.new({ + attributes: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataAttributesRequest.new({ + interactions: [ + DatadogAPIClient::V2::LLMObsDisplayBlockInteractionItem.new({ + type: DatadogAPIClient::V2::LLMObsDisplayBlockInteractionType::DISPLAY_BLOCK, + display_block: [ + DatadogAPIClient::V2::LLMObsContentBlock.new({ + type: DatadogAPIClient::V2::LLMObsContentBlockType::MARKDOWN, + content: "## Triage Instructions", + }), + ], + }), + ], + }), + type: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsType::INTERACTIONS, + }), +}) +p api_instance.create_llm_obs_annotation_queue_interactions("queue_id", body) diff --git a/features/v2/llm_observability.feature b/features/v2/llm_observability.feature index 639121ad2382..20b95487da8b 100644 --- a/features/v2/llm_observability.feature +++ b/features/v2/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 diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 9c4f484bec99..cfd25d9e44ea 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -3600,6 +3600,11 @@ def overrides "v2.llm_obs_annotation_queue_update_data_request" => "LLMObsAnnotationQueueUpdateDataRequest", "v2.llm_obs_annotation_queue_update_request" => "LLMObsAnnotationQueueUpdateRequest", "v2.llm_obs_annotation_schema" => "LLMObsAnnotationSchema", + "v2.llm_obs_content_block" => "LLMObsContentBlock", + "v2.llm_obs_content_block_header_level" => "LLMObsContentBlockHeaderLevel", + "v2.llm_obs_content_block_llm_obs_trace_interaction_type" => "LLMObsContentBlockLLMObsTraceInteractionType", + "v2.llm_obs_content_block_time_frame" => "LLMObsContentBlockTimeFrame", + "v2.llm_obs_content_block_type" => "LLMObsContentBlockType", "v2.llm_obs_cursor_meta" => "LLMObsCursorMeta", "v2.llm_obs_custom_eval_config_assessment_criteria" => "LLMObsCustomEvalConfigAssessmentCriteria", "v2.llm_obs_custom_eval_config_attributes" => "LLMObsCustomEvalConfigAttributes", @@ -3662,6 +3667,10 @@ def overrides "v2.llm_obs_delete_projects_data_attributes_request" => "LLMObsDeleteProjectsDataAttributesRequest", "v2.llm_obs_delete_projects_data_request" => "LLMObsDeleteProjectsDataRequest", "v2.llm_obs_delete_projects_request" => "LLMObsDeleteProjectsRequest", + "v2.llm_obs_display_block_annotated_interaction_item" => "LLMObsDisplayBlockAnnotatedInteractionItem", + "v2.llm_obs_display_block_interaction_item" => "LLMObsDisplayBlockInteractionItem", + "v2.llm_obs_display_block_interaction_response_item" => "LLMObsDisplayBlockInteractionResponseItem", + "v2.llm_obs_display_block_interaction_type" => "LLMObsDisplayBlockInteractionType", "v2.llm_obs_event_type" => "LLMObsEventType", "v2.llm_obs_experiment_data_attributes_request" => "LLMObsExperimentDataAttributesRequest", "v2.llm_obs_experiment_data_attributes_response" => "LLMObsExperimentDataAttributesResponse", @@ -3683,7 +3692,6 @@ def overrides "v2.llm_obs_experiment_update_data_attributes_request" => "LLMObsExperimentUpdateDataAttributesRequest", "v2.llm_obs_experiment_update_data_request" => "LLMObsExperimentUpdateDataRequest", "v2.llm_obs_experiment_update_request" => "LLMObsExperimentUpdateRequest", - "v2.llm_obs_interaction_type" => "LLMObsInteractionType", "v2.llm_obs_label_schema" => "LLMObsLabelSchema", "v2.llm_obs_label_schema_type" => "LLMObsLabelSchemaType", "v2.llm_obs_metric_assessment" => "LLMObsMetricAssessment", @@ -3700,6 +3708,10 @@ def overrides "v2.llm_obs_project_update_data_request" => "LLMObsProjectUpdateDataRequest", "v2.llm_obs_project_update_request" => "LLMObsProjectUpdateRequest", "v2.llm_obs_record_type" => "LLMObsRecordType", + "v2.llm_obs_trace_annotated_interaction_item" => "LLMObsTraceAnnotatedInteractionItem", + "v2.llm_obs_trace_interaction_item" => "LLMObsTraceInteractionItem", + "v2.llm_obs_trace_interaction_response_item" => "LLMObsTraceInteractionResponseItem", + "v2.llm_obs_trace_interaction_type" => "LLMObsTraceInteractionType", "v2.log" => "Log", "v2.log_attributes" => "LogAttributes", "v2.logs_aggregate_bucket" => "LogsAggregateBucket", diff --git a/lib/datadog_api_client/v2/api/llm_observability_api.rb b/lib/datadog_api_client/v2/api/llm_observability_api.rb index 28c76c4b6501..5686a030aca6 100644 --- a/lib/datadog_api_client/v2/api/llm_observability_api.rb +++ b/lib/datadog_api_client/v2/api/llm_observability_api.rb @@ -109,8 +109,16 @@ def create_llm_obs_annotation_queue_interactions(queue_id, body, opts = {}) # Add annotation queue interactions. # - # Add one or more interactions (traces or sessions) to an annotation queue. - # At least one interaction must be provided. + # Add one or more interactions to an annotation queue. At least one + # interaction must be provided. Each interaction has a `type`: + # + # - `trace`, `experiment_trace`, `session`: `content_id` references the + # upstream entity; the server fetches the actual content. + # - `display_block`: omit `content_id` and provide the rendered content + # in `display_block`. The server generates `content_id` as a + # deterministic hash of the block list. + # + # Items of different types can be mixed in a single request. # # @param queue_id [String] The ID of the LLM Observability annotation queue. # @param body [LLMObsAnnotationQueueInteractionsRequest] Add interactions payload. diff --git a/lib/datadog_api_client/v2/models/llm_obs_annotated_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_annotated_interaction_item.rb index fb01c9d09b07..66fdafed5365 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_annotated_interaction_item.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_annotated_interaction_item.rb @@ -18,171 +18,46 @@ module DatadogAPIClient::V2 # An interaction with its associated annotations. - class LLMObsAnnotatedInteractionItem - include BaseGenericModel - - # List of annotations for this interaction. - attr_reader :annotations - - # Identifier of the content (trace ID or session ID) for this interaction. - attr_reader :content_id - - # Unique identifier of the interaction. - attr_reader :id - - # Type of interaction in an annotation queue. - attr_reader :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'annotations' => :'annotations', - :'content_id' => :'content_id', - :'id' => :'id', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'annotations' => :'Array', - :'content_id' => :'String', - :'id' => :'String', - :'type' => :'LLMObsInteractionType' - } - end - - # Initializes the object - # @param attributes [Hash] Model attributes in the form of hash - # @!visibility private - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsAnnotatedInteractionItem` initialize method" - end - - self.additional_properties = {} - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - self.additional_properties[k.to_sym] = v - else - h[k.to_sym] = v - end - } - - if attributes.key?(:'annotations') - if (value = attributes[:'annotations']).is_a?(Array) - self.annotations = value + module LLMObsAnnotatedInteractionItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'LLMObsTraceAnnotatedInteractionItem', + :'LLMObsDisplayBlockAnnotatedInteractionItem' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - end - - if attributes.key?(:'content_id') - self.content_id = attributes[:'content_id'] - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @annotations.nil? - return false if @content_id.nil? - return false if @id.nil? - return false if @type.nil? - true - end - - # Custom attribute writer method with validation - # @param annotations [Object] Object to be assigned - # @!visibility private - def annotations=(annotations) - if annotations.nil? - fail ArgumentError, 'invalid value for "annotations", annotations cannot be nil.' - end - @annotations = annotations - end - - # Custom attribute writer method with validation - # @param content_id [Object] Object to be assigned - # @!visibility private - def content_id=(content_id) - if content_id.nil? - fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' - end - @content_id = content_id - end - - # Custom attribute writer method with validation - # @param id [Object] Object to be assigned - # @!visibility private - def id=(id) - if id.nil? - fail ArgumentError, 'invalid value for "id", id cannot be nil.' - end - @id = id - end - - # Custom attribute writer method with validation - # @param type [Object] Object to be assigned - # @!visibility private - def type=(type) - if type.nil? - fail ArgumentError, 'invalid value for "type", type cannot be nil.' - end - @type = type - end - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) end - - hash[param] = _to_hash(value) end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value - end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - annotations == o.annotations && - content_id == o.content_id && - id == o.id && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [annotations, content_id, id, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_item.rb index 2f8b1b8c7723..1f9307d0cbf6 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_item.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_item.rb @@ -18,127 +18,46 @@ module DatadogAPIClient::V2 # A single interaction to add to an annotation queue. - class LLMObsAnnotationQueueInteractionItem - include BaseGenericModel - - # Identifier of the content (trace ID or session ID) for this interaction. - attr_reader :content_id - - # Type of interaction in an annotation queue. - attr_reader :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'content_id' => :'content_id', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'content_id' => :'String', - :'type' => :'LLMObsInteractionType' - } - end - - # Initializes the object - # @param attributes [Hash] Model attributes in the form of hash - # @!visibility private - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionItem` initialize method" + module LLMObsAnnotationQueueInteractionItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'LLMObsTraceInteractionItem', + :'LLMObsDisplayBlockInteractionItem' + ] end - - self.additional_properties = {} - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - self.additional_properties[k.to_sym] = v - else - h[k.to_sym] = v + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - } - - if attributes.key?(:'content_id') - self.content_id = attributes[:'content_id'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @content_id.nil? - return false if @type.nil? - true - end - - # Custom attribute writer method with validation - # @param content_id [Object] Object to be assigned - # @!visibility private - def content_id=(content_id) - if content_id.nil? - fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' - end - @content_id = content_id - end - - # Custom attribute writer method with validation - # @param type [Object] Object to be assigned - # @!visibility private - def type=(type) - if type.nil? - fail ArgumentError, 'invalid value for "type", type cannot be nil.' - end - @type = type - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) end - - hash[param] = _to_hash(value) end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value - end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - content_id == o.content_id && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [content_id, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_response_item.rb b/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_response_item.rb index b9887ec352c9..77bf88f7a36f 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_response_item.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_annotation_queue_interaction_response_item.rb @@ -18,169 +18,46 @@ module DatadogAPIClient::V2 # A single interaction result. - class LLMObsAnnotationQueueInteractionResponseItem - include BaseGenericModel - - # Whether this interaction already existed in the queue. - attr_reader :already_existed - - # Identifier of the content (trace ID or session ID) for this interaction. - attr_reader :content_id - - # Unique identifier of the interaction. - attr_reader :id - - # Type of interaction in an annotation queue. - attr_reader :type - - attr_accessor :additional_properties - - # Attribute mapping from ruby-style variable name to JSON key. - # @!visibility private - def self.attribute_map - { - :'already_existed' => :'already_existed', - :'content_id' => :'content_id', - :'id' => :'id', - :'type' => :'type' - } - end - - # Attribute type mapping. - # @!visibility private - def self.openapi_types - { - :'already_existed' => :'Boolean', - :'content_id' => :'String', - :'id' => :'String', - :'type' => :'LLMObsInteractionType' - } - end - - # Initializes the object - # @param attributes [Hash] Model attributes in the form of hash - # @!visibility private - def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionResponseItem` initialize method" - end - - self.additional_properties = {} - # check to see if the attribute exists and convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - self.additional_properties[k.to_sym] = v - else - h[k.to_sym] = v + module LLMObsAnnotationQueueInteractionResponseItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'LLMObsTraceInteractionResponseItem', + :'LLMObsDisplayBlockInteractionResponseItem' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end end - } - - if attributes.key?(:'already_existed') - self.already_existed = attributes[:'already_existed'] - end - - if attributes.key?(:'content_id') - self.content_id = attributes[:'content_id'] - end - - if attributes.key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.key?(:'type') - self.type = attributes[:'type'] - end - end - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - # @!visibility private - def valid? - return false if @already_existed.nil? - return false if @content_id.nil? - return false if @id.nil? - return false if @type.nil? - true - end - - # Custom attribute writer method with validation - # @param already_existed [Object] Object to be assigned - # @!visibility private - def already_existed=(already_existed) - if already_existed.nil? - fail ArgumentError, 'invalid value for "already_existed", already_existed cannot be nil.' - end - @already_existed = already_existed - end - - # Custom attribute writer method with validation - # @param content_id [Object] Object to be assigned - # @!visibility private - def content_id=(content_id) - if content_id.nil? - fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' - end - @content_id = content_id - end - - # Custom attribute writer method with validation - # @param id [Object] Object to be assigned - # @!visibility private - def id=(id) - if id.nil? - fail ArgumentError, 'invalid value for "id", id cannot be nil.' - end - @id = id - end - - # Custom attribute writer method with validation - # @param type [Object] Object to be assigned - # @!visibility private - def type=(type) - if type.nil? - fail ArgumentError, 'invalid value for "type", type cannot be nil.' - end - @type = type - end - - # Returns the object in the form of hash, with additionalProperties support. - # @return [Hash] Returns the object in the form of hash - # @!visibility private - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - if value.nil? - is_nullable = self.class.openapi_nullable.include?(attr) - next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) end - - hash[param] = _to_hash(value) end - self.additional_properties.each_pair do |attr, value| - hash[attr] = value - end - hash - end - - # Checks equality by comparing each attribute. - # @param o [Object] Object to be compared - # @!visibility private - def ==(o) - return true if self.equal?(o) - self.class == o.class && - already_existed == o.already_existed && - content_id == o.content_id && - id == o.id && - type == o.type && - additional_properties == o.additional_properties - end - - # Calculates hash code according to all attributes. - # @return [Integer] Hash code - # @!visibility private - def hash - [already_existed, content_id, id, type, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block.rb new file mode 100644 index 000000000000..e70890624bd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block.rb @@ -0,0 +1,238 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # 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. + class LLMObsContentBlock + include BaseGenericModel + + # Alternative text for an `image` block. + attr_accessor :alt + + # 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`. + attr_accessor :content + + # Optional rendered height. Must be positive when set. + attr_accessor :height + + # Upstream interaction type referenced by an `llmobs_trace` block. + # Restricted to `trace` or `experiment_trace`. + attr_accessor :interaction_type + + # Optional label rendered alongside the block. + attr_accessor :label + + # Visual size for a `header` block. + attr_accessor :level + + # Tile definition for a `widget` block. Required for `widget`. The + # schema is owned by the frontend renderer. + attr_accessor :tile_def + + # Unix-millis time range used by chart blocks. + attr_accessor :time_frame + + # Trace identifier. Required for `llmobs_trace` blocks. + attr_accessor :trace_id + + # Discriminator for a single `display_block` content block. Adding a + # variant requires coordinated changes in the frontend renderer. + attr_reader :type + + # URL of the image. Required for `image` blocks. + attr_accessor :url + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'alt' => :'alt', + :'content' => :'content', + :'height' => :'height', + :'interaction_type' => :'interactionType', + :'label' => :'label', + :'level' => :'level', + :'tile_def' => :'tileDef', + :'time_frame' => :'timeFrame', + :'trace_id' => :'traceId', + :'type' => :'type', + :'url' => :'url' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'alt' => :'String', + :'content' => :'Object', + :'height' => :'Integer', + :'interaction_type' => :'LLMObsContentBlockLLMObsTraceInteractionType', + :'label' => :'String', + :'level' => :'LLMObsContentBlockHeaderLevel', + :'tile_def' => :'Object', + :'time_frame' => :'LLMObsContentBlockTimeFrame', + :'trace_id' => :'String', + :'type' => :'LLMObsContentBlockType', + :'url' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsContentBlock` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'alt') + self.alt = attributes[:'alt'] + end + + if attributes.key?(:'content') + self.content = attributes[:'content'] + end + + if attributes.key?(:'height') + self.height = attributes[:'height'] + end + + if attributes.key?(:'interaction_type') + self.interaction_type = attributes[:'interaction_type'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + + if attributes.key?(:'level') + self.level = attributes[:'level'] + end + + if attributes.key?(:'tile_def') + self.tile_def = attributes[:'tile_def'] + end + + if attributes.key?(:'time_frame') + self.time_frame = attributes[:'time_frame'] + end + + if attributes.key?(:'trace_id') + self.trace_id = attributes[:'trace_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + alt == o.alt && + content == o.content && + height == o.height && + interaction_type == o.interaction_type && + label == o.label && + level == o.level && + tile_def == o.tile_def && + time_frame == o.time_frame && + trace_id == o.trace_id && + type == o.type && + url == o.url && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [alt, content, height, interaction_type, label, level, tile_def, time_frame, trace_id, type, url, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block_header_level.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block_header_level.rb new file mode 100644 index 000000000000..75db1da2c76a --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block_header_level.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Visual size for a `header` block. + class LLMObsContentBlockHeaderLevel + include BaseEnumModel + + SM = "sm".freeze + MD = "md".freeze + LG = "lg".freeze + XL = "xl".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block_llm_obs_trace_interaction_type.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block_llm_obs_trace_interaction_type.rb new file mode 100644 index 000000000000..c6946bee74fa --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block_llm_obs_trace_interaction_type.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Upstream interaction type referenced by an `llmobs_trace` block. + # Restricted to `trace` or `experiment_trace`. + class LLMObsContentBlockLLMObsTraceInteractionType + include BaseEnumModel + + TRACE = "trace".freeze + EXPERIMENT_TRACE = "experiment_trace".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block_time_frame.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block_time_frame.rb new file mode 100644 index 000000000000..5bfbb2088733 --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block_time_frame.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Unix-millis time range used by chart blocks. + class LLMObsContentBlockTimeFrame + include BaseGenericModel + + # End of the range, in Unix milliseconds. + attr_reader :_end + + # Start of the range, in Unix milliseconds. + attr_reader :start + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'_end' => :'end', + :'start' => :'start' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'_end' => :'Integer', + :'start' => :'Integer' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsContentBlockTimeFrame` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @_end.nil? + return false if @start.nil? + true + end + + # Custom attribute writer method with validation + # @param _end [Object] Object to be assigned + # @!visibility private + def _end=(_end) + if _end.nil? + fail ArgumentError, 'invalid value for "_end", _end cannot be nil.' + end + @_end = _end + end + + # Custom attribute writer method with validation + # @param start [Object] Object to be assigned + # @!visibility private + def start=(start) + if start.nil? + fail ArgumentError, 'invalid value for "start", start cannot be nil.' + end + @start = start + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + _end == o._end && + start == o.start && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [_end, start, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb b/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb new file mode 100644 index 000000000000..339b2c1a600c --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_content_block_type.rb @@ -0,0 +1,33 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Discriminator for a single `display_block` content block. Adding a + # variant requires coordinated changes in the frontend renderer. + class LLMObsContentBlockType + include BaseEnumModel + + MARKDOWN = "markdown".freeze + HEADER = "header".freeze + TEXT = "text".freeze + JSON = "json".freeze + IMAGE = "image".freeze + WIDGET = "widget".freeze + LLMOBS_TRACE = "llmobs_trace".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_display_block_annotated_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_display_block_annotated_interaction_item.rb new file mode 100644 index 000000000000..ba264b0c8d73 --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_display_block_annotated_interaction_item.rb @@ -0,0 +1,216 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A display_block interaction with its associated annotations. + class LLMObsDisplayBlockAnnotatedInteractionItem + include BaseGenericModel + + # List of annotations for this interaction. + attr_reader :annotations + + # Server-generated deterministic identifier derived from the block list. + attr_reader :content_id + + # List of content blocks that make up a `display_block` interaction. + # Must contain at least one block. + attr_reader :display_block + + # Unique identifier of the interaction. + attr_reader :id + + # Type discriminator for a `display_block` interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'annotations' => :'annotations', + :'content_id' => :'content_id', + :'display_block' => :'display_block', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'annotations' => :'Array', + :'content_id' => :'String', + :'display_block' => :'Array', + :'id' => :'String', + :'type' => :'LLMObsDisplayBlockInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsDisplayBlockAnnotatedInteractionItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'annotations') + if (value = attributes[:'annotations']).is_a?(Array) + self.annotations = value + end + end + + if attributes.key?(:'content_id') + self.content_id = attributes[:'content_id'] + end + + if attributes.key?(:'display_block') + if (value = attributes[:'display_block']).is_a?(Array) + self.display_block = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @annotations.nil? + return false if @content_id.nil? + return false if @display_block.nil? + return false if @display_block.length < 1 + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param annotations [Object] Object to be assigned + # @!visibility private + def annotations=(annotations) + if annotations.nil? + fail ArgumentError, 'invalid value for "annotations", annotations cannot be nil.' + end + @annotations = annotations + end + + # Custom attribute writer method with validation + # @param content_id [Object] Object to be assigned + # @!visibility private + def content_id=(content_id) + if content_id.nil? + fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' + end + @content_id = content_id + end + + # Custom attribute writer method with validation + # @param display_block [Object] Object to be assigned + # @!visibility private + def display_block=(display_block) + if display_block.nil? + fail ArgumentError, 'invalid value for "display_block", display_block cannot be nil.' + end + if display_block.length < 1 + fail ArgumentError, 'invalid value for "display_block", number of items must be greater than or equal to 1.' + end + @display_block = display_block + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + annotations == o.annotations && + content_id == o.content_id && + display_block == o.display_block && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [annotations, content_id, display_block, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_item.rb new file mode 100644 index 000000000000..f8ad86f3c645 --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_item.rb @@ -0,0 +1,153 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An interaction whose rendered content is supplied directly as a list + # of display blocks. The server generates `content_id` deterministically + # from the block list. + class LLMObsDisplayBlockInteractionItem + include BaseGenericModel + + # List of content blocks that make up a `display_block` interaction. + # Must contain at least one block. + attr_reader :display_block + + # Type discriminator for a `display_block` interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'display_block' => :'display_block', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'display_block' => :'Array', + :'type' => :'LLMObsDisplayBlockInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsDisplayBlockInteractionItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'display_block') + if (value = attributes[:'display_block']).is_a?(Array) + self.display_block = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @display_block.nil? + return false if @display_block.length < 1 + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param display_block [Object] Object to be assigned + # @!visibility private + def display_block=(display_block) + if display_block.nil? + fail ArgumentError, 'invalid value for "display_block", display_block cannot be nil.' + end + if display_block.length < 1 + fail ArgumentError, 'invalid value for "display_block", number of items must be greater than or equal to 1.' + end + @display_block = display_block + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + display_block == o.display_block && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [display_block, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_response_item.rb b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_response_item.rb new file mode 100644 index 000000000000..240d5fab7bee --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_response_item.rb @@ -0,0 +1,214 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A display_block interaction result. + class LLMObsDisplayBlockInteractionResponseItem + include BaseGenericModel + + # Whether this interaction already existed in the queue. + attr_reader :already_existed + + # Server-generated deterministic identifier derived from the block list. + attr_reader :content_id + + # List of content blocks that make up a `display_block` interaction. + # Must contain at least one block. + attr_reader :display_block + + # Unique identifier of the interaction. + attr_reader :id + + # Type discriminator for a `display_block` interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'already_existed' => :'already_existed', + :'content_id' => :'content_id', + :'display_block' => :'display_block', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'already_existed' => :'Boolean', + :'content_id' => :'String', + :'display_block' => :'Array', + :'id' => :'String', + :'type' => :'LLMObsDisplayBlockInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsDisplayBlockInteractionResponseItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'already_existed') + self.already_existed = attributes[:'already_existed'] + end + + if attributes.key?(:'content_id') + self.content_id = attributes[:'content_id'] + end + + if attributes.key?(:'display_block') + if (value = attributes[:'display_block']).is_a?(Array) + self.display_block = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @already_existed.nil? + return false if @content_id.nil? + return false if @display_block.nil? + return false if @display_block.length < 1 + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param already_existed [Object] Object to be assigned + # @!visibility private + def already_existed=(already_existed) + if already_existed.nil? + fail ArgumentError, 'invalid value for "already_existed", already_existed cannot be nil.' + end + @already_existed = already_existed + end + + # Custom attribute writer method with validation + # @param content_id [Object] Object to be assigned + # @!visibility private + def content_id=(content_id) + if content_id.nil? + fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' + end + @content_id = content_id + end + + # Custom attribute writer method with validation + # @param display_block [Object] Object to be assigned + # @!visibility private + def display_block=(display_block) + if display_block.nil? + fail ArgumentError, 'invalid value for "display_block", display_block cannot be nil.' + end + if display_block.length < 1 + fail ArgumentError, 'invalid value for "display_block", number of items must be greater than or equal to 1.' + end + @display_block = display_block + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + already_existed == o.already_existed && + content_id == o.content_id && + display_block == o.display_block && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [already_existed, content_id, display_block, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_type.rb b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_type.rb new file mode 100644 index 000000000000..7e1a7adfc48b --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_display_block_interaction_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Type discriminator for a `display_block` interaction. + class LLMObsDisplayBlockInteractionType + include BaseEnumModel + + DISPLAY_BLOCK = "display_block".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_trace_annotated_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_trace_annotated_interaction_item.rb new file mode 100644 index 000000000000..254a74d968be --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_trace_annotated_interaction_item.rb @@ -0,0 +1,188 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A trace, experiment trace, or session interaction with its associated annotations. + class LLMObsTraceAnnotatedInteractionItem + include BaseGenericModel + + # List of annotations for this interaction. + attr_reader :annotations + + # Upstream entity identifier supplied by the caller. + attr_reader :content_id + + # Unique identifier of the interaction. + attr_reader :id + + # Type of an upstream-entity interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'annotations' => :'annotations', + :'content_id' => :'content_id', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'annotations' => :'Array', + :'content_id' => :'String', + :'id' => :'String', + :'type' => :'LLMObsTraceInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsTraceAnnotatedInteractionItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'annotations') + if (value = attributes[:'annotations']).is_a?(Array) + self.annotations = value + end + end + + if attributes.key?(:'content_id') + self.content_id = attributes[:'content_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @annotations.nil? + return false if @content_id.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param annotations [Object] Object to be assigned + # @!visibility private + def annotations=(annotations) + if annotations.nil? + fail ArgumentError, 'invalid value for "annotations", annotations cannot be nil.' + end + @annotations = annotations + end + + # Custom attribute writer method with validation + # @param content_id [Object] Object to be assigned + # @!visibility private + def content_id=(content_id) + if content_id.nil? + fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' + end + @content_id = content_id + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + annotations == o.annotations && + content_id == o.content_id && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [annotations, content_id, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_item.rb b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_item.rb new file mode 100644 index 000000000000..b05b8158e203 --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_item.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An interaction that references an upstream trace, experiment trace, or session. + class LLMObsTraceInteractionItem + include BaseGenericModel + + # Upstream entity identifier (trace, experiment trace, or session ID). + attr_reader :content_id + + # Type of an upstream-entity interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'content_id' => :'content_id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'content_id' => :'String', + :'type' => :'LLMObsTraceInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsTraceInteractionItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'content_id') + self.content_id = attributes[:'content_id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @content_id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param content_id [Object] Object to be assigned + # @!visibility private + def content_id=(content_id) + if content_id.nil? + fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' + end + @content_id = content_id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + content_id == o.content_id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [content_id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_response_item.rb b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_response_item.rb new file mode 100644 index 000000000000..734867e96a2b --- /dev/null +++ b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_response_item.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A trace, experiment trace, or session interaction result. + class LLMObsTraceInteractionResponseItem + include BaseGenericModel + + # Whether this interaction already existed in the queue. + attr_reader :already_existed + + # Upstream entity identifier supplied by the caller. + attr_reader :content_id + + # Unique identifier of the interaction. + attr_reader :id + + # Type of an upstream-entity interaction. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'already_existed' => :'already_existed', + :'content_id' => :'content_id', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'already_existed' => :'Boolean', + :'content_id' => :'String', + :'id' => :'String', + :'type' => :'LLMObsTraceInteractionType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsTraceInteractionResponseItem` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'already_existed') + self.already_existed = attributes[:'already_existed'] + end + + if attributes.key?(:'content_id') + self.content_id = attributes[:'content_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @already_existed.nil? + return false if @content_id.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param already_existed [Object] Object to be assigned + # @!visibility private + def already_existed=(already_existed) + if already_existed.nil? + fail ArgumentError, 'invalid value for "already_existed", already_existed cannot be nil.' + end + @already_existed = already_existed + end + + # Custom attribute writer method with validation + # @param content_id [Object] Object to be assigned + # @!visibility private + def content_id=(content_id) + if content_id.nil? + fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.' + end + @content_id = content_id + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + already_existed == o.already_existed && + content_id == o.content_id && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [already_existed, content_id, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/llm_obs_interaction_type.rb b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_type.rb similarity index 89% rename from lib/datadog_api_client/v2/models/llm_obs_interaction_type.rb rename to lib/datadog_api_client/v2/models/llm_obs_trace_interaction_type.rb index f0cdde032576..1f13396dd854 100644 --- a/lib/datadog_api_client/v2/models/llm_obs_interaction_type.rb +++ b/lib/datadog_api_client/v2/models/llm_obs_trace_interaction_type.rb @@ -17,8 +17,8 @@ require 'time' module DatadogAPIClient::V2 - # Type of interaction in an annotation queue. - class LLMObsInteractionType + # Type of an upstream-entity interaction. + class LLMObsTraceInteractionType include BaseEnumModel TRACE = "trace".freeze