From 429f63451abcd5a54f3ba53905fc4dadafcc8a14 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 20 May 2026 15:31:47 +0000 Subject: [PATCH] Regenerate client from commit 1bf3191 of spec repo --- .generator/schemas/v2/openapi.yaml | 845 +++++++++++++++++- docs/datadog_api_client.v2.model.rst | 196 ++++ .../v2/llm-observability/DeleteLLMObsData.py | 32 + .../v2/llm-observability/ListLLMObsSpans.py | 14 + .../v2/llm-observability/SearchLLMObsSpans.py | 48 + src/datadog_api_client/configuration.py | 3 + .../v2/api/llm_observability_api.py | 242 ++++- .../v2/model/llm_obs_data_deletion_request.py | 40 + ...lm_obs_data_deletion_request_attributes.py | 55 ++ .../llm_obs_data_deletion_request_data.py | 50 ++ .../llm_obs_data_deletion_request_type.py | 35 + .../model/llm_obs_data_deletion_response.py | 40 + ...m_obs_data_deletion_response_attributes.py | 80 ++ .../llm_obs_data_deletion_response_data.py | 60 ++ .../llm_obs_data_deletion_response_type.py | 35 + .../v2/model/llm_obs_search_spans_request.py | 40 + ...llm_obs_search_spans_request_attributes.py | 74 ++ .../llm_obs_search_spans_request_data.py | 50 ++ .../llm_obs_search_spans_request_type.py | 35 + .../v2/model/llm_obs_span_attributes.py | 206 +++++ .../v2/model/llm_obs_span_data.py | 54 ++ .../model/llm_obs_span_evaluation_metric.py | 95 ++ .../v2/model/llm_obs_span_filter.py | 104 +++ .../v2/model/llm_obs_span_io.py | 54 ++ .../v2/model/llm_obs_span_message.py | 80 ++ .../v2/model/llm_obs_span_page_query.py | 43 + .../v2/model/llm_obs_span_search_options.py | 45 + .../v2/model/llm_obs_span_tool_call.py | 83 ++ .../v2/model/llm_obs_span_tool_definition.py | 83 ++ .../v2/model/llm_obs_span_tool_result.py | 64 ++ .../v2/model/llm_obs_span_type.py | 35 + .../v2/model/llm_obs_spans_response.py | 65 ++ .../v2/model/llm_obs_spans_response_links.py | 36 + .../v2/model/llm_obs_spans_response_meta.py | 58 ++ .../v2/model/llm_obs_spans_response_page.py | 36 + src/datadog_api_client/v2/models/__init__.py | 56 ++ tests/v2/features/llm_observability.feature | 50 +- tests/v2/features/undo.json | 20 + 38 files changed, 3237 insertions(+), 4 deletions(-) create mode 100644 examples/v2/llm-observability/DeleteLLMObsData.py create mode 100644 examples/v2/llm-observability/ListLLMObsSpans.py create mode 100644 examples/v2/llm-observability/SearchLLMObsSpans.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_request.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_request_data.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_request_type.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_response.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_response_attributes.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_response_data.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_data_deletion_response_type.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_search_spans_request.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_search_spans_request_attributes.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_search_spans_request_data.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_search_spans_request_type.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_attributes.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_data.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_evaluation_metric.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_filter.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_io.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_message.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_page_query.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_search_options.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_tool_call.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_tool_definition.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_tool_result.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_span_type.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_spans_response.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_spans_response_links.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_spans_response_meta.py create mode 100644 src/datadog_api_client/v2/model/llm_obs_spans_response_page.py diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 901b7a2324..ac098a3c30 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -42437,6 +42437,139 @@ components: example: "my-gcp-project" type: string type: object + LLMObsDataDeletionRequest: + description: Request to delete LLM Observability data. + properties: + data: + $ref: "#/components/schemas/LLMObsDataDeletionRequestData" + required: + - data + type: object + LLMObsDataDeletionRequestAttributes: + description: Attributes for an LLM Observability data deletion request. + properties: + delay: + description: Optional delay in seconds before the deletion is executed. + example: 0 + format: int64 + type: integer + from: + description: Start of the deletion time range in milliseconds since Unix epoch. + example: 1705314600000 + format: int64 + type: integer + query: + additionalProperties: + type: string + description: Query filters selecting the data to delete. Must include a `query` key with an `@trace_id` filter. + example: + query: "@trace_id:abc123def456" + type: object + to: + description: End of the deletion time range in milliseconds since Unix epoch. + example: 1705315200000 + format: int64 + type: integer + required: + - query + - from + - to + type: object + LLMObsDataDeletionRequestData: + description: Data object for an LLM Observability data deletion request. + properties: + attributes: + $ref: "#/components/schemas/LLMObsDataDeletionRequestAttributes" + type: + $ref: "#/components/schemas/LLMObsDataDeletionRequestType" + required: + - type + - attributes + type: object + LLMObsDataDeletionRequestType: + description: Resource type for an LLM Observability data deletion request. + enum: + - create_deletion_req + example: create_deletion_req + type: string + x-enum-varnames: + - CREATE_DELETION_REQ + LLMObsDataDeletionResponse: + description: Response containing details of a submitted LLM Observability data deletion request. + properties: + data: + $ref: "#/components/schemas/LLMObsDataDeletionResponseData" + required: + - data + type: object + LLMObsDataDeletionResponseAttributes: + description: Attributes of a submitted LLM Observability data deletion request. + properties: + created_at: + description: Timestamp when the deletion request was created. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + created_by: + description: UUID of the user who created the deletion request. + example: "user-uuid-1234" + type: string + from_time: + description: Start of the deletion time range in milliseconds since Unix epoch. + example: 1705314600000 + format: int64 + type: integer + org_id: + description: ID of the organization that submitted the deletion request. + example: 12345 + format: int64 + type: integer + product: + description: Product name for the deletion request. + example: "llmobs" + type: string + query: + description: The query string used to select data for deletion. + example: "@trace_id:abc123def456" + type: string + to_time: + description: End of the deletion time range in milliseconds since Unix epoch. + example: 1705315200000 + format: int64 + type: integer + required: + - org_id + - product + - created_at + - created_by + - from_time + - to_time + - query + type: object + LLMObsDataDeletionResponseData: + description: Data object for an LLM Observability data deletion response. + properties: + attributes: + $ref: "#/components/schemas/LLMObsDataDeletionResponseAttributes" + id: + description: Unique identifier of the deletion request. + example: "msg-abc123" + type: string + type: + $ref: "#/components/schemas/LLMObsDataDeletionResponseType" + required: + - id + - type + - attributes + type: object + LLMObsDataDeletionResponseType: + description: Resource type for an LLM Observability data deletion response. + enum: + - deletion_request + example: deletion_request + type: string + x-enum-varnames: + - DELETION_REQUEST LLMObsDatasetDataAttributesRequest: description: Attributes for creating an LLM Observability dataset. properties: @@ -44312,6 +44445,395 @@ components: type: string x-enum-varnames: - RECORDS + LLMObsSearchSpansRequest: + description: Request body for searching LLM Observability spans. + properties: + data: + $ref: "#/components/schemas/LLMObsSearchSpansRequestData" + required: + - data + type: object + LLMObsSearchSpansRequestAttributes: + description: Attributes of an LLM Observability spans search request. + properties: + filter: + $ref: "#/components/schemas/LLMObsSpanFilter" + options: + $ref: "#/components/schemas/LLMObsSpanSearchOptions" + page: + $ref: "#/components/schemas/LLMObsSpanPageQuery" + sort: + description: Sort order for the results. Use `-` prefix for descending order. + example: "-start_ns" + type: string + type: object + LLMObsSearchSpansRequestData: + description: Data object for an LLM Observability spans search request. + properties: + attributes: + $ref: "#/components/schemas/LLMObsSearchSpansRequestAttributes" + type: + $ref: "#/components/schemas/LLMObsSearchSpansRequestType" + required: + - type + - attributes + type: object + LLMObsSearchSpansRequestType: + description: Resource type for an LLM Observability spans search request. + enum: + - spans + example: spans + type: string + x-enum-varnames: + - SPANS + LLMObsSpanAttributes: + description: Attributes of an LLM Observability span. + properties: + duration: + description: Duration of the span in nanoseconds. + example: 1500000000.0 + format: double + type: number + evaluation: + additionalProperties: + $ref: "#/components/schemas/LLMObsSpanEvaluationMetric" + description: Evaluation metrics keyed by evaluator name. + type: object + input: + $ref: "#/components/schemas/LLMObsSpanIO" + intent: + description: Detected intent of the span. + type: string + metadata: + additionalProperties: {} + description: Arbitrary metadata associated with the span. + type: object + metrics: + additionalProperties: + format: double + type: number + description: Numeric metrics associated with the span (e.g., token counts). + type: object + ml_app: + description: Name of the ML application this span belongs to. + example: "my-llm-app" + type: string + model_name: + description: Name of the model used in this span. + example: "gpt-4o" + type: string + model_provider: + description: Provider of the model used in this span. + example: "openai" + type: string + name: + description: Name of the span. + example: "llm_call" + type: string + output: + $ref: "#/components/schemas/LLMObsSpanIO" + parent_id: + description: Identifier of the parent span, if any. + type: string + span_id: + description: Unique identifier of the span. + example: "abc123def456" + type: string + span_kind: + description: Kind of span (e.g., llm, agent, tool, task, workflow). + example: "llm" + type: string + start_ns: + description: Start time of the span in nanoseconds since Unix epoch. + example: 1705314600000000000 + format: int64 + type: integer + status: + description: Status of the span (e.g., ok, error). + example: "ok" + type: string + tags: + description: Tags associated with the span. + items: + type: string + type: array + tool_definitions: + description: Tool definitions available to the span. + items: + $ref: "#/components/schemas/LLMObsSpanToolDefinition" + type: array + trace_id: + description: Trace identifier this span belongs to. + example: "trace-9a8b7c6d5e4f" + type: string + required: + - span_id + - trace_id + - name + - status + - start_ns + - duration + - ml_app + - span_kind + type: object + LLMObsSpanData: + description: A single LLM Observability span. + properties: + attributes: + $ref: "#/components/schemas/LLMObsSpanAttributes" + id: + description: Unique identifier of the span. + example: "abc123def456" + type: string + type: + $ref: "#/components/schemas/LLMObsSpanType" + required: + - id + - type + - attributes + type: object + LLMObsSpanEvaluationMetric: + description: An evaluation metric associated with an LLM Observability span. + properties: + assessment: + description: Assessment result (e.g., pass or fail). + example: pass + type: string + eval_metric_type: + description: Type of the evaluation metric (e.g., score, categorical, boolean). + example: score + type: string + reasoning: + description: Human-readable reasoning for the evaluation result. + type: string + status: + description: Status of the evaluation execution. + type: string + tags: + description: Tags associated with the evaluation metric. + items: + type: string + type: array + value: + description: Value of the evaluation result. + type: object + LLMObsSpanFilter: + description: Filter criteria for an LLM Observability span search. + properties: + from: + description: Start of the time range. Accepts ISO 8601 or relative format (e.g., `now-15m`). Defaults to `now-15m`. + example: "now-900s" + type: string + ml_app: + description: Filter by ML application name. + example: "my-llm-app" + type: string + query: + description: >- + Search query using LLM Observability query syntax. Supports attribute filters using the field:value syntax (e.g. session_id, trace_id, ml_app, meta.span.kind). When provided, structured field filters (`span_id`, `trace_id`, etc.) are ignored. + example: "@session_id:abc123def456" + type: string + span_id: + description: Filter by exact span ID. + example: "abc123def456" + type: string + span_kind: + description: Filter by span kind (e.g., llm, agent, tool, task, workflow). + example: "llm" + type: string + span_name: + description: Filter by span name. + example: "llm_call" + type: string + tags: + additionalProperties: + type: string + description: Filter by tag key-value pairs. + type: object + to: + description: End of the time range. Accepts ISO 8601 or relative format (e.g., `now`). Defaults to `now`. + example: "now" + type: string + trace_id: + description: Filter by exact trace ID. + example: "trace-9a8b7c6d5e4f" + type: string + type: object + LLMObsSpanIO: + description: Input or output content of an LLM Observability span. + properties: + messages: + description: List of messages in the input or output. + items: + $ref: "#/components/schemas/LLMObsSpanMessage" + type: array + value: + description: Plain-text value of the input or output. + type: string + type: object + LLMObsSpanMessage: + description: A single message in a span input or output. + properties: + content: + description: Text content of the message. + type: string + id: + description: Unique identifier of the message. + type: string + role: + description: Role of the message sender (e.g., user, assistant, system). + type: string + tool_calls: + description: Tool calls made in this message. + items: + $ref: "#/components/schemas/LLMObsSpanToolCall" + type: array + tool_results: + description: Tool results returned in this message. + items: + $ref: "#/components/schemas/LLMObsSpanToolResult" + type: array + type: object + LLMObsSpanPageQuery: + description: Pagination settings for a span search request. + properties: + cursor: + description: Cursor from the previous response to retrieve the next page. + example: "eyJzdGFydCI6MTAwfQ==" + type: string + limit: + description: Maximum number of spans to return. Defaults to `10`. + example: 10 + format: int64 + type: integer + type: object + LLMObsSpanSearchOptions: + description: Additional options for a span search request. + properties: + include_attachments: + description: Whether to include attachment data in the response. Defaults to `true`. + example: true + type: boolean + time_offset: + description: Offset in seconds applied to both `from` and `to` timestamps. + example: 0 + format: int64 + type: integer + type: object + LLMObsSpanToolCall: + description: A tool call made during a span. + properties: + arguments: + additionalProperties: {} + description: Arguments passed to the tool. + type: object + name: + description: Name of the tool called. + type: string + tool_id: + description: Identifier of the tool call. + type: string + type: + description: Type of the tool call. + type: string + type: object + LLMObsSpanToolDefinition: + description: A tool definition available to an LLM span. + properties: + description: + description: Description of what the tool does. + type: string + name: + description: Name of the tool. + type: string + schema: + additionalProperties: {} + description: JSON schema describing the tool's input parameters. + type: object + version: + description: Version of the tool definition. + type: string + type: object + LLMObsSpanToolResult: + description: A result returned from a tool call during a span. + properties: + name: + description: Name of the tool that produced this result. + type: string + result: + description: Result value returned by the tool. + type: string + tool_id: + description: Identifier of the corresponding tool call. + type: string + type: + description: Type of the tool result. + type: string + type: object + LLMObsSpanType: + description: Resource type for an LLM Observability span. + enum: + - span + example: span + type: string + x-enum-varnames: + - SPAN + LLMObsSpansResponse: + description: Response containing a list of LLM Observability spans. + properties: + data: + description: List of spans matching the query. + items: + $ref: "#/components/schemas/LLMObsSpanData" + type: array + links: + $ref: "#/components/schemas/LLMObsSpansResponseLinks" + meta: + $ref: "#/components/schemas/LLMObsSpansResponseMeta" + required: + - data + - meta + type: object + LLMObsSpansResponseLinks: + description: Pagination links accompanying the spans response. + properties: + next: + description: URL to retrieve the next page of results. + example: "https://api.datadoghq.com/api/v2/llm-obs/v1/spans/events?page[cursor]=eyJzdGFydCI6MTAwfQ==" + type: string + type: object + LLMObsSpansResponseMeta: + description: Metadata accompanying the spans response. + properties: + elapsed: + description: Time elapsed for the query in milliseconds. + example: 132 + format: int64 + type: integer + page: + $ref: "#/components/schemas/LLMObsSpansResponsePage" + request_id: + description: Unique identifier for the request. + example: "req-abc123" + type: string + status: + description: Status of the query execution. + example: "done" + type: string + required: + - elapsed + - request_id + - status + - page + type: object + LLMObsSpansResponsePage: + description: Pagination cursor for the spans response. + properties: + after: + description: Cursor to retrieve the next page of results. Absent when there are no more results. + example: "eyJzdGFydCI6MTAwfQ==" + type: string + type: object LLMObsTraceAnnotatedInteractionItem: description: A trace, experiment trace, or session interaction with its associated annotations. properties: @@ -119398,6 +119920,77 @@ paths: operator: OR permissions: - org_management + /api/v2/llm-obs/deletion/data/llmobs: + post: + description: Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. + operationId: DeleteLLMObsData + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + from: 1705314600000 + query: + query: "@trace_id:abc123def456" + to: 1705315200000 + type: create_deletion_req + schema: + $ref: "#/components/schemas/LLMObsDataDeletionRequest" + description: Data deletion request payload. + required: true + responses: + "202": + content: + application/json: + examples: + default: + value: + 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 + schema: + $ref: "#/components/schemas/LLMObsDataDeletionResponse" + description: Accepted + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete LLM Observability data + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/llm-obs/v1/annotation-queues: get: description: |- @@ -121071,6 +121664,256 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/spans/events: + get: + description: List LLM Observability spans matching the specified filters. + operationId: ListLLMObsSpans + parameters: + - description: Start of the time range. Accepts ISO 8601 or relative format (e.g., `now-15m`). Defaults to `now-15m`. + in: query + name: filter[from] + schema: + example: "now-900s" + type: string + - description: End of the time range. Accepts ISO 8601 or relative format. Defaults to `now`. + in: query + name: filter[to] + schema: + example: "now" + type: string + - description: >- + Search query using LLM Observability query syntax. Supports attribute filters using the field:value syntax (e.g. session_id, trace_id, ml_app, meta.span.kind). When provided, structured field filters (`filter[span_id]`, `filter[trace_id]`, etc.) are ignored. + in: query + name: filter[query] + schema: + example: "@session_id:abc123def456" + type: string + - description: Filter by exact span ID. + in: query + name: filter[span_id] + schema: + type: string + - description: Filter by exact trace ID. + in: query + name: filter[trace_id] + schema: + type: string + - description: Filter by span kind (e.g., llm, agent, tool, task, workflow). + in: query + name: filter[span_kind] + schema: + type: string + - description: Filter by span name. + in: query + name: filter[span_name] + schema: + type: string + - description: Filter by ML application name. + in: query + name: filter[ml_app] + schema: + type: string + - description: Maximum number of spans to return. Defaults to `10`. + in: query + name: page[limit] + schema: + format: int64 + type: integer + - description: Cursor from the previous response to retrieve the next page. + in: query + name: page[cursor] + schema: + type: string + - description: Sort order for the results. + in: query + name: sort + schema: + type: string + - description: Whether to include attachment data in the response. Defaults to `true`. + in: query + name: include_attachments + schema: + type: boolean + responses: + "200": + content: + application/json: + examples: + default: + summary: List spans for an ML app + value: + data: + - attributes: + duration: 1500000000.0 + ml_app: my-llm-app + model_name: gpt-4o + model_provider: openai + name: llm_call + span_id: "abc123def456" + span_kind: llm + start_ns: 1705314600000000000 + status: ok + trace_id: "trace-9a8b7c6d5e4f" + id: "abc123def456" + type: span + meta: + elapsed: 132 + page: {} + request_id: req-abc123 + status: done + session_id: + summary: List spans filtered by session ID + value: + data: + - attributes: + duration: 1500000000.0 + ml_app: my-llm-app + name: llm_call + span_id: "abc123def456" + span_kind: llm + start_ns: 1705314600000000000 + status: ok + tags: + - "session_id:abc123def456" + trace_id: "trace-9a8b7c6d5e4f" + id: "abc123def456" + type: span + meta: + elapsed: 87 + page: {} + request_id: req-def456 + status: done + schema: + $ref: "#/components/schemas/LLMObsSpansResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: List LLM Observability spans + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/llm-obs/v1/spans/events/search: + post: + description: Search LLM Observability spans using structured filters in the request body. + operationId: SearchLLMObsSpans + requestBody: + content: + application/json: + examples: + default: + summary: Search spans for an ML app + value: + data: + attributes: + filter: + from: "now-900s" + ml_app: "my-llm-app" + span_kind: "llm" + to: "now" + options: + include_attachments: true + page: + limit: 10 + type: spans + session_id: + summary: Search all spans in a session + value: + data: + attributes: + filter: + from: "now-900s" + query: "@session_id:abc123def456" + to: "now" + options: + include_attachments: true + page: + limit: 50 + type: spans + schema: + $ref: "#/components/schemas/LLMObsSearchSpansRequest" + description: Search spans payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + duration: 1500000000.0 + ml_app: my-llm-app + model_name: gpt-4o + model_provider: openai + name: llm_call + span_id: "abc123def456" + span_kind: llm + start_ns: 1705314600000000000 + status: ok + trace_id: "trace-9a8b7c6d5e4f" + id: "abc123def456" + type: span + meta: + elapsed: 132 + page: {} + request_id: req-abc123 + status: done + schema: + $ref: "#/components/schemas/LLMObsSpansResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Search LLM Observability spans + tags: + - LLM Observability + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/llm-obs/v1/{project_id}/datasets: get: description: List all LLM Observability datasets for a project, sorted by creation date, newest first. @@ -157735,7 +158578,7 @@ tags: description: Find out more at url: "https://docs.datadoghq.com/account_management/api-app-keys/" name: Key Management - - description: Manage LLM Observability projects, datasets, dataset records, experiments, and annotations. + - description: Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, and annotations. name: LLM Observability - description: |- Search your logs and send them to your Datadog platform over HTTP. See the [Log Management page](https://docs.datadoghq.com/logs/) for more information. diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 38c72b5b6d..a178d7ce3d 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -18561,6 +18561,62 @@ datadog\_api\_client.v2.model.llm\_obs\_custom\_eval\_config\_vertex\_ai\_option :members: :show-inheritance: +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_request module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_request\_attributes module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_request\_data module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_request\_type module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_response module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_response\_attributes module +----------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_response\_data module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_data\_deletion\_response\_type module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_data_deletion_response_type + :members: + :show-inheritance: + datadog\_api\_client.v2.model.llm\_obs\_dataset\_data\_attributes\_request module --------------------------------------------------------------------------------- @@ -19401,6 +19457,146 @@ datadog\_api\_client.v2.model.llm\_obs\_record\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.llm\_obs\_search\_spans\_request module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_search_spans_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_search\_spans\_request\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_search_spans_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_search\_spans\_request\_data module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_search_spans_request_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_search\_spans\_request\_type module +--------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_search_spans_request_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_attributes module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_data module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_evaluation\_metric module +----------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_evaluation_metric + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_filter module +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_filter + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_io module +------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_io + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_message module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_message + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_page\_query module +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_page_query + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_search\_options module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_search_options + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_tool\_call module +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_tool_call + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_tool\_definition module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_tool_definition + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_tool\_result module +----------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_tool_result + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_span\_type module +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_span_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_spans\_response module +-------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_spans_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_spans\_response\_links module +--------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_spans_response_links + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_spans\_response\_meta module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_spans_response_meta + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.llm\_obs\_spans\_response\_page module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.llm_obs_spans_response_page + :members: + :show-inheritance: + datadog\_api\_client.v2.model.llm\_obs\_trace\_annotated\_interaction\_item module ---------------------------------------------------------------------------------- diff --git a/examples/v2/llm-observability/DeleteLLMObsData.py b/examples/v2/llm-observability/DeleteLLMObsData.py new file mode 100644 index 0000000000..457cf7aa8a --- /dev/null +++ b/examples/v2/llm-observability/DeleteLLMObsData.py @@ -0,0 +1,32 @@ +""" +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) diff --git a/examples/v2/llm-observability/ListLLMObsSpans.py b/examples/v2/llm-observability/ListLLMObsSpans.py new file mode 100644 index 0000000000..4c22ca1c30 --- /dev/null +++ b/examples/v2/llm-observability/ListLLMObsSpans.py @@ -0,0 +1,14 @@ +""" +List LLM Observability spans returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.llm_observability_api import LLMObservabilityApi + +configuration = Configuration() +configuration.unstable_operations["list_llm_obs_spans"] = True +with ApiClient(configuration) as api_client: + api_instance = LLMObservabilityApi(api_client) + response = api_instance.list_llm_obs_spans() + + print(response) diff --git a/examples/v2/llm-observability/SearchLLMObsSpans.py b/examples/v2/llm-observability/SearchLLMObsSpans.py new file mode 100644 index 0000000000..d6c535fbaf --- /dev/null +++ b/examples/v2/llm-observability/SearchLLMObsSpans.py @@ -0,0 +1,48 @@ +""" +Search LLM Observability spans returns "OK" 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_search_spans_request import LLMObsSearchSpansRequest +from datadog_api_client.v2.model.llm_obs_search_spans_request_attributes import LLMObsSearchSpansRequestAttributes +from datadog_api_client.v2.model.llm_obs_search_spans_request_data import LLMObsSearchSpansRequestData +from datadog_api_client.v2.model.llm_obs_search_spans_request_type import LLMObsSearchSpansRequestType +from datadog_api_client.v2.model.llm_obs_span_filter import LLMObsSpanFilter +from datadog_api_client.v2.model.llm_obs_span_page_query import LLMObsSpanPageQuery +from datadog_api_client.v2.model.llm_obs_span_search_options import LLMObsSpanSearchOptions + +body = LLMObsSearchSpansRequest( + data=LLMObsSearchSpansRequestData( + attributes=LLMObsSearchSpansRequestAttributes( + filter=LLMObsSpanFilter( + _from="now-900s", + ml_app="my-llm-app", + query="@session_id:abc123def456", + span_id="abc123def456", + span_kind="llm", + span_name="llm_call", + to="now", + trace_id="trace-9a8b7c6d5e4f", + ), + options=LLMObsSpanSearchOptions( + include_attachments=True, + time_offset=0, + ), + page=LLMObsSpanPageQuery( + cursor="eyJzdGFydCI6MTAwfQ==", + limit=10, + ), + sort="-start_ns", + ), + type=LLMObsSearchSpansRequestType.SPANS, + ), +) + +configuration = Configuration() +configuration.unstable_operations["search_llm_obs_spans"] = True +with ApiClient(configuration) as api_client: + api_instance = LLMObservabilityApi(api_client) + response = api_instance.search_llm_obs_spans(body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 9588296c08..93b7cb8b2e 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -276,6 +276,7 @@ def __init__( "v2.delete_llm_obs_annotation_queue": False, "v2.delete_llm_obs_annotation_queue_interactions": False, "v2.delete_llm_obs_custom_eval_config": False, + "v2.delete_llm_obs_data": False, "v2.delete_llm_obs_dataset_records": False, "v2.delete_llm_obs_datasets": False, "v2.delete_llm_obs_experiments": False, @@ -289,7 +290,9 @@ def __init__( "v2.list_llm_obs_experiment_events": False, "v2.list_llm_obs_experiments": False, "v2.list_llm_obs_projects": False, + "v2.list_llm_obs_spans": False, "v2.search_llm_obs_experimentation": False, + "v2.search_llm_obs_spans": False, "v2.simple_search_llm_obs_experimentation": False, "v2.update_llm_obs_annotation_queue": False, "v2.update_llm_obs_annotation_queue_label_schema": False, diff --git a/src/datadog_api_client/v2/api/llm_observability_api.py b/src/datadog_api_client/v2/api/llm_observability_api.py index c7dab6b3ce..186f437a7b 100644 --- a/src/datadog_api_client/v2/api/llm_observability_api.py +++ b/src/datadog_api_client/v2/api/llm_observability_api.py @@ -13,6 +13,8 @@ ) from datadog_api_client.v2.model.llm_obs_custom_eval_config_response import LLMObsCustomEvalConfigResponse from datadog_api_client.v2.model.llm_obs_custom_eval_config_update_request import LLMObsCustomEvalConfigUpdateRequest +from datadog_api_client.v2.model.llm_obs_data_deletion_response import LLMObsDataDeletionResponse +from datadog_api_client.v2.model.llm_obs_data_deletion_request import LLMObsDataDeletionRequest from datadog_api_client.v2.model.llm_obs_annotation_queues_response import LLMObsAnnotationQueuesResponse from datadog_api_client.v2.model.llm_obs_annotation_queue_response import LLMObsAnnotationQueueResponse from datadog_api_client.v2.model.llm_obs_annotation_queue_request import LLMObsAnnotationQueueRequest @@ -56,6 +58,8 @@ from datadog_api_client.v2.model.llm_obs_project_request import LLMObsProjectRequest from datadog_api_client.v2.model.llm_obs_delete_projects_request import LLMObsDeleteProjectsRequest from datadog_api_client.v2.model.llm_obs_project_update_request import LLMObsProjectUpdateRequest +from datadog_api_client.v2.model.llm_obs_spans_response import LLMObsSpansResponse +from datadog_api_client.v2.model.llm_obs_search_spans_request import LLMObsSearchSpansRequest from datadog_api_client.v2.model.llm_obs_datasets_response import LLMObsDatasetsResponse from datadog_api_client.v2.model.llm_obs_dataset_response import LLMObsDatasetResponse from datadog_api_client.v2.model.llm_obs_dataset_request import LLMObsDatasetRequest @@ -71,7 +75,7 @@ class LLMObservabilityApi: """ - Manage LLM Observability projects, datasets, dataset records, experiments, and annotations. + Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, and annotations. """ def __init__(self, api_client=None): @@ -341,6 +345,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_llm_obs_data_endpoint = _Endpoint( + settings={ + "response_type": (LLMObsDataDeletionResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/llm-obs/deletion/data/llmobs", + "operation_id": "delete_llm_obs_data", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (LLMObsDataDeletionRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_llm_obs_dataset_records_endpoint = _Endpoint( settings={ "response_type": None, @@ -735,6 +759,83 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_llm_obs_spans_endpoint = _Endpoint( + settings={ + "response_type": (LLMObsSpansResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/llm-obs/v1/spans/events", + "operation_id": "list_llm_obs_spans", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "filter_from": { + "openapi_types": (str,), + "attribute": "filter[from]", + "location": "query", + }, + "filter_to": { + "openapi_types": (str,), + "attribute": "filter[to]", + "location": "query", + }, + "filter_query": { + "openapi_types": (str,), + "attribute": "filter[query]", + "location": "query", + }, + "filter_span_id": { + "openapi_types": (str,), + "attribute": "filter[span_id]", + "location": "query", + }, + "filter_trace_id": { + "openapi_types": (str,), + "attribute": "filter[trace_id]", + "location": "query", + }, + "filter_span_kind": { + "openapi_types": (str,), + "attribute": "filter[span_kind]", + "location": "query", + }, + "filter_span_name": { + "openapi_types": (str,), + "attribute": "filter[span_name]", + "location": "query", + }, + "filter_ml_app": { + "openapi_types": (str,), + "attribute": "filter[ml_app]", + "location": "query", + }, + "page_limit": { + "openapi_types": (int,), + "attribute": "page[limit]", + "location": "query", + }, + "page_cursor": { + "openapi_types": (str,), + "attribute": "page[cursor]", + "location": "query", + }, + "sort": { + "openapi_types": (str,), + "attribute": "sort", + "location": "query", + }, + "include_attachments": { + "openapi_types": (bool,), + "attribute": "include_attachments", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._search_llm_obs_experimentation_endpoint = _Endpoint( settings={ "response_type": (LLMObsExperimentationSearchResponse,), @@ -755,6 +856,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._search_llm_obs_spans_endpoint = _Endpoint( + settings={ + "response_type": (LLMObsSpansResponse,), + "auth": ["apiKeyAuth", "appKeyAuth"], + "endpoint_path": "/api/v2/llm-obs/v1/spans/events/search", + "operation_id": "search_llm_obs_spans", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (LLMObsSearchSpansRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._simple_search_llm_obs_experimentation_endpoint = _Endpoint( settings={ "response_type": (LLMObsExperimentationSimpleSearchResponse,), @@ -1201,6 +1322,23 @@ def delete_llm_obs_custom_eval_config( return self._delete_llm_obs_custom_eval_config_endpoint.call_with_http_info(**kwargs) + def delete_llm_obs_data( + self, + body: LLMObsDataDeletionRequest, + ) -> LLMObsDataDeletionResponse: + """Delete LLM Observability data. + + Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. + + :param body: Data deletion request payload. + :type body: LLMObsDataDeletionRequest + :rtype: LLMObsDataDeletionResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._delete_llm_obs_data_endpoint.call_with_http_info(**kwargs) + def delete_llm_obs_dataset_records( self, project_id: str, @@ -1554,6 +1692,91 @@ def list_llm_obs_projects( return self._list_llm_obs_projects_endpoint.call_with_http_info(**kwargs) + def list_llm_obs_spans( + self, + *, + filter_from: Union[str, UnsetType] = unset, + filter_to: Union[str, UnsetType] = unset, + filter_query: Union[str, UnsetType] = unset, + filter_span_id: Union[str, UnsetType] = unset, + filter_trace_id: Union[str, UnsetType] = unset, + filter_span_kind: Union[str, UnsetType] = unset, + filter_span_name: Union[str, UnsetType] = unset, + filter_ml_app: Union[str, UnsetType] = unset, + page_limit: Union[int, UnsetType] = unset, + page_cursor: Union[str, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + include_attachments: Union[bool, UnsetType] = unset, + ) -> LLMObsSpansResponse: + """List LLM Observability spans. + + List LLM Observability spans matching the specified filters. + + :param filter_from: Start of the time range. Accepts ISO 8601 or relative format (e.g., ``now-15m`` ). Defaults to ``now-15m``. + :type filter_from: str, optional + :param filter_to: End of the time range. Accepts ISO 8601 or relative format. Defaults to ``now``. + :type filter_to: str, optional + :param filter_query: Search query using LLM Observability query syntax. Supports attribute filters using the field:value syntax (e.g. session_id, trace_id, ml_app, meta.span.kind). When provided, structured field filters ( ``filter[span_id]`` , ``filter[trace_id]`` , etc.) are ignored. + :type filter_query: str, optional + :param filter_span_id: Filter by exact span ID. + :type filter_span_id: str, optional + :param filter_trace_id: Filter by exact trace ID. + :type filter_trace_id: str, optional + :param filter_span_kind: Filter by span kind (e.g., llm, agent, tool, task, workflow). + :type filter_span_kind: str, optional + :param filter_span_name: Filter by span name. + :type filter_span_name: str, optional + :param filter_ml_app: Filter by ML application name. + :type filter_ml_app: str, optional + :param page_limit: Maximum number of spans to return. Defaults to ``10``. + :type page_limit: int, optional + :param page_cursor: Cursor from the previous response to retrieve the next page. + :type page_cursor: str, optional + :param sort: Sort order for the results. + :type sort: str, optional + :param include_attachments: Whether to include attachment data in the response. Defaults to ``true``. + :type include_attachments: bool, optional + :rtype: LLMObsSpansResponse + """ + kwargs: Dict[str, Any] = {} + if filter_from is not unset: + kwargs["filter_from"] = filter_from + + if filter_to is not unset: + kwargs["filter_to"] = filter_to + + if filter_query is not unset: + kwargs["filter_query"] = filter_query + + if filter_span_id is not unset: + kwargs["filter_span_id"] = filter_span_id + + if filter_trace_id is not unset: + kwargs["filter_trace_id"] = filter_trace_id + + if filter_span_kind is not unset: + kwargs["filter_span_kind"] = filter_span_kind + + if filter_span_name is not unset: + kwargs["filter_span_name"] = filter_span_name + + if filter_ml_app is not unset: + kwargs["filter_ml_app"] = filter_ml_app + + if page_limit is not unset: + kwargs["page_limit"] = page_limit + + if page_cursor is not unset: + kwargs["page_cursor"] = page_cursor + + if sort is not unset: + kwargs["sort"] = sort + + if include_attachments is not unset: + kwargs["include_attachments"] = include_attachments + + return self._list_llm_obs_spans_endpoint.call_with_http_info(**kwargs) + def search_llm_obs_experimentation( self, body: LLMObsExperimentationSearchRequest, @@ -1575,6 +1798,23 @@ def search_llm_obs_experimentation( return self._search_llm_obs_experimentation_endpoint.call_with_http_info(**kwargs) + def search_llm_obs_spans( + self, + body: LLMObsSearchSpansRequest, + ) -> LLMObsSpansResponse: + """Search LLM Observability spans. + + Search LLM Observability spans using structured filters in the request body. + + :param body: Search spans payload. + :type body: LLMObsSearchSpansRequest + :rtype: LLMObsSpansResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._search_llm_obs_spans_endpoint.call_with_http_info(**kwargs) + def simple_search_llm_obs_experimentation( self, body: LLMObsExperimentationSimpleSearchRequest, diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_request.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request.py new file mode 100644 index 0000000000..07aa0d35d1 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_data_deletion_request_data import LLMObsDataDeletionRequestData + + +class LLMObsDataDeletionRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_data_deletion_request_data import LLMObsDataDeletionRequestData + + return { + "data": (LLMObsDataDeletionRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: LLMObsDataDeletionRequestData, **kwargs): + """ + Request to delete LLM Observability data. + + :param data: Data object for an LLM Observability data deletion request. + :type data: LLMObsDataDeletionRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_attributes.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_attributes.py new file mode 100644 index 0000000000..15e79ce422 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_attributes.py @@ -0,0 +1,55 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsDataDeletionRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "delay": (int,), + "_from": (int,), + "query": ({str: (str,)},), + "to": (int,), + } + + attribute_map = { + "delay": "delay", + "_from": "from", + "query": "query", + "to": "to", + } + + def __init__(self_, _from: int, query: Dict[str, str], to: int, delay: Union[int, UnsetType] = unset, **kwargs): + """ + Attributes for an LLM Observability data deletion request. + + :param delay: Optional delay in seconds before the deletion is executed. + :type delay: int, optional + + :param _from: Start of the deletion time range in milliseconds since Unix epoch. + :type _from: int + + :param query: Query filters selecting the data to delete. Must include a ``query`` key with an ``@trace_id`` filter. + :type query: {str: (str,)} + + :param to: End of the deletion time range in milliseconds since Unix epoch. + :type to: int + """ + if delay is not unset: + kwargs["delay"] = delay + super().__init__(kwargs) + + self_._from = _from + self_.query = query + self_.to = to diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_data.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_data.py new file mode 100644 index 0000000000..8c43f66bae --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_data.py @@ -0,0 +1,50 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + 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_type import LLMObsDataDeletionRequestType + + +class LLMObsDataDeletionRequestData(ModelNormal): + @cached_property + def openapi_types(_): + 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_type import LLMObsDataDeletionRequestType + + return { + "attributes": (LLMObsDataDeletionRequestAttributes,), + "type": (LLMObsDataDeletionRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: LLMObsDataDeletionRequestAttributes, type: LLMObsDataDeletionRequestType, **kwargs): + """ + Data object for an LLM Observability data deletion request. + + :param attributes: Attributes for an LLM Observability data deletion request. + :type attributes: LLMObsDataDeletionRequestAttributes + + :param type: Resource type for an LLM Observability data deletion request. + :type type: LLMObsDataDeletionRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_type.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_type.py new file mode 100644 index 0000000000..618c3a226c --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_request_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class LLMObsDataDeletionRequestType(ModelSimple): + """ + Resource type for an LLM Observability data deletion request. + + :param value: If omitted defaults to "create_deletion_req". Must be one of ["create_deletion_req"]. + :type value: str + """ + + allowed_values = { + "create_deletion_req", + } + CREATE_DELETION_REQ: ClassVar["LLMObsDataDeletionRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +LLMObsDataDeletionRequestType.CREATE_DELETION_REQ = LLMObsDataDeletionRequestType("create_deletion_req") diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_response.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response.py new file mode 100644 index 0000000000..eeed15429d --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_data_deletion_response_data import LLMObsDataDeletionResponseData + + +class LLMObsDataDeletionResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_data_deletion_response_data import LLMObsDataDeletionResponseData + + return { + "data": (LLMObsDataDeletionResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: LLMObsDataDeletionResponseData, **kwargs): + """ + Response containing details of a submitted LLM Observability data deletion request. + + :param data: Data object for an LLM Observability data deletion response. + :type data: LLMObsDataDeletionResponseData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_attributes.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_attributes.py new file mode 100644 index 0000000000..aabd9bc25d --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_attributes.py @@ -0,0 +1,80 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, +) + + +class LLMObsDataDeletionResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "created_at": (datetime,), + "created_by": (str,), + "from_time": (int,), + "org_id": (int,), + "product": (str,), + "query": (str,), + "to_time": (int,), + } + + attribute_map = { + "created_at": "created_at", + "created_by": "created_by", + "from_time": "from_time", + "org_id": "org_id", + "product": "product", + "query": "query", + "to_time": "to_time", + } + + def __init__( + self_, + created_at: datetime, + created_by: str, + from_time: int, + org_id: int, + product: str, + query: str, + to_time: int, + **kwargs, + ): + """ + Attributes of a submitted LLM Observability data deletion request. + + :param created_at: Timestamp when the deletion request was created. + :type created_at: datetime + + :param created_by: UUID of the user who created the deletion request. + :type created_by: str + + :param from_time: Start of the deletion time range in milliseconds since Unix epoch. + :type from_time: int + + :param org_id: ID of the organization that submitted the deletion request. + :type org_id: int + + :param product: Product name for the deletion request. + :type product: str + + :param query: The query string used to select data for deletion. + :type query: str + + :param to_time: End of the deletion time range in milliseconds since Unix epoch. + :type to_time: int + """ + super().__init__(kwargs) + + self_.created_at = created_at + self_.created_by = created_by + self_.from_time = from_time + self_.org_id = org_id + self_.product = product + self_.query = query + self_.to_time = to_time diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_data.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_data.py new file mode 100644 index 0000000000..29367a02d7 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_data.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_data_deletion_response_attributes import ( + LLMObsDataDeletionResponseAttributes, + ) + from datadog_api_client.v2.model.llm_obs_data_deletion_response_type import LLMObsDataDeletionResponseType + + +class LLMObsDataDeletionResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_data_deletion_response_attributes import ( + LLMObsDataDeletionResponseAttributes, + ) + from datadog_api_client.v2.model.llm_obs_data_deletion_response_type import LLMObsDataDeletionResponseType + + return { + "attributes": (LLMObsDataDeletionResponseAttributes,), + "id": (str,), + "type": (LLMObsDataDeletionResponseType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: LLMObsDataDeletionResponseAttributes, id: str, type: LLMObsDataDeletionResponseType, **kwargs + ): + """ + Data object for an LLM Observability data deletion response. + + :param attributes: Attributes of a submitted LLM Observability data deletion request. + :type attributes: LLMObsDataDeletionResponseAttributes + + :param id: Unique identifier of the deletion request. + :type id: str + + :param type: Resource type for an LLM Observability data deletion response. + :type type: LLMObsDataDeletionResponseType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_type.py b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_type.py new file mode 100644 index 0000000000..e69779395b --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_data_deletion_response_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class LLMObsDataDeletionResponseType(ModelSimple): + """ + Resource type for an LLM Observability data deletion response. + + :param value: If omitted defaults to "deletion_request". Must be one of ["deletion_request"]. + :type value: str + """ + + allowed_values = { + "deletion_request", + } + DELETION_REQUEST: ClassVar["LLMObsDataDeletionResponseType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +LLMObsDataDeletionResponseType.DELETION_REQUEST = LLMObsDataDeletionResponseType("deletion_request") diff --git a/src/datadog_api_client/v2/model/llm_obs_search_spans_request.py b/src/datadog_api_client/v2/model/llm_obs_search_spans_request.py new file mode 100644 index 0000000000..3df61a5a65 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_search_spans_request.py @@ -0,0 +1,40 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_search_spans_request_data import LLMObsSearchSpansRequestData + + +class LLMObsSearchSpansRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_search_spans_request_data import LLMObsSearchSpansRequestData + + return { + "data": (LLMObsSearchSpansRequestData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: LLMObsSearchSpansRequestData, **kwargs): + """ + Request body for searching LLM Observability spans. + + :param data: Data object for an LLM Observability spans search request. + :type data: LLMObsSearchSpansRequestData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/llm_obs_search_spans_request_attributes.py b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_attributes.py new file mode 100644 index 0000000000..b90700cfad --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_attributes.py @@ -0,0 +1,74 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_filter import LLMObsSpanFilter + from datadog_api_client.v2.model.llm_obs_span_search_options import LLMObsSpanSearchOptions + from datadog_api_client.v2.model.llm_obs_span_page_query import LLMObsSpanPageQuery + + +class LLMObsSearchSpansRequestAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_filter import LLMObsSpanFilter + from datadog_api_client.v2.model.llm_obs_span_search_options import LLMObsSpanSearchOptions + from datadog_api_client.v2.model.llm_obs_span_page_query import LLMObsSpanPageQuery + + return { + "filter": (LLMObsSpanFilter,), + "options": (LLMObsSpanSearchOptions,), + "page": (LLMObsSpanPageQuery,), + "sort": (str,), + } + + attribute_map = { + "filter": "filter", + "options": "options", + "page": "page", + "sort": "sort", + } + + def __init__( + self_, + filter: Union[LLMObsSpanFilter, UnsetType] = unset, + options: Union[LLMObsSpanSearchOptions, UnsetType] = unset, + page: Union[LLMObsSpanPageQuery, UnsetType] = unset, + sort: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an LLM Observability spans search request. + + :param filter: Filter criteria for an LLM Observability span search. + :type filter: LLMObsSpanFilter, optional + + :param options: Additional options for a span search request. + :type options: LLMObsSpanSearchOptions, optional + + :param page: Pagination settings for a span search request. + :type page: LLMObsSpanPageQuery, optional + + :param sort: Sort order for the results. Use ``-`` prefix for descending order. + :type sort: str, optional + """ + if filter is not unset: + kwargs["filter"] = filter + if options is not unset: + kwargs["options"] = options + if page is not unset: + kwargs["page"] = page + if sort is not unset: + kwargs["sort"] = sort + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_search_spans_request_data.py b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_data.py new file mode 100644 index 0000000000..9ea288a013 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_data.py @@ -0,0 +1,50 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_search_spans_request_attributes import LLMObsSearchSpansRequestAttributes + from datadog_api_client.v2.model.llm_obs_search_spans_request_type import LLMObsSearchSpansRequestType + + +class LLMObsSearchSpansRequestData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_search_spans_request_attributes import ( + LLMObsSearchSpansRequestAttributes, + ) + from datadog_api_client.v2.model.llm_obs_search_spans_request_type import LLMObsSearchSpansRequestType + + return { + "attributes": (LLMObsSearchSpansRequestAttributes,), + "type": (LLMObsSearchSpansRequestType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: LLMObsSearchSpansRequestAttributes, type: LLMObsSearchSpansRequestType, **kwargs): + """ + Data object for an LLM Observability spans search request. + + :param attributes: Attributes of an LLM Observability spans search request. + :type attributes: LLMObsSearchSpansRequestAttributes + + :param type: Resource type for an LLM Observability spans search request. + :type type: LLMObsSearchSpansRequestType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/llm_obs_search_spans_request_type.py b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_type.py new file mode 100644 index 0000000000..39dc76e6e0 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_search_spans_request_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class LLMObsSearchSpansRequestType(ModelSimple): + """ + Resource type for an LLM Observability spans search request. + + :param value: If omitted defaults to "spans". Must be one of ["spans"]. + :type value: str + """ + + allowed_values = { + "spans", + } + SPANS: ClassVar["LLMObsSearchSpansRequestType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +LLMObsSearchSpansRequestType.SPANS = LLMObsSearchSpansRequestType("spans") diff --git a/src/datadog_api_client/v2/model/llm_obs_span_attributes.py b/src/datadog_api_client/v2/model/llm_obs_span_attributes.py new file mode 100644 index 0000000000..b9119e0026 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_attributes.py @@ -0,0 +1,206 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_evaluation_metric import LLMObsSpanEvaluationMetric + from datadog_api_client.v2.model.llm_obs_span_io import LLMObsSpanIO + from datadog_api_client.v2.model.llm_obs_span_tool_definition import LLMObsSpanToolDefinition + + +class LLMObsSpanAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_evaluation_metric import LLMObsSpanEvaluationMetric + from datadog_api_client.v2.model.llm_obs_span_io import LLMObsSpanIO + from datadog_api_client.v2.model.llm_obs_span_tool_definition import LLMObsSpanToolDefinition + + return { + "duration": (float,), + "evaluation": ({str: (LLMObsSpanEvaluationMetric,)},), + "input": (LLMObsSpanIO,), + "intent": (str,), + "metadata": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "metrics": ({str: (float,)},), + "ml_app": (str,), + "model_name": (str,), + "model_provider": (str,), + "name": (str,), + "output": (LLMObsSpanIO,), + "parent_id": (str,), + "span_id": (str,), + "span_kind": (str,), + "start_ns": (int,), + "status": (str,), + "tags": ([str],), + "tool_definitions": ([LLMObsSpanToolDefinition],), + "trace_id": (str,), + } + + attribute_map = { + "duration": "duration", + "evaluation": "evaluation", + "input": "input", + "intent": "intent", + "metadata": "metadata", + "metrics": "metrics", + "ml_app": "ml_app", + "model_name": "model_name", + "model_provider": "model_provider", + "name": "name", + "output": "output", + "parent_id": "parent_id", + "span_id": "span_id", + "span_kind": "span_kind", + "start_ns": "start_ns", + "status": "status", + "tags": "tags", + "tool_definitions": "tool_definitions", + "trace_id": "trace_id", + } + + def __init__( + self_, + duration: float, + ml_app: str, + name: str, + span_id: str, + span_kind: str, + start_ns: int, + status: str, + trace_id: str, + evaluation: Union[Dict[str, LLMObsSpanEvaluationMetric], UnsetType] = unset, + input: Union[LLMObsSpanIO, UnsetType] = unset, + intent: Union[str, UnsetType] = unset, + metadata: Union[Dict[str, Any], UnsetType] = unset, + metrics: Union[Dict[str, float], UnsetType] = unset, + model_name: Union[str, UnsetType] = unset, + model_provider: Union[str, UnsetType] = unset, + output: Union[LLMObsSpanIO, UnsetType] = unset, + parent_id: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + tool_definitions: Union[List[LLMObsSpanToolDefinition], UnsetType] = unset, + **kwargs, + ): + """ + Attributes of an LLM Observability span. + + :param duration: Duration of the span in nanoseconds. + :type duration: float + + :param evaluation: Evaluation metrics keyed by evaluator name. + :type evaluation: {str: (LLMObsSpanEvaluationMetric,)}, optional + + :param input: Input or output content of an LLM Observability span. + :type input: LLMObsSpanIO, optional + + :param intent: Detected intent of the span. + :type intent: str, optional + + :param metadata: Arbitrary metadata associated with the span. + :type metadata: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param metrics: Numeric metrics associated with the span (e.g., token counts). + :type metrics: {str: (float,)}, optional + + :param ml_app: Name of the ML application this span belongs to. + :type ml_app: str + + :param model_name: Name of the model used in this span. + :type model_name: str, optional + + :param model_provider: Provider of the model used in this span. + :type model_provider: str, optional + + :param name: Name of the span. + :type name: str + + :param output: Input or output content of an LLM Observability span. + :type output: LLMObsSpanIO, optional + + :param parent_id: Identifier of the parent span, if any. + :type parent_id: str, optional + + :param span_id: Unique identifier of the span. + :type span_id: str + + :param span_kind: Kind of span (e.g., llm, agent, tool, task, workflow). + :type span_kind: str + + :param start_ns: Start time of the span in nanoseconds since Unix epoch. + :type start_ns: int + + :param status: Status of the span (e.g., ok, error). + :type status: str + + :param tags: Tags associated with the span. + :type tags: [str], optional + + :param tool_definitions: Tool definitions available to the span. + :type tool_definitions: [LLMObsSpanToolDefinition], optional + + :param trace_id: Trace identifier this span belongs to. + :type trace_id: str + """ + if evaluation is not unset: + kwargs["evaluation"] = evaluation + if input is not unset: + kwargs["input"] = input + if intent is not unset: + kwargs["intent"] = intent + if metadata is not unset: + kwargs["metadata"] = metadata + if metrics is not unset: + kwargs["metrics"] = metrics + if model_name is not unset: + kwargs["model_name"] = model_name + if model_provider is not unset: + kwargs["model_provider"] = model_provider + if output is not unset: + kwargs["output"] = output + if parent_id is not unset: + kwargs["parent_id"] = parent_id + if tags is not unset: + kwargs["tags"] = tags + if tool_definitions is not unset: + kwargs["tool_definitions"] = tool_definitions + super().__init__(kwargs) + + self_.duration = duration + self_.ml_app = ml_app + self_.name = name + self_.span_id = span_id + self_.span_kind = span_kind + self_.start_ns = start_ns + self_.status = status + self_.trace_id = trace_id diff --git a/src/datadog_api_client/v2/model/llm_obs_span_data.py b/src/datadog_api_client/v2/model/llm_obs_span_data.py new file mode 100644 index 0000000000..eca4f9f4ad --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_data.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_attributes import LLMObsSpanAttributes + from datadog_api_client.v2.model.llm_obs_span_type import LLMObsSpanType + + +class LLMObsSpanData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_attributes import LLMObsSpanAttributes + from datadog_api_client.v2.model.llm_obs_span_type import LLMObsSpanType + + return { + "attributes": (LLMObsSpanAttributes,), + "id": (str,), + "type": (LLMObsSpanType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: LLMObsSpanAttributes, id: str, type: LLMObsSpanType, **kwargs): + """ + A single LLM Observability span. + + :param attributes: Attributes of an LLM Observability span. + :type attributes: LLMObsSpanAttributes + + :param id: Unique identifier of the span. + :type id: str + + :param type: Resource type for an LLM Observability span. + :type type: LLMObsSpanType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/llm_obs_span_evaluation_metric.py b/src/datadog_api_client/v2/model/llm_obs_span_evaluation_metric.py new file mode 100644 index 0000000000..8d884791db --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_evaluation_metric.py @@ -0,0 +1,95 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class LLMObsSpanEvaluationMetric(ModelNormal): + @cached_property + def openapi_types(_): + return { + "assessment": (str,), + "eval_metric_type": (str,), + "reasoning": (str,), + "status": (str,), + "tags": ([str],), + "value": ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ), + } + + attribute_map = { + "assessment": "assessment", + "eval_metric_type": "eval_metric_type", + "reasoning": "reasoning", + "status": "status", + "tags": "tags", + "value": "value", + } + + def __init__( + self_, + assessment: Union[str, UnsetType] = unset, + eval_metric_type: Union[str, UnsetType] = unset, + reasoning: Union[str, UnsetType] = unset, + status: Union[str, UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + value: Union[Any, UnsetType] = unset, + **kwargs, + ): + """ + An evaluation metric associated with an LLM Observability span. + + :param assessment: Assessment result (e.g., pass or fail). + :type assessment: str, optional + + :param eval_metric_type: Type of the evaluation metric (e.g., score, categorical, boolean). + :type eval_metric_type: str, optional + + :param reasoning: Human-readable reasoning for the evaluation result. + :type reasoning: str, optional + + :param status: Status of the evaluation execution. + :type status: str, optional + + :param tags: Tags associated with the evaluation metric. + :type tags: [str], optional + + :param value: Value of the evaluation result. + :type value: bool, date, datetime, dict, float, int, list, str, UUID, none_type, optional + """ + if assessment is not unset: + kwargs["assessment"] = assessment + if eval_metric_type is not unset: + kwargs["eval_metric_type"] = eval_metric_type + if reasoning is not unset: + kwargs["reasoning"] = reasoning + if status is not unset: + kwargs["status"] = status + if tags is not unset: + kwargs["tags"] = tags + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_filter.py b/src/datadog_api_client/v2/model/llm_obs_span_filter.py new file mode 100644 index 0000000000..09c060139c --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_filter.py @@ -0,0 +1,104 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpanFilter(ModelNormal): + @cached_property + def openapi_types(_): + return { + "_from": (str,), + "ml_app": (str,), + "query": (str,), + "span_id": (str,), + "span_kind": (str,), + "span_name": (str,), + "tags": ({str: (str,)},), + "to": (str,), + "trace_id": (str,), + } + + attribute_map = { + "_from": "from", + "ml_app": "ml_app", + "query": "query", + "span_id": "span_id", + "span_kind": "span_kind", + "span_name": "span_name", + "tags": "tags", + "to": "to", + "trace_id": "trace_id", + } + + def __init__( + self_, + _from: Union[str, UnsetType] = unset, + ml_app: Union[str, UnsetType] = unset, + query: Union[str, UnsetType] = unset, + span_id: Union[str, UnsetType] = unset, + span_kind: Union[str, UnsetType] = unset, + span_name: Union[str, UnsetType] = unset, + tags: Union[Dict[str, str], UnsetType] = unset, + to: Union[str, UnsetType] = unset, + trace_id: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Filter criteria for an LLM Observability span search. + + :param _from: Start of the time range. Accepts ISO 8601 or relative format (e.g., ``now-15m`` ). Defaults to ``now-15m``. + :type _from: str, optional + + :param ml_app: Filter by ML application name. + :type ml_app: str, optional + + :param query: Search query using LLM Observability query syntax. Supports attribute filters using the field:value syntax (e.g. session_id, trace_id, ml_app, meta.span.kind). When provided, structured field filters ( ``span_id`` , ``trace_id`` , etc.) are ignored. + :type query: str, optional + + :param span_id: Filter by exact span ID. + :type span_id: str, optional + + :param span_kind: Filter by span kind (e.g., llm, agent, tool, task, workflow). + :type span_kind: str, optional + + :param span_name: Filter by span name. + :type span_name: str, optional + + :param tags: Filter by tag key-value pairs. + :type tags: {str: (str,)}, optional + + :param to: End of the time range. Accepts ISO 8601 or relative format (e.g., ``now`` ). Defaults to ``now``. + :type to: str, optional + + :param trace_id: Filter by exact trace ID. + :type trace_id: str, optional + """ + if _from is not unset: + kwargs["_from"] = _from + if ml_app is not unset: + kwargs["ml_app"] = ml_app + if query is not unset: + kwargs["query"] = query + if span_id is not unset: + kwargs["span_id"] = span_id + if span_kind is not unset: + kwargs["span_kind"] = span_kind + if span_name is not unset: + kwargs["span_name"] = span_name + if tags is not unset: + kwargs["tags"] = tags + if to is not unset: + kwargs["to"] = to + if trace_id is not unset: + kwargs["trace_id"] = trace_id + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_io.py b/src/datadog_api_client/v2/model/llm_obs_span_io.py new file mode 100644 index 0000000000..746d651543 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_io.py @@ -0,0 +1,54 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_message import LLMObsSpanMessage + + +class LLMObsSpanIO(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_message import LLMObsSpanMessage + + return { + "messages": ([LLMObsSpanMessage],), + "value": (str,), + } + + attribute_map = { + "messages": "messages", + "value": "value", + } + + def __init__( + self_, + messages: Union[List[LLMObsSpanMessage], UnsetType] = unset, + value: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Input or output content of an LLM Observability span. + + :param messages: List of messages in the input or output. + :type messages: [LLMObsSpanMessage], optional + + :param value: Plain-text value of the input or output. + :type value: str, optional + """ + if messages is not unset: + kwargs["messages"] = messages + if value is not unset: + kwargs["value"] = value + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_message.py b/src/datadog_api_client/v2/model/llm_obs_span_message.py new file mode 100644 index 0000000000..7d18930210 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_message.py @@ -0,0 +1,80 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_tool_call import LLMObsSpanToolCall + from datadog_api_client.v2.model.llm_obs_span_tool_result import LLMObsSpanToolResult + + +class LLMObsSpanMessage(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_tool_call import LLMObsSpanToolCall + from datadog_api_client.v2.model.llm_obs_span_tool_result import LLMObsSpanToolResult + + return { + "content": (str,), + "id": (str,), + "role": (str,), + "tool_calls": ([LLMObsSpanToolCall],), + "tool_results": ([LLMObsSpanToolResult],), + } + + attribute_map = { + "content": "content", + "id": "id", + "role": "role", + "tool_calls": "tool_calls", + "tool_results": "tool_results", + } + + def __init__( + self_, + content: Union[str, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + role: Union[str, UnsetType] = unset, + tool_calls: Union[List[LLMObsSpanToolCall], UnsetType] = unset, + tool_results: Union[List[LLMObsSpanToolResult], UnsetType] = unset, + **kwargs, + ): + """ + A single message in a span input or output. + + :param content: Text content of the message. + :type content: str, optional + + :param id: Unique identifier of the message. + :type id: str, optional + + :param role: Role of the message sender (e.g., user, assistant, system). + :type role: str, optional + + :param tool_calls: Tool calls made in this message. + :type tool_calls: [LLMObsSpanToolCall], optional + + :param tool_results: Tool results returned in this message. + :type tool_results: [LLMObsSpanToolResult], optional + """ + if content is not unset: + kwargs["content"] = content + if id is not unset: + kwargs["id"] = id + if role is not unset: + kwargs["role"] = role + if tool_calls is not unset: + kwargs["tool_calls"] = tool_calls + if tool_results is not unset: + kwargs["tool_results"] = tool_results + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_page_query.py b/src/datadog_api_client/v2/model/llm_obs_span_page_query.py new file mode 100644 index 0000000000..a9ec7e39ac --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_page_query.py @@ -0,0 +1,43 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpanPageQuery(ModelNormal): + @cached_property + def openapi_types(_): + return { + "cursor": (str,), + "limit": (int,), + } + + attribute_map = { + "cursor": "cursor", + "limit": "limit", + } + + def __init__(self_, cursor: Union[str, UnsetType] = unset, limit: Union[int, UnsetType] = unset, **kwargs): + """ + Pagination settings for a span search request. + + :param cursor: Cursor from the previous response to retrieve the next page. + :type cursor: str, optional + + :param limit: Maximum number of spans to return. Defaults to ``10``. + :type limit: int, optional + """ + if cursor is not unset: + kwargs["cursor"] = cursor + if limit is not unset: + kwargs["limit"] = limit + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_search_options.py b/src/datadog_api_client/v2/model/llm_obs_span_search_options.py new file mode 100644 index 0000000000..16f59e4324 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_search_options.py @@ -0,0 +1,45 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpanSearchOptions(ModelNormal): + @cached_property + def openapi_types(_): + return { + "include_attachments": (bool,), + "time_offset": (int,), + } + + attribute_map = { + "include_attachments": "include_attachments", + "time_offset": "time_offset", + } + + def __init__( + self_, include_attachments: Union[bool, UnsetType] = unset, time_offset: Union[int, UnsetType] = unset, **kwargs + ): + """ + Additional options for a span search request. + + :param include_attachments: Whether to include attachment data in the response. Defaults to ``true``. + :type include_attachments: bool, optional + + :param time_offset: Offset in seconds applied to both ``from`` and ``to`` timestamps. + :type time_offset: int, optional + """ + if include_attachments is not unset: + kwargs["include_attachments"] = include_attachments + if time_offset is not unset: + kwargs["time_offset"] = time_offset + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_tool_call.py b/src/datadog_api_client/v2/model/llm_obs_span_tool_call.py new file mode 100644 index 0000000000..1a1cc987c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_tool_call.py @@ -0,0 +1,83 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class LLMObsSpanToolCall(ModelNormal): + @cached_property + def openapi_types(_): + return { + "arguments": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "name": (str,), + "tool_id": (str,), + "type": (str,), + } + + attribute_map = { + "arguments": "arguments", + "name": "name", + "tool_id": "tool_id", + "type": "type", + } + + def __init__( + self_, + arguments: Union[Dict[str, Any], UnsetType] = unset, + name: Union[str, UnsetType] = unset, + tool_id: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A tool call made during a span. + + :param arguments: Arguments passed to the tool. + :type arguments: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param name: Name of the tool called. + :type name: str, optional + + :param tool_id: Identifier of the tool call. + :type tool_id: str, optional + + :param type: Type of the tool call. + :type type: str, optional + """ + if arguments is not unset: + kwargs["arguments"] = arguments + if name is not unset: + kwargs["name"] = name + if tool_id is not unset: + kwargs["tool_id"] = tool_id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_tool_definition.py b/src/datadog_api_client/v2/model/llm_obs_span_tool_definition.py new file mode 100644 index 0000000000..405cfa116f --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_tool_definition.py @@ -0,0 +1,83 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Any, Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class LLMObsSpanToolDefinition(ModelNormal): + @cached_property + def openapi_types(_): + return { + "description": (str,), + "name": (str,), + "schema": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "version": (str,), + } + + attribute_map = { + "description": "description", + "name": "name", + "schema": "schema", + "version": "version", + } + + def __init__( + self_, + description: Union[str, UnsetType] = unset, + name: Union[str, UnsetType] = unset, + schema: Union[Dict[str, Any], UnsetType] = unset, + version: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A tool definition available to an LLM span. + + :param description: Description of what the tool does. + :type description: str, optional + + :param name: Name of the tool. + :type name: str, optional + + :param schema: JSON schema describing the tool's input parameters. + :type schema: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param version: Version of the tool definition. + :type version: str, optional + """ + if description is not unset: + kwargs["description"] = description + if name is not unset: + kwargs["name"] = name + if schema is not unset: + kwargs["schema"] = schema + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_tool_result.py b/src/datadog_api_client/v2/model/llm_obs_span_tool_result.py new file mode 100644 index 0000000000..d1088b4b0e --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_tool_result.py @@ -0,0 +1,64 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpanToolResult(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + "result": (str,), + "tool_id": (str,), + "type": (str,), + } + + attribute_map = { + "name": "name", + "result": "result", + "tool_id": "tool_id", + "type": "type", + } + + def __init__( + self_, + name: Union[str, UnsetType] = unset, + result: Union[str, UnsetType] = unset, + tool_id: Union[str, UnsetType] = unset, + type: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A result returned from a tool call during a span. + + :param name: Name of the tool that produced this result. + :type name: str, optional + + :param result: Result value returned by the tool. + :type result: str, optional + + :param tool_id: Identifier of the corresponding tool call. + :type tool_id: str, optional + + :param type: Type of the tool result. + :type type: str, optional + """ + if name is not unset: + kwargs["name"] = name + if result is not unset: + kwargs["result"] = result + if tool_id is not unset: + kwargs["tool_id"] = tool_id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_span_type.py b/src/datadog_api_client/v2/model/llm_obs_span_type.py new file mode 100644 index 0000000000..10df331a92 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_span_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class LLMObsSpanType(ModelSimple): + """ + Resource type for an LLM Observability span. + + :param value: If omitted defaults to "span". Must be one of ["span"]. + :type value: str + """ + + allowed_values = { + "span", + } + SPAN: ClassVar["LLMObsSpanType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +LLMObsSpanType.SPAN = LLMObsSpanType("span") diff --git a/src/datadog_api_client/v2/model/llm_obs_spans_response.py b/src/datadog_api_client/v2/model/llm_obs_spans_response.py new file mode 100644 index 0000000000..2216730137 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_spans_response.py @@ -0,0 +1,65 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_span_data import LLMObsSpanData + from datadog_api_client.v2.model.llm_obs_spans_response_links import LLMObsSpansResponseLinks + from datadog_api_client.v2.model.llm_obs_spans_response_meta import LLMObsSpansResponseMeta + + +class LLMObsSpansResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_span_data import LLMObsSpanData + from datadog_api_client.v2.model.llm_obs_spans_response_links import LLMObsSpansResponseLinks + from datadog_api_client.v2.model.llm_obs_spans_response_meta import LLMObsSpansResponseMeta + + return { + "data": ([LLMObsSpanData],), + "links": (LLMObsSpansResponseLinks,), + "meta": (LLMObsSpansResponseMeta,), + } + + attribute_map = { + "data": "data", + "links": "links", + "meta": "meta", + } + + def __init__( + self_, + data: List[LLMObsSpanData], + meta: LLMObsSpansResponseMeta, + links: Union[LLMObsSpansResponseLinks, UnsetType] = unset, + **kwargs, + ): + """ + Response containing a list of LLM Observability spans. + + :param data: List of spans matching the query. + :type data: [LLMObsSpanData] + + :param links: Pagination links accompanying the spans response. + :type links: LLMObsSpansResponseLinks, optional + + :param meta: Metadata accompanying the spans response. + :type meta: LLMObsSpansResponseMeta + """ + if links is not unset: + kwargs["links"] = links + super().__init__(kwargs) + + self_.data = data + self_.meta = meta diff --git a/src/datadog_api_client/v2/model/llm_obs_spans_response_links.py b/src/datadog_api_client/v2/model/llm_obs_spans_response_links.py new file mode 100644 index 0000000000..605d29e19a --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_spans_response_links.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpansResponseLinks(ModelNormal): + @cached_property + def openapi_types(_): + return { + "next": (str,), + } + + attribute_map = { + "next": "next", + } + + def __init__(self_, next: Union[str, UnsetType] = unset, **kwargs): + """ + Pagination links accompanying the spans response. + + :param next: URL to retrieve the next page of results. + :type next: str, optional + """ + if next is not unset: + kwargs["next"] = next + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/llm_obs_spans_response_meta.py b/src/datadog_api_client/v2/model/llm_obs_spans_response_meta.py new file mode 100644 index 0000000000..163f27b327 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_spans_response_meta.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.llm_obs_spans_response_page import LLMObsSpansResponsePage + + +class LLMObsSpansResponseMeta(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.llm_obs_spans_response_page import LLMObsSpansResponsePage + + return { + "elapsed": (int,), + "page": (LLMObsSpansResponsePage,), + "request_id": (str,), + "status": (str,), + } + + attribute_map = { + "elapsed": "elapsed", + "page": "page", + "request_id": "request_id", + "status": "status", + } + + def __init__(self_, elapsed: int, page: LLMObsSpansResponsePage, request_id: str, status: str, **kwargs): + """ + Metadata accompanying the spans response. + + :param elapsed: Time elapsed for the query in milliseconds. + :type elapsed: int + + :param page: Pagination cursor for the spans response. + :type page: LLMObsSpansResponsePage + + :param request_id: Unique identifier for the request. + :type request_id: str + + :param status: Status of the query execution. + :type status: str + """ + super().__init__(kwargs) + + self_.elapsed = elapsed + self_.page = page + self_.request_id = request_id + self_.status = status diff --git a/src/datadog_api_client/v2/model/llm_obs_spans_response_page.py b/src/datadog_api_client/v2/model/llm_obs_spans_response_page.py new file mode 100644 index 0000000000..a9051c1749 --- /dev/null +++ b/src/datadog_api_client/v2/model/llm_obs_spans_response_page.py @@ -0,0 +1,36 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class LLMObsSpansResponsePage(ModelNormal): + @cached_property + def openapi_types(_): + return { + "after": (str,), + } + + attribute_map = { + "after": "after", + } + + def __init__(self_, after: Union[str, UnsetType] = unset, **kwargs): + """ + Pagination cursor for the spans response. + + :param after: Cursor to retrieve the next page of results. Absent when there are no more results. + :type after: str, optional + """ + if after is not unset: + kwargs["after"] = after + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index ef1d9dccc8..9811009d73 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -3380,6 +3380,14 @@ from datadog_api_client.v2.model.llm_obs_custom_eval_config_vertex_ai_options import ( LLMObsCustomEvalConfigVertexAIOptions, ) +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 +from datadog_api_client.v2.model.llm_obs_data_deletion_response import LLMObsDataDeletionResponse +from datadog_api_client.v2.model.llm_obs_data_deletion_response_attributes import LLMObsDataDeletionResponseAttributes +from datadog_api_client.v2.model.llm_obs_data_deletion_response_data import LLMObsDataDeletionResponseData +from datadog_api_client.v2.model.llm_obs_data_deletion_response_type import LLMObsDataDeletionResponseType from datadog_api_client.v2.model.llm_obs_dataset_data_attributes_request import LLMObsDatasetDataAttributesRequest from datadog_api_client.v2.model.llm_obs_dataset_data_attributes_response import LLMObsDatasetDataAttributesResponse from datadog_api_client.v2.model.llm_obs_dataset_data_request import LLMObsDatasetDataRequest @@ -3572,6 +3580,26 @@ from datadog_api_client.v2.model.llm_obs_project_update_request import LLMObsProjectUpdateRequest from datadog_api_client.v2.model.llm_obs_projects_response import LLMObsProjectsResponse from datadog_api_client.v2.model.llm_obs_record_type import LLMObsRecordType +from datadog_api_client.v2.model.llm_obs_search_spans_request import LLMObsSearchSpansRequest +from datadog_api_client.v2.model.llm_obs_search_spans_request_attributes import LLMObsSearchSpansRequestAttributes +from datadog_api_client.v2.model.llm_obs_search_spans_request_data import LLMObsSearchSpansRequestData +from datadog_api_client.v2.model.llm_obs_search_spans_request_type import LLMObsSearchSpansRequestType +from datadog_api_client.v2.model.llm_obs_span_attributes import LLMObsSpanAttributes +from datadog_api_client.v2.model.llm_obs_span_data import LLMObsSpanData +from datadog_api_client.v2.model.llm_obs_span_evaluation_metric import LLMObsSpanEvaluationMetric +from datadog_api_client.v2.model.llm_obs_span_filter import LLMObsSpanFilter +from datadog_api_client.v2.model.llm_obs_span_io import LLMObsSpanIO +from datadog_api_client.v2.model.llm_obs_span_message import LLMObsSpanMessage +from datadog_api_client.v2.model.llm_obs_span_page_query import LLMObsSpanPageQuery +from datadog_api_client.v2.model.llm_obs_span_search_options import LLMObsSpanSearchOptions +from datadog_api_client.v2.model.llm_obs_span_tool_call import LLMObsSpanToolCall +from datadog_api_client.v2.model.llm_obs_span_tool_definition import LLMObsSpanToolDefinition +from datadog_api_client.v2.model.llm_obs_span_tool_result import LLMObsSpanToolResult +from datadog_api_client.v2.model.llm_obs_span_type import LLMObsSpanType +from datadog_api_client.v2.model.llm_obs_spans_response import LLMObsSpansResponse +from datadog_api_client.v2.model.llm_obs_spans_response_links import LLMObsSpansResponseLinks +from datadog_api_client.v2.model.llm_obs_spans_response_meta import LLMObsSpansResponseMeta +from datadog_api_client.v2.model.llm_obs_spans_response_page import LLMObsSpansResponsePage from datadog_api_client.v2.model.llm_obs_trace_annotated_interaction_item import LLMObsTraceAnnotatedInteractionItem from datadog_api_client.v2.model.llm_obs_trace_interaction_item import LLMObsTraceInteractionItem from datadog_api_client.v2.model.llm_obs_trace_interaction_response_item import LLMObsTraceInteractionResponseItem @@ -10493,6 +10521,14 @@ "LLMObsCustomEvalConfigUpdateRequest", "LLMObsCustomEvalConfigUser", "LLMObsCustomEvalConfigVertexAIOptions", + "LLMObsDataDeletionRequest", + "LLMObsDataDeletionRequestAttributes", + "LLMObsDataDeletionRequestData", + "LLMObsDataDeletionRequestType", + "LLMObsDataDeletionResponse", + "LLMObsDataDeletionResponseAttributes", + "LLMObsDataDeletionResponseData", + "LLMObsDataDeletionResponseType", "LLMObsDatasetDataAttributesRequest", "LLMObsDatasetDataAttributesResponse", "LLMObsDatasetDataRequest", @@ -10613,6 +10649,26 @@ "LLMObsProjectUpdateRequest", "LLMObsProjectsResponse", "LLMObsRecordType", + "LLMObsSearchSpansRequest", + "LLMObsSearchSpansRequestAttributes", + "LLMObsSearchSpansRequestData", + "LLMObsSearchSpansRequestType", + "LLMObsSpanAttributes", + "LLMObsSpanData", + "LLMObsSpanEvaluationMetric", + "LLMObsSpanFilter", + "LLMObsSpanIO", + "LLMObsSpanMessage", + "LLMObsSpanPageQuery", + "LLMObsSpanSearchOptions", + "LLMObsSpanToolCall", + "LLMObsSpanToolDefinition", + "LLMObsSpanToolResult", + "LLMObsSpanType", + "LLMObsSpansResponse", + "LLMObsSpansResponseLinks", + "LLMObsSpansResponseMeta", + "LLMObsSpansResponsePage", "LLMObsTraceAnnotatedInteractionItem", "LLMObsTraceInteractionItem", "LLMObsTraceInteractionResponseItem", diff --git a/tests/v2/features/llm_observability.feature b/tests/v2/features/llm_observability.feature index e8661824fd..ec67139014 100644 --- a/tests/v2/features/llm_observability.feature +++ b/tests/v2/features/llm_observability.feature @@ -1,7 +1,7 @@ @endpoint(llm-observability) @endpoint(llm-observability-v2) Feature: LLM Observability - Manage LLM Observability projects, datasets, dataset records, experiments, - and annotations. + Manage LLM Observability spans, data, projects, datasets, dataset records, + experiments, and annotations. Background: Given a valid "apiKeyAuth" key in the system @@ -245,6 +245,22 @@ Feature: LLM Observability When the request is sent Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/ml-observability + Scenario: Delete LLM Observability data returns "Accepted" response + Given operation "DeleteLLMObsData" enabled + And new "DeleteLLMObsData" request + And body with value {"data": {"attributes": {"delay": 0, "from": 1705314600000, "query": {"query": "@trace_id:abc123def456"}, "to": 1705315200000}, "type": "create_deletion_req"}} + When the request is sent + Then the response status is 202 Accepted + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete LLM Observability data returns "Bad Request" response + Given operation "DeleteLLMObsData" enabled + And new "DeleteLLMObsData" request + And body with value {"data": {"attributes": {"delay": 0, "from": 1705314600000, "query": {"query": "@trace_id:abc123def456"}, "to": 1705315200000}, "type": "create_deletion_req"}} + When the request is sent + Then the response status is 400 Bad Request + @generated @skip @team:DataDog/ml-observability Scenario: Delete LLM Observability dataset records returns "Bad Request" response Given operation "DeleteLLMObsDatasetRecords" enabled @@ -558,6 +574,20 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: List LLM Observability spans returns "Bad Request" response + Given operation "ListLLMObsSpans" enabled + And new "ListLLMObsSpans" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: List LLM Observability spans returns "OK" response + Given operation "ListLLMObsSpans" enabled + And new "ListLLMObsSpans" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: List events for an LLM Observability experiment returns "Bad Request" response Given operation "ListLLMObsExperimentEvents" enabled @@ -633,6 +663,22 @@ Feature: LLM Observability When the request is sent Then the response status is 206 Partial Content — more results are available. Use `meta.after` as the next `page.cursor`. + @generated @skip @team:DataDog/ml-observability + Scenario: Search LLM Observability spans returns "Bad Request" response + Given operation "SearchLLMObsSpans" enabled + And new "SearchLLMObsSpans" request + And body with value {"data": {"attributes": {"filter": {"from": "now-900s", "ml_app": "my-llm-app", "query": "@session_id:abc123def456", "span_id": "abc123def456", "span_kind": "llm", "span_name": "llm_call", "to": "now", "trace_id": "trace-9a8b7c6d5e4f"}, "options": {"include_attachments": true, "time_offset": 0}, "page": {"cursor": "eyJzdGFydCI6MTAwfQ==", "limit": 10}, "sort": "-start_ns"}, "type": "spans"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Search LLM Observability spans returns "OK" response + Given operation "SearchLLMObsSpans" enabled + And new "SearchLLMObsSpans" request + And body with value {"data": {"attributes": {"filter": {"from": "now-900s", "ml_app": "my-llm-app", "query": "@session_id:abc123def456", "span_id": "abc123def456", "span_kind": "llm", "span_name": "llm_call", "to": "now", "trace_id": "trace-9a8b7c6d5e4f"}, "options": {"include_attachments": true, "time_offset": 0}, "page": {"cursor": "eyJzdGFydCI6MTAwfQ==", "limit": 10}, "sort": "-start_ns"}, "type": "spans"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Simple search experimentation entities returns "Bad Request" response Given operation "SimpleSearchLLMObsExperimentation" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 1b8f5ec0b9..02753f1a80 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -3660,6 +3660,14 @@ "type": "idempotent" } }, + "DeleteLLMObsData": { + "tag": "LLM Observability", + "undo": { + "operationId": "TODO", + "parameters": [], + "type": "unsafe" + } + }, "ListLLMObsAnnotationQueues": { "tag": "LLM Observability", "undo": { @@ -3817,6 +3825,18 @@ "type": "idempotent" } }, + "ListLLMObsSpans": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "SearchLLMObsSpans": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, "ListLLMObsDatasets": { "tag": "LLM Observability", "undo": {