Skip to content

Commit cd2bf58

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add LLM Observability to ListStreamSource (#2522)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 5cf46b4 commit cd2bf58

File tree

7 files changed

+168
-5
lines changed

7 files changed

+168
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-10-16 20:07:17.471714",
8-
"spec_repo_commit": "86072741"
7+
"regenerated": "2024-10-17 14:14:39.709330",
8+
"spec_repo_commit": "fb024a45"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-16 20:07:17.490312",
13-
"spec_repo_commit": "86072741"
12+
"regenerated": "2024-10-17 14:14:39.728219",
13+
"spec_repo_commit": "fb024a45"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4796,6 +4796,7 @@ components:
47964796
- logs_transaction_stream
47974797
- event_stream
47984798
- rum_stream
4799+
- llm_observability_stream
47994800
example: apm_issue_stream
48004801
type: string
48014802
x-enum-varnames:
@@ -4811,6 +4812,7 @@ components:
48114812
- LOGS_TRANSACTION_STREAM
48124813
- EVENT_STREAM
48134814
- RUM_STREAM
4815+
- LLM_OBSERVABILITY_STREAM
48144816
ListStreamWidgetDefinition:
48154817
description: 'The list stream visualization displays a table of recent events
48164818
in your application that
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Create a new dashboard with llm_observability_stream list_stream widget
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.DashboardsApi;
6+
import com.datadog.api.client.v1.model.Dashboard;
7+
import com.datadog.api.client.v1.model.DashboardLayoutType;
8+
import com.datadog.api.client.v1.model.ListStreamColumn;
9+
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
10+
import com.datadog.api.client.v1.model.ListStreamQuery;
11+
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
12+
import com.datadog.api.client.v1.model.ListStreamSource;
13+
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
14+
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
15+
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
16+
import com.datadog.api.client.v1.model.Widget;
17+
import com.datadog.api.client.v1.model.WidgetDefinition;
18+
import java.util.Arrays;
19+
import java.util.Collections;
20+
21+
public class Example {
22+
public static void main(String[] args) {
23+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
24+
DashboardsApi apiInstance = new DashboardsApi(defaultClient);
25+
26+
Dashboard body =
27+
new Dashboard()
28+
.layoutType(DashboardLayoutType.ORDERED)
29+
.title("Example-Dashboard with list_stream widget")
30+
.widgets(
31+
Collections.singletonList(
32+
new Widget()
33+
.definition(
34+
new WidgetDefinition(
35+
new ListStreamWidgetDefinition()
36+
.type(ListStreamWidgetDefinitionType.LIST_STREAM)
37+
.requests(
38+
Collections.singletonList(
39+
new ListStreamWidgetRequest()
40+
.responseFormat(ListStreamResponseFormat.EVENT_LIST)
41+
.query(
42+
new ListStreamQuery()
43+
.dataSource(
44+
ListStreamSource
45+
.LLM_OBSERVABILITY_STREAM)
46+
.queryString(
47+
"@event_type:span"
48+
+ " @parent_id:undefined"))
49+
.columns(
50+
Arrays.asList(
51+
new ListStreamColumn()
52+
.field("@status")
53+
.width(ListStreamColumnWidth.COMPACT),
54+
new ListStreamColumn()
55+
.field("@content.prompt")
56+
.width(ListStreamColumnWidth.AUTO),
57+
new ListStreamColumn()
58+
.field("@content.response.content")
59+
.width(ListStreamColumnWidth.AUTO),
60+
new ListStreamColumn()
61+
.field("timestamp")
62+
.width(ListStreamColumnWidth.AUTO),
63+
new ListStreamColumn()
64+
.field("@ml_app")
65+
.width(ListStreamColumnWidth.AUTO),
66+
new ListStreamColumn()
67+
.field("service")
68+
.width(ListStreamColumnWidth.AUTO),
69+
new ListStreamColumn()
70+
.field("@meta.evaluations.quality")
71+
.width(ListStreamColumnWidth.AUTO),
72+
new ListStreamColumn()
73+
.field("@meta.evaluations.security")
74+
.width(ListStreamColumnWidth.AUTO),
75+
new ListStreamColumn()
76+
.field("@duration")
77+
.width(
78+
ListStreamColumnWidth.AUTO)))))))));
79+
80+
try {
81+
Dashboard result = apiInstance.createDashboard(body);
82+
System.out.println(result);
83+
} catch (ApiException e) {
84+
System.err.println("Exception when calling DashboardsApi#createDashboard");
85+
System.err.println("Status code: " + e.getCode());
86+
System.err.println("Reason: " + e.getResponseBody());
87+
System.err.println("Response headers: " + e.getResponseHeaders());
88+
e.printStackTrace();
89+
}
90+
}
91+
}

src/main/java/com/datadog/api/client/v1/model/ListStreamSource.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public class ListStreamSource extends ModelEnum<String> {
3636
"logs_pattern_stream",
3737
"logs_transaction_stream",
3838
"event_stream",
39-
"rum_stream"));
39+
"rum_stream",
40+
"llm_observability_stream"));
4041

4142
public static final ListStreamSource LOGS_STREAM = new ListStreamSource("logs_stream");
4243
public static final ListStreamSource AUDIT_STREAM = new ListStreamSource("audit_stream");
@@ -54,6 +55,8 @@ public class ListStreamSource extends ModelEnum<String> {
5455
new ListStreamSource("logs_transaction_stream");
5556
public static final ListStreamSource EVENT_STREAM = new ListStreamSource("event_stream");
5657
public static final ListStreamSource RUM_STREAM = new ListStreamSource("rum_stream");
58+
public static final ListStreamSource LLM_OBSERVABILITY_STREAM =
59+
new ListStreamSource("llm_observability_stream");
5760

5861
ListStreamSource(String value) {
5962
super(value, allowedValues);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-10-15T21:46:06.749Z
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"httpRequest": {
4+
"body": {
5+
"type": "JSON",
6+
"json": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget-1729028766 with list_stream widget\",\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"@status\",\"width\":\"compact\"},{\"field\":\"@content.prompt\",\"width\":\"auto\"},{\"field\":\"@content.response.content\",\"width\":\"auto\"},{\"field\":\"timestamp\",\"width\":\"auto\"},{\"field\":\"@ml_app\",\"width\":\"auto\"},{\"field\":\"service\",\"width\":\"auto\"},{\"field\":\"@meta.evaluations.quality\",\"width\":\"auto\"},{\"field\":\"@meta.evaluations.security\",\"width\":\"auto\"},{\"field\":\"@duration\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"llm_observability_stream\",\"indexes\":[],\"query_string\":\"@event_type:span @parent_id:undefined\"},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"}}]}"
7+
},
8+
"headers": {},
9+
"method": "POST",
10+
"path": "/api/v1/dashboard",
11+
"keepAlive": false,
12+
"secure": true
13+
},
14+
"httpResponse": {
15+
"body": "{\"id\":\"k3w-qcg-ug8\",\"title\":\"Test-Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget-1729028766 with list_stream widget\",\"description\":null,\"author_handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"author_name\":\"CI Account\",\"layout_type\":\"ordered\",\"url\":\"/dashboard/k3w-qcg-ug8/test-createanewdashboardwithllmobservabilitystreamliststreamwidget-1729028766-wi\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"columns\":[{\"field\":\"@status\",\"width\":\"compact\"},{\"field\":\"@content.prompt\",\"width\":\"auto\"},{\"field\":\"@content.response.content\",\"width\":\"auto\"},{\"field\":\"timestamp\",\"width\":\"auto\"},{\"field\":\"@ml_app\",\"width\":\"auto\"},{\"field\":\"service\",\"width\":\"auto\"},{\"field\":\"@meta.evaluations.quality\",\"width\":\"auto\"},{\"field\":\"@meta.evaluations.security\",\"width\":\"auto\"},{\"field\":\"@duration\",\"width\":\"auto\"}],\"query\":{\"data_source\":\"llm_observability_stream\",\"indexes\":[],\"query_string\":\"@event_type:span @parent_id:undefined\"},\"response_format\":\"event_list\"}],\"type\":\"list_stream\"},\"id\":8221646523831060}],\"notify_list\":null,\"created_at\":\"2024-10-15T21:46:06.954265+00:00\",\"modified_at\":\"2024-10-15T21:46:06.954265+00:00\",\"restricted_roles\":[]}\n",
16+
"headers": {
17+
"Content-Type": [
18+
"application/json"
19+
]
20+
},
21+
"statusCode": 200,
22+
"reasonPhrase": "OK"
23+
},
24+
"times": {
25+
"remainingTimes": 1
26+
},
27+
"timeToLive": {
28+
"unlimited": true
29+
},
30+
"id": "cf641f4f-8e4f-7935-f5b4-4afac4518e18"
31+
},
32+
{
33+
"httpRequest": {
34+
"headers": {},
35+
"method": "DELETE",
36+
"path": "/api/v1/dashboard/k3w-qcg-ug8",
37+
"keepAlive": false,
38+
"secure": true
39+
},
40+
"httpResponse": {
41+
"body": "{\"deleted_dashboard_id\":\"k3w-qcg-ug8\"}\n",
42+
"headers": {
43+
"Content-Type": [
44+
"application/json"
45+
]
46+
},
47+
"statusCode": 200,
48+
"reasonPhrase": "OK"
49+
},
50+
"times": {
51+
"remainingTimes": 1
52+
},
53+
"timeToLive": {
54+
"unlimited": true
55+
},
56+
"id": "a917abb5-e304-8f7d-e7b8-bd4e3f095748"
57+
}
58+
]

src/test/resources/com/datadog/api/client/v1/api/dashboards.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,14 @@ Feature: Dashboards
500500
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
501501
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"
502502

503+
@team:DataDog/dashboards-backend
504+
Scenario: Create a new dashboard with llm_observability_stream list_stream widget
505+
Given new "CreateDashboard" request
506+
And body with value {"layout_type":"ordered","title":"{{ unique }} with list_stream widget","widgets":[{"definition":{"type":"list_stream","requests":[{"response_format":"event_list","query":{"data_source":"llm_observability_stream","query_string":"@event_type:span @parent_id:undefined","indexes":[]},"columns":[{"field":"@status","width":"compact"},{"field":"@content.prompt","width":"auto"},{"field":"@content.response.content","width":"auto"},{"field":"timestamp","width":"auto"},{"field":"@ml_app","width":"auto"},{"field":"service","width":"auto"},{"field":"@meta.evaluations.quality","width":"auto"},{"field":"@meta.evaluations.security","width":"auto"},{"field":"@duration","width":"auto"}]}]}}]}
507+
When the request is sent
508+
Then the response status is 200 OK
509+
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "llm_observability_stream"
510+
503511
@team:DataDog/dashboards-backend
504512
Scenario: Create a new dashboard with log_stream widget
505513
Given new "CreateDashboard" request

0 commit comments

Comments
 (0)