Skip to content

Commit 3e6a9ba

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add OpenAPI spec for LLM Observability Experiments API (#3553)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 591616d commit 3e6a9ba

File tree

96 files changed

+11715
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+11715
-677
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 2672 additions & 677 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Create an LLM Observability dataset returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createLLMObsDataset"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiCreateLLMObsDatasetRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
name: "My LLM Dataset",
16+
},
17+
type: "datasets",
18+
},
19+
},
20+
projectId: "project_id",
21+
};
22+
23+
apiInstance
24+
.createLLMObsDataset(params)
25+
.then((data: v2.LLMObsDatasetResponse) => {
26+
console.log(
27+
"API called successfully. Returned data: " + JSON.stringify(data)
28+
);
29+
})
30+
.catch((error: any) => console.error(error));
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Append records to an LLM Observability dataset returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createLLMObsDatasetRecords"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiCreateLLMObsDatasetRecordsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
records: [
16+
{
17+
expectedOutput: undefined,
18+
input: null,
19+
},
20+
],
21+
},
22+
type: "records",
23+
},
24+
},
25+
projectId: "project_id",
26+
datasetId: "dataset_id",
27+
};
28+
29+
apiInstance
30+
.createLLMObsDatasetRecords(params)
31+
.then((data: v2.LLMObsDatasetRecordsMutationResponse) => {
32+
console.log(
33+
"API called successfully. Returned data: " + JSON.stringify(data)
34+
);
35+
})
36+
.catch((error: any) => console.error(error));
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Create an LLM Observability experiment returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createLLMObsExperiment"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiCreateLLMObsExperimentRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
datasetId: "9f64e5c7-dc5a-45c8-a17c-1b85f0bec97d",
16+
name: "My Experiment v1",
17+
projectId: "a33671aa-24fd-4dcd-9b33-a8ec7dde7751",
18+
},
19+
type: "experiments",
20+
},
21+
},
22+
};
23+
24+
apiInstance
25+
.createLLMObsExperiment(params)
26+
.then((data: v2.LLMObsExperimentResponse) => {
27+
console.log(
28+
"API called successfully. Returned data: " + JSON.stringify(data)
29+
);
30+
})
31+
.catch((error: any) => console.error(error));
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* Push events for an LLM Observability experiment returns "Accepted" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createLLMObsExperimentEvents"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiCreateLLMObsExperimentEventsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
metrics: [
16+
{
17+
assessment: "pass",
18+
error: {},
19+
label: "faithfulness",
20+
metricType: "score",
21+
spanId: "span-7a1b2c3d",
22+
tags: [],
23+
timestampMs: 1705314600000,
24+
},
25+
],
26+
spans: [
27+
{
28+
datasetId: "9f64e5c7-dc5a-45c8-a17c-1b85f0bec97d",
29+
duration: 1500000000,
30+
meta: {
31+
error: {
32+
message: "Model response timed out",
33+
stack: `Traceback (most recent call last):
34+
File "main.py", line 10, in <module>
35+
response = model.generate(input)
36+
File "model.py", line 45, in generate
37+
raise TimeoutError("Model response timed out")
38+
TimeoutError: Model response timed out`,
39+
type: "TimeoutError",
40+
},
41+
input: undefined,
42+
output: undefined,
43+
},
44+
name: "llm_call",
45+
projectId: "a33671aa-24fd-4dcd-9b33-a8ec7dde7751",
46+
spanId: "span-7a1b2c3d",
47+
startNs: 1705314600000000000,
48+
status: "ok",
49+
tags: [],
50+
traceId: "abc123def456",
51+
},
52+
],
53+
},
54+
type: "events",
55+
},
56+
},
57+
experimentId: "experiment_id",
58+
};
59+
60+
apiInstance
61+
.createLLMObsExperimentEvents(params)
62+
.then((data: any) => {
63+
console.log(
64+
"API called successfully. Returned data: " + JSON.stringify(data)
65+
);
66+
})
67+
.catch((error: any) => console.error(error));
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Create an LLM Observability project returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.createLLMObsProject"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiCreateLLMObsProjectRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
name: "My LLM Project",
16+
},
17+
type: "projects",
18+
},
19+
},
20+
};
21+
22+
apiInstance
23+
.createLLMObsProject(params)
24+
.then((data: v2.LLMObsProjectResponse) => {
25+
console.log(
26+
"API called successfully. Returned data: " + JSON.stringify(data)
27+
);
28+
})
29+
.catch((error: any) => console.error(error));
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Delete LLM Observability dataset records returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteLLMObsDatasetRecords"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiDeleteLLMObsDatasetRecordsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
recordIds: ["rec-7c3f5a1b-9e2d-4f8a-b1c6-3d7e9f0a2b4c"],
16+
},
17+
type: "records",
18+
},
19+
},
20+
projectId: "project_id",
21+
datasetId: "dataset_id",
22+
};
23+
24+
apiInstance
25+
.deleteLLMObsDatasetRecords(params)
26+
.then((data: any) => {
27+
console.log(
28+
"API called successfully. Returned data: " + JSON.stringify(data)
29+
);
30+
})
31+
.catch((error: any) => console.error(error));
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Delete LLM Observability datasets returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteLLMObsDatasets"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiDeleteLLMObsDatasetsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
datasetIds: ["9f64e5c7-dc5a-45c8-a17c-1b85f0bec97d"],
16+
},
17+
type: "datasets",
18+
},
19+
},
20+
projectId: "project_id",
21+
};
22+
23+
apiInstance
24+
.deleteLLMObsDatasets(params)
25+
.then((data: any) => {
26+
console.log(
27+
"API called successfully. Returned data: " + JSON.stringify(data)
28+
);
29+
})
30+
.catch((error: any) => console.error(error));
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Delete LLM Observability experiments returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteLLMObsExperiments"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiDeleteLLMObsExperimentsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
experimentIds: ["3fd6b5e0-8910-4b1c-a7d0-5b84de329012"],
16+
},
17+
type: "experiments",
18+
},
19+
},
20+
};
21+
22+
apiInstance
23+
.deleteLLMObsExperiments(params)
24+
.then((data: any) => {
25+
console.log(
26+
"API called successfully. Returned data: " + JSON.stringify(data)
27+
);
28+
})
29+
.catch((error: any) => console.error(error));
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Delete LLM Observability projects returns "No Content" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.deleteLLMObsProjects"] = true;
9+
const apiInstance = new v2.LLMObservabilityApi(configuration);
10+
11+
const params: v2.LLMObservabilityApiDeleteLLMObsProjectsRequest = {
12+
body: {
13+
data: {
14+
attributes: {
15+
projectIds: ["a33671aa-24fd-4dcd-9b33-a8ec7dde7751"],
16+
},
17+
type: "projects",
18+
},
19+
},
20+
};
21+
22+
apiInstance
23+
.deleteLLMObsProjects(params)
24+
.then((data: any) => {
25+
console.log(
26+
"API called successfully. Returned data: " + JSON.stringify(data)
27+
);
28+
})
29+
.catch((error: any) => console.error(error));

0 commit comments

Comments
 (0)