-
Notifications
You must be signed in to change notification settings - Fork 58
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 (#2732)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
3942488
commit 52cdcb0
Showing
7 changed files
with
164 additions
and
16 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
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,89 @@ | ||
// Create a new dashboard with llm_observability_stream list_stream widget | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/DataDog/datadog-api-client-go/v2/api/datadog" | ||
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" | ||
) | ||
|
||
func main() { | ||
body := datadogV1.Dashboard{ | ||
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, | ||
Title: "Example-Dashboard with list_stream widget", | ||
Widgets: []datadogV1.Widget{ | ||
{ | ||
Definition: datadogV1.WidgetDefinition{ | ||
ListStreamWidgetDefinition: &datadogV1.ListStreamWidgetDefinition{ | ||
Type: datadogV1.LISTSTREAMWIDGETDEFINITIONTYPE_LIST_STREAM, | ||
Requests: []datadogV1.ListStreamWidgetRequest{ | ||
{ | ||
ResponseFormat: datadogV1.LISTSTREAMRESPONSEFORMAT_EVENT_LIST, | ||
Query: datadogV1.ListStreamQuery{ | ||
DataSource: datadogV1.LISTSTREAMSOURCE_LLM_OBSERVABILITY_STREAM, | ||
QueryString: "@event_type:span @parent_id:undefined", | ||
Indexes: []string{}, | ||
}, | ||
Columns: []datadogV1.ListStreamColumn{ | ||
{ | ||
Field: "@status", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_COMPACT, | ||
}, | ||
{ | ||
Field: "@content.prompt", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "@content.response.content", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "timestamp", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "@ml_app", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "service", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "@meta.evaluations.quality", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "@meta.evaluations.security", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
{ | ||
Field: "@duration", | ||
Width: datadogV1.LISTSTREAMCOLUMNWIDTH_AUTO, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}}, | ||
}, | ||
}, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
api := datadogV1.NewDashboardsApi(apiClient) | ||
resp, r, err := api.CreateDashboard(ctx, body) | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
} | ||
|
||
responseContent, _ := json.MarshalIndent(resp, "", " ") | ||
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent) | ||
} |
1 change: 1 addition & 0 deletions
1
...s/Scenario_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 |
46 changes: 46 additions & 0 deletions
46
...rds/Scenario_Create_a_new_dashboard_with_llm_observability_stream_list_stream_widget.yaml
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,46 @@ | ||
interactions: | ||
- request: | ||
body: | | ||
{"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"}}]} | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
Content-Type: | ||
- application/json | ||
id: 0 | ||
method: POST | ||
url: https://api.datadoghq.com/api/v1/dashboard | ||
response: | ||
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":[]} | ||
' | ||
code: 200 | ||
duration: 0ms | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
- request: | ||
body: '' | ||
form: {} | ||
headers: | ||
Accept: | ||
- application/json | ||
id: 1 | ||
method: DELETE | ||
url: https://api.datadoghq.com/api/v1/dashboard/k3w-qcg-ug8 | ||
response: | ||
body: '{"deleted_dashboard_id":"k3w-qcg-ug8"} | ||
' | ||
code: 200 | ||
duration: 0ms | ||
headers: | ||
Content-Type: | ||
- application/json | ||
status: 200 OK | ||
version: 2 |
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