Skip to content

Commit b25ee8d

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add LLM Observability to ListStreamSource (#335)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 39afce1 commit b25ee8d

File tree

7 files changed

+155
-4
lines changed

7 files changed

+155
-4
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:15.312516",
8-
"spec_repo_commit": "86072741"
7+
"regenerated": "2024-10-17 14:10:52.681900",
8+
"spec_repo_commit": "fb024a45"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-10-16 20:07:15.331877",
13-
"spec_repo_commit": "86072741"
12+
"regenerated": "2024-10-17 14:10:52.700421",
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: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Create a new dashboard with llm_observability_stream list_stream widget
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
4+
use datadog_api_client::datadogV1::model::Dashboard;
5+
use datadog_api_client::datadogV1::model::DashboardLayoutType;
6+
use datadog_api_client::datadogV1::model::ListStreamColumn;
7+
use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
8+
use datadog_api_client::datadogV1::model::ListStreamQuery;
9+
use datadog_api_client::datadogV1::model::ListStreamResponseFormat;
10+
use datadog_api_client::datadogV1::model::ListStreamSource;
11+
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinition;
12+
use datadog_api_client::datadogV1::model::ListStreamWidgetDefinitionType;
13+
use datadog_api_client::datadogV1::model::ListStreamWidgetRequest;
14+
use datadog_api_client::datadogV1::model::Widget;
15+
use datadog_api_client::datadogV1::model::WidgetDefinition;
16+
17+
#[tokio::main]
18+
async fn main() {
19+
let body = Dashboard::new(
20+
DashboardLayoutType::ORDERED,
21+
"Example-Dashboard with list_stream widget".to_string(),
22+
vec![Widget::new(WidgetDefinition::ListStreamWidgetDefinition(
23+
Box::new(ListStreamWidgetDefinition::new(
24+
vec![ListStreamWidgetRequest::new(
25+
vec![
26+
ListStreamColumn::new(
27+
"@status".to_string(),
28+
ListStreamColumnWidth::COMPACT,
29+
),
30+
ListStreamColumn::new(
31+
"@content.prompt".to_string(),
32+
ListStreamColumnWidth::AUTO,
33+
),
34+
ListStreamColumn::new(
35+
"@content.response.content".to_string(),
36+
ListStreamColumnWidth::AUTO,
37+
),
38+
ListStreamColumn::new("timestamp".to_string(), ListStreamColumnWidth::AUTO),
39+
ListStreamColumn::new("@ml_app".to_string(), ListStreamColumnWidth::AUTO),
40+
ListStreamColumn::new("service".to_string(), ListStreamColumnWidth::AUTO),
41+
ListStreamColumn::new(
42+
"@meta.evaluations.quality".to_string(),
43+
ListStreamColumnWidth::AUTO,
44+
),
45+
ListStreamColumn::new(
46+
"@meta.evaluations.security".to_string(),
47+
ListStreamColumnWidth::AUTO,
48+
),
49+
ListStreamColumn::new("@duration".to_string(), ListStreamColumnWidth::AUTO),
50+
],
51+
ListStreamQuery::new(
52+
ListStreamSource::LLM_OBSERVABILITY_STREAM,
53+
"@event_type:span @parent_id:undefined".to_string(),
54+
)
55+
.indexes(vec![]),
56+
ListStreamResponseFormat::EVENT_LIST,
57+
)],
58+
ListStreamWidgetDefinitionType::LIST_STREAM,
59+
)),
60+
))],
61+
);
62+
let configuration = datadog::Configuration::new();
63+
let api = DashboardsAPI::with_config(configuration);
64+
let resp = api.create_dashboard(body).await;
65+
if let Ok(value) = resp {
66+
println!("{:#?}", value);
67+
} else {
68+
println!("{:#?}", resp.unwrap_err());
69+
}
70+
}

src/datadogV1/model/model_list_stream_source.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub enum ListStreamSource {
1919
LOGS_TRANSACTION_STREAM,
2020
EVENT_STREAM,
2121
RUM_STREAM,
22+
LLM_OBSERVABILITY_STREAM,
2223
UnparsedObject(crate::datadog::UnparsedObject),
2324
}
2425

@@ -37,6 +38,7 @@ impl ToString for ListStreamSource {
3738
Self::LOGS_TRANSACTION_STREAM => String::from("logs_transaction_stream"),
3839
Self::EVENT_STREAM => String::from("event_stream"),
3940
Self::RUM_STREAM => String::from("rum_stream"),
41+
Self::LLM_OBSERVABILITY_STREAM => String::from("llm_observability_stream"),
4042
Self::UnparsedObject(v) => v.value.to_string(),
4143
}
4244
}
@@ -73,6 +75,7 @@ impl<'de> Deserialize<'de> for ListStreamSource {
7375
"logs_transaction_stream" => Self::LOGS_TRANSACTION_STREAM,
7476
"event_stream" => Self::EVENT_STREAM,
7577
"rum_stream" => Self::RUM_STREAM,
78+
"llm_observability_stream" => Self::LLM_OBSERVABILITY_STREAM,
7679
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
7780
value: serde_json::Value::String(s.into()),
7881
}),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-10-15T21:46:06.749Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"http_interactions": [
3+
{
4+
"request": {
5+
"body": {
6+
"string": "{\"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+
"encoding": null
8+
},
9+
"headers": {
10+
"Accept": [
11+
"application/json"
12+
],
13+
"Content-Type": [
14+
"application/json"
15+
]
16+
},
17+
"method": "post",
18+
"uri": "https://api.datadoghq.com/api/v1/dashboard"
19+
},
20+
"response": {
21+
"body": {
22+
"string": "{\"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",
23+
"encoding": null
24+
},
25+
"headers": {
26+
"Content-Type": [
27+
"application/json"
28+
]
29+
},
30+
"status": {
31+
"code": 200,
32+
"message": "OK"
33+
}
34+
},
35+
"recorded_at": "Tue, 15 Oct 2024 21:46:06 GMT"
36+
},
37+
{
38+
"request": {
39+
"body": "",
40+
"headers": {
41+
"Accept": [
42+
"application/json"
43+
]
44+
},
45+
"method": "delete",
46+
"uri": "https://api.datadoghq.com/api/v1/dashboard/k3w-qcg-ug8"
47+
},
48+
"response": {
49+
"body": {
50+
"string": "{\"deleted_dashboard_id\":\"k3w-qcg-ug8\"}\n",
51+
"encoding": null
52+
},
53+
"headers": {
54+
"Content-Type": [
55+
"application/json"
56+
]
57+
},
58+
"status": {
59+
"code": 200,
60+
"message": "OK"
61+
}
62+
},
63+
"recorded_at": "Tue, 15 Oct 2024 21:46:06 GMT"
64+
}
65+
],
66+
"recorded_with": "VCR 6.0.0"
67+
}

tests/scenarios/features/v1/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)