Skip to content

Commit

Permalink
Add LLM Observability to ListStreamSource (#2522)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 17, 2024
1 parent 5cf46b4 commit cd2bf58
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-16 20:07:17.471714",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 14:14:39.709330",
"spec_repo_commit": "fb024a45"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-10-16 20:07:17.490312",
"spec_repo_commit": "86072741"
"regenerated": "2024-10-17 14:14:39.728219",
"spec_repo_commit": "fb024a45"
}
}
}
2 changes: 2 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4796,6 +4796,7 @@ components:
- logs_transaction_stream
- event_stream
- rum_stream
- llm_observability_stream
example: apm_issue_stream
type: string
x-enum-varnames:
Expand All @@ -4811,6 +4812,7 @@ components:
- LOGS_TRANSACTION_STREAM
- EVENT_STREAM
- RUM_STREAM
- LLM_OBSERVABILITY_STREAM
ListStreamWidgetDefinition:
description: 'The list stream visualization displays a table of recent events
in your application that
Expand Down
91 changes: 91 additions & 0 deletions examples/v1/dashboards/CreateDashboard_3298564989.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Create a new dashboard with llm_observability_stream list_stream widget

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.DashboardsApi;
import com.datadog.api.client.v1.model.Dashboard;
import com.datadog.api.client.v1.model.DashboardLayoutType;
import com.datadog.api.client.v1.model.ListStreamColumn;
import com.datadog.api.client.v1.model.ListStreamColumnWidth;
import com.datadog.api.client.v1.model.ListStreamQuery;
import com.datadog.api.client.v1.model.ListStreamResponseFormat;
import com.datadog.api.client.v1.model.ListStreamSource;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinition;
import com.datadog.api.client.v1.model.ListStreamWidgetDefinitionType;
import com.datadog.api.client.v1.model.ListStreamWidgetRequest;
import com.datadog.api.client.v1.model.Widget;
import com.datadog.api.client.v1.model.WidgetDefinition;
import java.util.Arrays;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
DashboardsApi apiInstance = new DashboardsApi(defaultClient);

Dashboard body =
new Dashboard()
.layoutType(DashboardLayoutType.ORDERED)
.title("Example-Dashboard with list_stream widget")
.widgets(
Collections.singletonList(
new Widget()
.definition(
new WidgetDefinition(
new ListStreamWidgetDefinition()
.type(ListStreamWidgetDefinitionType.LIST_STREAM)
.requests(
Collections.singletonList(
new ListStreamWidgetRequest()
.responseFormat(ListStreamResponseFormat.EVENT_LIST)
.query(
new ListStreamQuery()
.dataSource(
ListStreamSource
.LLM_OBSERVABILITY_STREAM)
.queryString(
"@event_type:span"
+ " @parent_id:undefined"))
.columns(
Arrays.asList(
new ListStreamColumn()
.field("@status")
.width(ListStreamColumnWidth.COMPACT),
new ListStreamColumn()
.field("@content.prompt")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("@content.response.content")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("timestamp")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("@ml_app")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("service")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("@meta.evaluations.quality")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("@meta.evaluations.security")
.width(ListStreamColumnWidth.AUTO),
new ListStreamColumn()
.field("@duration")
.width(
ListStreamColumnWidth.AUTO)))))))));

try {
Dashboard result = apiInstance.createDashboard(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DashboardsApi#createDashboard");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class ListStreamSource extends ModelEnum<String> {
"logs_pattern_stream",
"logs_transaction_stream",
"event_stream",
"rum_stream"));
"rum_stream",
"llm_observability_stream"));

public static final ListStreamSource LOGS_STREAM = new ListStreamSource("logs_stream");
public static final ListStreamSource AUDIT_STREAM = new ListStreamSource("audit_stream");
Expand All @@ -54,6 +55,8 @@ public class ListStreamSource extends ModelEnum<String> {
new ListStreamSource("logs_transaction_stream");
public static final ListStreamSource EVENT_STREAM = new ListStreamSource("event_stream");
public static final ListStreamSource RUM_STREAM = new ListStreamSource("rum_stream");
public static final ListStreamSource LLM_OBSERVABILITY_STREAM =
new ListStreamSource("llm_observability_stream");

ListStreamSource(String value) {
super(value, allowedValues);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-15T21:46:06.749Z
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"httpRequest": {
"body": {
"type": "JSON",
"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\"}}]}"
},
"headers": {},
"method": "POST",
"path": "/api/v1/dashboard",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"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",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "cf641f4f-8e4f-7935-f5b4-4afac4518e18"
},
{
"httpRequest": {
"headers": {},
"method": "DELETE",
"path": "/api/v1/dashboard/k3w-qcg-ug8",
"keepAlive": false,
"secure": true
},
"httpResponse": {
"body": "{\"deleted_dashboard_id\":\"k3w-qcg-ug8\"}\n",
"headers": {
"Content-Type": [
"application/json"
]
},
"statusCode": 200,
"reasonPhrase": "OK"
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
},
"id": "a917abb5-e304-8f7d-e7b8-bd4e3f095748"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,14 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].query.sort.column" is equal to "timestamp"
And the response "widgets[0].definition.requests[0].query.sort.order" is equal to "desc"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with llm_observability_stream list_stream widget
Given new "CreateDashboard" request
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"}]}]}}]}
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].query.data_source" is equal to "llm_observability_stream"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with log_stream widget
Given new "CreateDashboard" request
Expand Down

0 comments on commit cd2bf58

Please sign in to comment.