Delete LLM Observability data

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/llm-obs/deletion/data/llmobshttps://api.ap2.datadoghq.com/api/v2/llm-obs/deletion/data/llmobshttps://api.datadoghq.eu/api/v2/llm-obs/deletion/data/llmobshttps://api.ddog-gov.com/api/v2/llm-obs/deletion/data/llmobshttps://api.us2.ddog-gov.com/api/v2/llm-obs/deletion/data/llmobshttps://api.uk1.datadoghq.com/api/v2/llm-obs/deletion/data/llmobshttps://api.datadoghq.com/api/v2/llm-obs/deletion/data/llmobshttps://api.us3.datadoghq.com/api/v2/llm-obs/deletion/data/llmobshttps://api.us5.datadoghq.com/api/v2/llm-obs/deletion/data/llmobs

Información general

Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range.

Solicitud

Body Data (required)

Data deletion request payload.

Expand All

Campo

Tipo

Descripción

data [required]

object

Data object for an LLM Observability data deletion request.

attributes [required]

object

Attributes for an LLM Observability data deletion request.

delay

int64

Optional delay in seconds before the deletion is executed.

from [required]

int64

Start of the deletion time range in milliseconds since Unix epoch.

query [required]

object

Query filters selecting the data to delete. Must include a query key with an @trace_id filter.

<any-key>

string

to [required]

int64

End of the deletion time range in milliseconds since Unix epoch.

type [required]

enum

Resource type for an LLM Observability data deletion request. Allowed enum values: create_deletion_req

{
  "data": {
    "attributes": {
      "delay": 0,
      "from": 1705314600000,
      "query": {
        "<any-key>": "string"
      },
      "to": 1705315200000
    },
    "type": "create_deletion_req"
  }
}

Respuesta

Accepted

Response containing details of a submitted LLM Observability data deletion request.

Expand All

Campo

Tipo

Descripción

data [required]

object

Data object for an LLM Observability data deletion response.

attributes [required]

object

Attributes of a submitted LLM Observability data deletion request.

created_at [required]

date-time

Timestamp when the deletion request was created.

created_by [required]

string

UUID of the user who created the deletion request.

from_time [required]

int64

Start of the deletion time range in milliseconds since Unix epoch.

org_id [required]

int64

ID of the organization that submitted the deletion request.

product [required]

string

Product name for the deletion request.

query [required]

string

The query string used to select data for deletion.

to_time [required]

int64

End of the deletion time range in milliseconds since Unix epoch.

id [required]

string

Unique identifier of the deletion request.

type [required]

enum

Resource type for an LLM Observability data deletion response. Allowed enum values: deletion_request

{
  "data": {
    "attributes": {
      "created_at": "2024-01-15T10:30:00Z",
      "created_by": "user-uuid-1234",
      "from_time": 1705314600000,
      "org_id": 12345,
      "product": "llmobs",
      "query": "@trace_id:abc123def456",
      "to_time": 1705315200000
    },
    "id": "msg-abc123",
    "type": "deletion_request"
  }
}

Bad Request

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Unauthorized

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Forbidden

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Campo

Tipo

Descripción

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Ejemplo de código

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/llm-obs/deletion/data/llmobs" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "from": 1705314600000, "query": { "query": "@trace_id:abc123def456" }, "to": 1705315200000 }, "type": "create_deletion_req" } } EOF
"""
Delete LLM Observability data returns "Accepted" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.llm_observability_api import LLMObservabilityApi
from datadog_api_client.v2.model.llm_obs_data_deletion_request import LLMObsDataDeletionRequest
from datadog_api_client.v2.model.llm_obs_data_deletion_request_attributes import LLMObsDataDeletionRequestAttributes
from datadog_api_client.v2.model.llm_obs_data_deletion_request_data import LLMObsDataDeletionRequestData
from datadog_api_client.v2.model.llm_obs_data_deletion_request_type import LLMObsDataDeletionRequestType

body = LLMObsDataDeletionRequest(
    data=LLMObsDataDeletionRequestData(
        attributes=LLMObsDataDeletionRequestAttributes(
            delay=0,
            _from=1705314600000,
            query=dict(
                query="@trace_id:abc123def456",
            ),
            to=1705315200000,
        ),
        type=LLMObsDataDeletionRequestType.CREATE_DELETION_REQ,
    ),
)

configuration = Configuration()
configuration.unstable_operations["delete_llm_obs_data"] = True
with ApiClient(configuration) as api_client:
    api_instance = LLMObservabilityApi(api_client)
    response = api_instance.delete_llm_obs_data(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete LLM Observability data returns "Accepted" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.delete_llm_obs_data".to_sym] = true
end
api_instance = DatadogAPIClient::V2::LLMObservabilityAPI.new

body = DatadogAPIClient::V2::LLMObsDataDeletionRequest.new({
  data: DatadogAPIClient::V2::LLMObsDataDeletionRequestData.new({
    attributes: DatadogAPIClient::V2::LLMObsDataDeletionRequestAttributes.new({
      delay: 0,
      from: 1705314600000,
      query: {
        query: "@trace_id:abc123def456",
      },
      to: 1705315200000,
    }),
    type: DatadogAPIClient::V2::LLMObsDataDeletionRequestType::CREATE_DELETION_REQ,
  }),
})
p api_instance.delete_llm_obs_data(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete LLM Observability data returns "Accepted" response

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/datadogV2"
)

func main() {
	body := datadogV2.LLMObsDataDeletionRequest{
		Data: datadogV2.LLMObsDataDeletionRequestData{
			Attributes: datadogV2.LLMObsDataDeletionRequestAttributes{
				Delay: datadog.PtrInt64(0),
				From:  1705314600000,
				Query: map[string]string{
					"query": "@trace_id:abc123def456",
				},
				To: 1705315200000,
			},
			Type: datadogV2.LLMOBSDATADELETIONREQUESTTYPE_CREATE_DELETION_REQ,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.DeleteLLMObsData", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewLLMObservabilityApi(apiClient)
	resp, r, err := api.DeleteLLMObsData(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `LLMObservabilityApi.DeleteLLMObsData`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `LLMObservabilityApi.DeleteLLMObsData`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete LLM Observability data returns "Accepted" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.LlmObservabilityApi;
import com.datadog.api.client.v2.model.LLMObsDataDeletionRequest;
import com.datadog.api.client.v2.model.LLMObsDataDeletionRequestAttributes;
import com.datadog.api.client.v2.model.LLMObsDataDeletionRequestData;
import com.datadog.api.client.v2.model.LLMObsDataDeletionRequestType;
import com.datadog.api.client.v2.model.LLMObsDataDeletionResponse;
import java.util.Map;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.deleteLLMObsData", true);
    LlmObservabilityApi apiInstance = new LlmObservabilityApi(defaultClient);

    LLMObsDataDeletionRequest body =
        new LLMObsDataDeletionRequest()
            .data(
                new LLMObsDataDeletionRequestData()
                    .attributes(
                        new LLMObsDataDeletionRequestAttributes()
                            .delay(0L)
                            .from(1705314600000L)
                            .query(Map.ofEntries(Map.entry("query", "@trace_id:abc123def456")))
                            .to(1705315200000L))
                    .type(LLMObsDataDeletionRequestType.CREATE_DELETION_REQ));

    try {
      LLMObsDataDeletionResponse result = apiInstance.deleteLLMObsData(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling LlmObservabilityApi#deleteLLMObsData");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
// Delete LLM Observability data returns "Accepted" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI;
use datadog_api_client::datadogV2::model::LLMObsDataDeletionRequest;
use datadog_api_client::datadogV2::model::LLMObsDataDeletionRequestAttributes;
use datadog_api_client::datadogV2::model::LLMObsDataDeletionRequestData;
use datadog_api_client::datadogV2::model::LLMObsDataDeletionRequestType;
use std::collections::BTreeMap;

#[tokio::main]
async fn main() {
    let body = LLMObsDataDeletionRequest::new(LLMObsDataDeletionRequestData::new(
        LLMObsDataDeletionRequestAttributes::new(
            1705314600000,
            BTreeMap::from([("query".to_string(), "@trace_id:abc123def456".to_string())]),
            1705315200000,
        )
        .delay(0),
        LLMObsDataDeletionRequestType::CREATE_DELETION_REQ,
    ));
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.DeleteLLMObsData", true);
    let api = LLMObservabilityAPI::with_config(configuration);
    let resp = api.delete_llm_obs_data(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Delete LLM Observability data returns "Accepted" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.deleteLLMObsData"] = true;
const apiInstance = new v2.LLMObservabilityApi(configuration);

const params: v2.LLMObservabilityApiDeleteLLMObsDataRequest = {
  body: {
    data: {
      attributes: {
        delay: 0,
        from: 1705314600000,
        query: {
          query: "@trace_id:abc123def456",
        },
        to: 1705315200000,
      },
      type: "create_deletion_req",
    },
  },
};

apiInstance
  .deleteLLMObsData(params)
  .then((data: v2.LLMObsDataDeletionResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"