Skip to content

Commit 1112d55

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit c429f9e of spec repo
1 parent 82987f5 commit 1112d55

22 files changed

Lines changed: 2128 additions & 511 deletions

.generator/schemas/v2/openapi.yaml

Lines changed: 350 additions & 68 deletions
Large diffs are not rendered by default.

examples/v2/llm-observability/CreateLLMObsAnnotationQueueInteractions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
data: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataRequest.new({
1111
attributes: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataAttributesRequest.new({
1212
interactions: [
13-
DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionItem.new({
13+
DatadogAPIClient::V2::LLMObsTraceInteractionItem.new({
1414
content_id: "trace-abc-123",
15-
type: DatadogAPIClient::V2::LLMObsInteractionType::TRACE,
15+
type: DatadogAPIClient::V2::LLMObsTraceInteractionType::TRACE,
1616
}),
1717
],
1818
}),
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Add a display_block interaction returns "Created" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.create_llm_obs_annotation_queue_interactions".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::LLMObservabilityAPI.new
8+
9+
body = DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsRequest.new({
10+
data: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataRequest.new({
11+
attributes: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsDataAttributesRequest.new({
12+
interactions: [
13+
DatadogAPIClient::V2::LLMObsDisplayBlockInteractionItem.new({
14+
type: DatadogAPIClient::V2::LLMObsDisplayBlockInteractionType::DISPLAY_BLOCK,
15+
display_block: [
16+
DatadogAPIClient::V2::LLMObsContentBlock.new({
17+
type: DatadogAPIClient::V2::LLMObsContentBlockType::MARKDOWN,
18+
content: "## Triage Instructions",
19+
}),
20+
],
21+
}),
22+
],
23+
}),
24+
type: DatadogAPIClient::V2::LLMObsAnnotationQueueInteractionsType::INTERACTIONS,
25+
}),
26+
})
27+
p api_instance.create_llm_obs_annotation_queue_interactions("queue_id", body)

features/v2/llm_observability.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ Feature: LLM Observability
88
And a valid "appKeyAuth" key in the system
99
And an instance of "LLMObservability" API
1010

11+
@skip @team:DataDog/ml-observability
12+
Scenario: Add a display_block interaction returns "Created" response
13+
Given operation "CreateLLMObsAnnotationQueueInteractions" enabled
14+
And new "CreateLLMObsAnnotationQueueInteractions" request
15+
And request contains "queue_id" parameter from "REPLACE.ME"
16+
And body with value {"data": {"attributes": {"interactions": [{"type": "display_block", "display_block": [{"type": "markdown", "content": "## Triage Instructions"}]}]}, "type": "interactions"}}
17+
When the request is sent
18+
Then the response status is 201 Created
19+
20+
@skip @team:DataDog/ml-observability
21+
Scenario: Add a display_block interaction with an image block missing url returns "Bad Request" response
22+
Given operation "CreateLLMObsAnnotationQueueInteractions" enabled
23+
And new "CreateLLMObsAnnotationQueueInteractions" request
24+
And request contains "queue_id" parameter from "REPLACE.ME"
25+
And body with value {"data": {"attributes": {"interactions": [{"type": "display_block", "display_block": [{"type": "image"}]}]}, "type": "interactions"}}
26+
When the request is sent
27+
Then the response status is 400 Bad Request
28+
1129
@generated @skip @team:DataDog/ml-observability
1230
Scenario: Add annotation queue interactions returns "Bad Request" response
1331
Given operation "CreateLLMObsAnnotationQueueInteractions" enabled

lib/datadog_api_client/inflector.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3600,6 +3600,11 @@ def overrides
36003600
"v2.llm_obs_annotation_queue_update_data_request" => "LLMObsAnnotationQueueUpdateDataRequest",
36013601
"v2.llm_obs_annotation_queue_update_request" => "LLMObsAnnotationQueueUpdateRequest",
36023602
"v2.llm_obs_annotation_schema" => "LLMObsAnnotationSchema",
3603+
"v2.llm_obs_content_block" => "LLMObsContentBlock",
3604+
"v2.llm_obs_content_block_header_level" => "LLMObsContentBlockHeaderLevel",
3605+
"v2.llm_obs_content_block_llm_obs_trace_interaction_type" => "LLMObsContentBlockLLMObsTraceInteractionType",
3606+
"v2.llm_obs_content_block_time_frame" => "LLMObsContentBlockTimeFrame",
3607+
"v2.llm_obs_content_block_type" => "LLMObsContentBlockType",
36033608
"v2.llm_obs_cursor_meta" => "LLMObsCursorMeta",
36043609
"v2.llm_obs_custom_eval_config_assessment_criteria" => "LLMObsCustomEvalConfigAssessmentCriteria",
36053610
"v2.llm_obs_custom_eval_config_attributes" => "LLMObsCustomEvalConfigAttributes",
@@ -3662,6 +3667,10 @@ def overrides
36623667
"v2.llm_obs_delete_projects_data_attributes_request" => "LLMObsDeleteProjectsDataAttributesRequest",
36633668
"v2.llm_obs_delete_projects_data_request" => "LLMObsDeleteProjectsDataRequest",
36643669
"v2.llm_obs_delete_projects_request" => "LLMObsDeleteProjectsRequest",
3670+
"v2.llm_obs_display_block_annotated_interaction_item" => "LLMObsDisplayBlockAnnotatedInteractionItem",
3671+
"v2.llm_obs_display_block_interaction_item" => "LLMObsDisplayBlockInteractionItem",
3672+
"v2.llm_obs_display_block_interaction_response_item" => "LLMObsDisplayBlockInteractionResponseItem",
3673+
"v2.llm_obs_display_block_interaction_type" => "LLMObsDisplayBlockInteractionType",
36653674
"v2.llm_obs_event_type" => "LLMObsEventType",
36663675
"v2.llm_obs_experiment_data_attributes_request" => "LLMObsExperimentDataAttributesRequest",
36673676
"v2.llm_obs_experiment_data_attributes_response" => "LLMObsExperimentDataAttributesResponse",
@@ -3683,7 +3692,6 @@ def overrides
36833692
"v2.llm_obs_experiment_update_data_attributes_request" => "LLMObsExperimentUpdateDataAttributesRequest",
36843693
"v2.llm_obs_experiment_update_data_request" => "LLMObsExperimentUpdateDataRequest",
36853694
"v2.llm_obs_experiment_update_request" => "LLMObsExperimentUpdateRequest",
3686-
"v2.llm_obs_interaction_type" => "LLMObsInteractionType",
36873695
"v2.llm_obs_label_schema" => "LLMObsLabelSchema",
36883696
"v2.llm_obs_label_schema_type" => "LLMObsLabelSchemaType",
36893697
"v2.llm_obs_metric_assessment" => "LLMObsMetricAssessment",
@@ -3700,6 +3708,10 @@ def overrides
37003708
"v2.llm_obs_project_update_data_request" => "LLMObsProjectUpdateDataRequest",
37013709
"v2.llm_obs_project_update_request" => "LLMObsProjectUpdateRequest",
37023710
"v2.llm_obs_record_type" => "LLMObsRecordType",
3711+
"v2.llm_obs_trace_annotated_interaction_item" => "LLMObsTraceAnnotatedInteractionItem",
3712+
"v2.llm_obs_trace_interaction_item" => "LLMObsTraceInteractionItem",
3713+
"v2.llm_obs_trace_interaction_response_item" => "LLMObsTraceInteractionResponseItem",
3714+
"v2.llm_obs_trace_interaction_type" => "LLMObsTraceInteractionType",
37033715
"v2.log" => "Log",
37043716
"v2.log_attributes" => "LogAttributes",
37053717
"v2.logs_aggregate_bucket" => "LogsAggregateBucket",

lib/datadog_api_client/v2/api/llm_observability_api.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,16 @@ def create_llm_obs_annotation_queue_interactions(queue_id, body, opts = {})
109109

110110
# Add annotation queue interactions.
111111
#
112-
# Add one or more interactions (traces or sessions) to an annotation queue.
113-
# At least one interaction must be provided.
112+
# Add one or more interactions to an annotation queue. At least one
113+
# interaction must be provided. Each interaction has a `type`:
114+
#
115+
# - `trace`, `experiment_trace`, `session`: `content_id` references the
116+
# upstream entity; the server fetches the actual content.
117+
# - `display_block`: omit `content_id` and provide the rendered content
118+
# in `display_block`. The server generates `content_id` as a
119+
# deterministic hash of the block list.
120+
#
121+
# Items of different types can be mixed in a single request.
114122
#
115123
# @param queue_id [String] The ID of the LLM Observability annotation queue.
116124
# @param body [LLMObsAnnotationQueueInteractionsRequest] Add interactions payload.

lib/datadog_api_client/v2/models/llm_obs_annotated_interaction_item.rb

Lines changed: 36 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -18,171 +18,46 @@
1818

1919
module DatadogAPIClient::V2
2020
# An interaction with its associated annotations.
21-
class LLMObsAnnotatedInteractionItem
22-
include BaseGenericModel
23-
24-
# List of annotations for this interaction.
25-
attr_reader :annotations
26-
27-
# Identifier of the content (trace ID or session ID) for this interaction.
28-
attr_reader :content_id
29-
30-
# Unique identifier of the interaction.
31-
attr_reader :id
32-
33-
# Type of interaction in an annotation queue.
34-
attr_reader :type
35-
36-
attr_accessor :additional_properties
37-
38-
# Attribute mapping from ruby-style variable name to JSON key.
39-
# @!visibility private
40-
def self.attribute_map
41-
{
42-
:'annotations' => :'annotations',
43-
:'content_id' => :'content_id',
44-
:'id' => :'id',
45-
:'type' => :'type'
46-
}
47-
end
48-
49-
# Attribute type mapping.
50-
# @!visibility private
51-
def self.openapi_types
52-
{
53-
:'annotations' => :'Array<LLMObsAnnotationItem>',
54-
:'content_id' => :'String',
55-
:'id' => :'String',
56-
:'type' => :'LLMObsInteractionType'
57-
}
58-
end
59-
60-
# Initializes the object
61-
# @param attributes [Hash] Model attributes in the form of hash
62-
# @!visibility private
63-
def initialize(attributes = {})
64-
if (!attributes.is_a?(Hash))
65-
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::LLMObsAnnotatedInteractionItem` initialize method"
66-
end
67-
68-
self.additional_properties = {}
69-
# check to see if the attribute exists and convert string to symbol for hash key
70-
attributes = attributes.each_with_object({}) { |(k, v), h|
71-
if (!self.class.attribute_map.key?(k.to_sym))
72-
self.additional_properties[k.to_sym] = v
73-
else
74-
h[k.to_sym] = v
75-
end
76-
}
77-
78-
if attributes.key?(:'annotations')
79-
if (value = attributes[:'annotations']).is_a?(Array)
80-
self.annotations = value
21+
module LLMObsAnnotatedInteractionItem
22+
class << self
23+
include BaseOneOfModel
24+
include BaseOneOfModelNoDiscriminator
25+
26+
# List of class defined in oneOf (OpenAPI v3)
27+
def openapi_one_of
28+
[
29+
:'LLMObsTraceAnnotatedInteractionItem',
30+
:'LLMObsDisplayBlockAnnotatedInteractionItem'
31+
]
32+
end
33+
# Builds the object
34+
# @param data [Mixed] Data to be matched against the list of oneOf items
35+
# @return [Object] Returns the model or the data itself
36+
def build(data)
37+
# Go through the list of oneOf items and attempt to identify the appropriate one.
38+
# Note:
39+
# - We do not attempt to check whether exactly one item matches.
40+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
41+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
42+
# - TODO: scalar values are de facto behaving as if they were nullable.
43+
# - TODO: logging when debugging is set.
44+
openapi_one_of.each do |klass|
45+
begin
46+
next if klass == :AnyType # "nullable: true"
47+
typed_data = find_and_cast_into_type(klass, data)
48+
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
49+
return typed_data if typed_data
50+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
51+
end
8152
end
82-
end
83-
84-
if attributes.key?(:'content_id')
85-
self.content_id = attributes[:'content_id']
86-
end
87-
88-
if attributes.key?(:'id')
89-
self.id = attributes[:'id']
90-
end
91-
92-
if attributes.key?(:'type')
93-
self.type = attributes[:'type']
94-
end
95-
end
96-
97-
# Check to see if the all the properties in the model are valid
98-
# @return true if the model is valid
99-
# @!visibility private
100-
def valid?
101-
return false if @annotations.nil?
102-
return false if @content_id.nil?
103-
return false if @id.nil?
104-
return false if @type.nil?
105-
true
106-
end
107-
108-
# Custom attribute writer method with validation
109-
# @param annotations [Object] Object to be assigned
110-
# @!visibility private
111-
def annotations=(annotations)
112-
if annotations.nil?
113-
fail ArgumentError, 'invalid value for "annotations", annotations cannot be nil.'
114-
end
115-
@annotations = annotations
116-
end
117-
118-
# Custom attribute writer method with validation
119-
# @param content_id [Object] Object to be assigned
120-
# @!visibility private
121-
def content_id=(content_id)
122-
if content_id.nil?
123-
fail ArgumentError, 'invalid value for "content_id", content_id cannot be nil.'
124-
end
125-
@content_id = content_id
126-
end
127-
128-
# Custom attribute writer method with validation
129-
# @param id [Object] Object to be assigned
130-
# @!visibility private
131-
def id=(id)
132-
if id.nil?
133-
fail ArgumentError, 'invalid value for "id", id cannot be nil.'
134-
end
135-
@id = id
136-
end
137-
138-
# Custom attribute writer method with validation
139-
# @param type [Object] Object to be assigned
140-
# @!visibility private
141-
def type=(type)
142-
if type.nil?
143-
fail ArgumentError, 'invalid value for "type", type cannot be nil.'
144-
end
145-
@type = type
146-
end
14753

148-
# Returns the object in the form of hash, with additionalProperties support.
149-
# @return [Hash] Returns the object in the form of hash
150-
# @!visibility private
151-
def to_hash
152-
hash = {}
153-
self.class.attribute_map.each_pair do |attr, param|
154-
value = self.send(attr)
155-
if value.nil?
156-
is_nullable = self.class.openapi_nullable.include?(attr)
157-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
54+
if openapi_one_of.include?(:AnyType)
55+
data
56+
else
57+
self._unparsed = true
58+
DatadogAPIClient::UnparsedObject.new(data)
15859
end
159-
160-
hash[param] = _to_hash(value)
16160
end
162-
self.additional_properties.each_pair do |attr, value|
163-
hash[attr] = value
164-
end
165-
hash
166-
end
167-
168-
# Checks equality by comparing each attribute.
169-
# @param o [Object] Object to be compared
170-
# @!visibility private
171-
def ==(o)
172-
return true if self.equal?(o)
173-
self.class == o.class &&
174-
annotations == o.annotations &&
175-
content_id == o.content_id &&
176-
id == o.id &&
177-
type == o.type &&
178-
additional_properties == o.additional_properties
179-
end
180-
181-
# Calculates hash code according to all attributes.
182-
# @return [Integer] Hash code
183-
# @!visibility private
184-
def hash
185-
[annotations, content_id, id, type, additional_properties].hash
18661
end
18762
end
18863
end

0 commit comments

Comments
 (0)