-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LLM Observability to ListStreamSource (#2522)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
5cf46b4
commit cd2bf58
Showing
7 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...eatures/v1/Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2024-10-15T21:46:06.749Z |
58 changes: 58 additions & 0 deletions
58
.../features/v1/Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters