diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6c01d9a66..bed8d5118 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1009,6 +1009,32 @@ components: required: true schema: type: string + LLMObsPromptIDPathParameter: + description: The customer-provided identifier of the LLM Observability prompt. + example: "customer-support-assistant" + in: path + name: prompt_id + required: true + schema: + type: string + LLMObsPromptLabelQueryParameter: + description: >- + **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. + in: query + name: label + required: false + schema: + type: string + LLMObsPromptVersionPathParameter: + description: The version number of the LLM Observability prompt. + example: 1 + in: path + name: version + required: true + schema: + format: int64 + minimum: 1 + type: integer LinkIDPathParameter: description: "The UUID of the case link." in: path @@ -52073,6 +52099,108 @@ components: $ref: "#/components/schemas/LLMObsContentBlock" minItems: 1 type: array + LLMObsCreatePromptData: + description: Data object for creating an LLM Observability prompt. + properties: + attributes: + $ref: "#/components/schemas/LLMObsCreatePromptDataAttributes" + type: + $ref: "#/components/schemas/LLMObsPromptType" + required: + - type + - attributes + type: object + LLMObsCreatePromptDataAttributes: + description: >- + Attributes for creating an LLM Observability prompt and its first version. `prompt_id` and `template` are required; all other attributes are optional. + properties: + description: + description: Optional description of the prompt. + type: string + env_ids: + description: >- + Optional feature-flag environment UUIDs the service attempts to enable and configure to use the first version as their default after creation. + items: + type: string + type: array + labels: + deprecated: true + description: >- + Optional labels to attach to the first version. Do not use this attribute for new integrations. + items: + $ref: "#/components/schemas/LLMObsPromptVersionLabel" + type: array + prompt_id: + description: Customer-provided identifier for the new prompt. + example: "customer-support-assistant" + minLength: 1 + type: string + template: + $ref: "#/components/schemas/LLMObsPromptTemplate" + title: + description: Optional title of the prompt. + type: string + user_version: + description: Optional user-supplied version identifier for the first version. + type: string + required: + - prompt_id + - template + type: object + LLMObsCreatePromptRequest: + description: Request to create an LLM Observability prompt. + properties: + data: + $ref: "#/components/schemas/LLMObsCreatePromptData" + required: + - data + type: object + LLMObsCreatePromptVersionData: + description: Data object for creating an LLM Observability prompt version. + properties: + attributes: + $ref: "#/components/schemas/LLMObsCreatePromptVersionDataAttributes" + type: + $ref: "#/components/schemas/LLMObsPromptVersionType" + required: + - type + - attributes + type: object + LLMObsCreatePromptVersionDataAttributes: + description: >- + Attributes for creating a new version of an LLM Observability prompt. `template` is required; all other attributes are optional. + properties: + description: + description: Optional description of this version. + type: string + env_ids: + description: >- + Optional feature-flag environment UUIDs the service attempts to enable and configure to use this version as their default after creation. + items: + type: string + type: array + labels: + deprecated: true + description: Optional labels to attach to this version. Do not use this attribute for new integrations. + items: + $ref: "#/components/schemas/LLMObsPromptVersionLabel" + type: array + template: + $ref: "#/components/schemas/LLMObsPromptTemplate" + user_version: + description: Optional user-supplied version identifier for this version. + type: string + required: + - template + type: object + LLMObsCreatePromptVersionRequest: + description: Request to create a new version of an LLM Observability prompt. + properties: + data: + $ref: "#/components/schemas/LLMObsCreatePromptVersionData" + required: + - data + type: object LLMObsCursorMeta: description: Pagination cursor metadata. properties: @@ -53548,6 +53676,53 @@ components: required: - data type: object + LLMObsDeletedPromptData: + description: Data object confirming that an LLM Observability prompt was deleted. + properties: + attributes: + $ref: "#/components/schemas/LLMObsDeletedPromptDataAttributes" + id: + description: Unique identifier of the deleted prompt. + example: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptType" + required: + - id + - type + - attributes + type: object + LLMObsDeletedPromptDataAttributes: + description: Attributes confirming that an LLM Observability prompt was deleted. + properties: + deleted_at: + description: Timestamp when the prompt was deleted. + example: "2025-02-10T09:15:00Z" + format: date-time + type: string + prompt_id: + description: Customer-provided identifier of the deleted prompt. + example: "customer-support-assistant" + type: string + required: + - prompt_id + - deleted_at + type: object + LLMObsDeletedPromptResponse: + description: Response confirming that an LLM Observability prompt was deleted. + example: + data: + attributes: + deleted_at: "2025-02-10T09:15:00Z" + prompt_id: "customer-support-assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + properties: + data: + $ref: "#/components/schemas/LLMObsDeletedPromptData" + required: + - data + type: object LLMObsDisplayBlockAnnotatedInteractionItem: description: A display_block interaction with its associated annotations. properties: @@ -56642,6 +56817,521 @@ components: required: - data type: object + LLMObsPromptChatMessage: + description: A single chat message in a prompt template. + properties: + content: + description: Content of the message. + example: "You are a helpful customer support assistant for {{company_name}}." + type: string + role: + description: Role of the message (for example `system`, `user`, or `assistant`). + example: "system" + type: string + required: + - role + - content + type: object + LLMObsPromptChatTemplate: + description: A chat prompt template. + items: + $ref: "#/components/schemas/LLMObsPromptChatMessage" + minItems: 1 + type: array + x-generate-alias-as-model: true + LLMObsPromptData: + description: Data object for an LLM Observability prompt. + properties: + attributes: + $ref: "#/components/schemas/LLMObsPromptDataAttributes" + id: + description: Unique identifier of the prompt. + example: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptType" + required: + - id + - type + - attributes + type: object + LLMObsPromptDataAttributes: + description: Attributes of an LLM Observability prompt registry entry. + properties: + author: + description: UUID of the user who authored the prompt. + type: string + created_at: + description: Timestamp when the prompt was created. + format: date-time + type: string + created_from: + description: >- + Source that created the prompt, such as `ui-registry`, `sdk-registry`, or `sdk-instrumentation`. + example: "sdk-registry" + type: string + datasets: + description: Datasets observed in runs associated with this prompt. + items: + $ref: "#/components/schemas/LLMObsPromptDataset" + type: array + description: + description: Description of the prompt. + type: string + extracted_from: + description: Source prompt from which this prompt was extracted, when applicable. + type: string + in_registry: + description: Whether the prompt is a registry entry (as opposed to a code-discovered prompt). + example: true + type: boolean + last_seen_at: + description: Timestamp of the most recent observed run of this prompt. + format: date-time + type: string + last_version_created_at: + description: Timestamp when the most recent version of the prompt was created. + format: date-time + type: string + ml_app: + description: The ML application this prompt is associated with. + type: string + ml_apps: + description: ML applications observed running this prompt. + items: + type: string + type: array + num_versions: + description: Number of versions of the prompt. + example: 2 + format: int64 + type: integer + prompt_id: + description: Customer-provided identifier of the prompt. + example: "customer-support-assistant" + type: string + source: + $ref: "#/components/schemas/LLMObsPromptResponseSource" + tags: + description: Tags observed on runs of this prompt. + items: + type: string + type: array + title: + description: Title of the prompt. + type: string + required: + - prompt_id + - source + - num_versions + - in_registry + - created_from + type: object + LLMObsPromptDataset: + description: A dataset observed in runs associated with a prompt or prompt version. + properties: + id: + description: Unique identifier of the dataset. + example: "" + type: string + name: + description: Name of the dataset. + type: string + required: + - id + type: object + LLMObsPromptResponse: + description: Response containing a single LLM Observability prompt. + example: + data: + attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + created_from: "sdk-registry" + description: "Answers customer questions using the company knowledge base." + in_registry: true + last_version_created_at: "2025-01-15T10:00:00Z" + num_versions: 1 + prompt_id: "customer-support-assistant" + source: registry + title: "Customer Support Assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + properties: + data: + $ref: "#/components/schemas/LLMObsPromptData" + required: + - data + type: object + LLMObsPromptResponseSource: + description: Whether the prompt was created from the registry or discovered from observed LLM calls. + enum: + - registry + - code + example: registry + type: string + x-enum-varnames: + - REGISTRY + - CODE + LLMObsPromptSDKData: + description: Data object for a flattened LLM Observability prompt version returned for SDK consumption. + properties: + attributes: + $ref: "#/components/schemas/LLMObsPromptSDKDataAttributes" + id: + description: Unique identifier of the prompt. + example: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptType" + required: + - id + - type + - attributes + type: object + LLMObsPromptSDKDataAttributes: + description: >- + Attributes of a flattened prompt version returned for SDK consumption. Exactly one of `template` and `chat_template` is returned. + properties: + chat_template: + description: >- + Chat template for this prompt version, as a list of role and content messages. Omitted for text templates. + items: + $ref: "#/components/schemas/LLMObsPromptChatMessage" + type: array + labels: + deprecated: true + description: Labels attached to the selected version. + items: + type: string + type: array + prompt_id: + description: Customer-provided identifier of the prompt. + example: "customer-support-assistant" + type: string + prompt_version_uuid: + description: Unique identifier of this prompt version. + example: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: string + template: + description: Text template for this prompt version. Omitted for chat templates. + type: string + version: + description: >- + Version identifier for this prompt version. This is the sequential version number unless a user-supplied version identifier was set, in which case that identifier is used instead. + example: "2" + type: string + type: object + LLMObsPromptSDKResponse: + description: Response containing a flattened LLM Observability prompt version for SDK consumption. + example: + data: + attributes: + chat_template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + prompt_id: "customer-support-assistant" + prompt_version_uuid: "d83ab666-61cc-5545-a83b-2424bb85467b" + version: "2" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + properties: + data: + $ref: "#/components/schemas/LLMObsPromptSDKData" + required: + - data + type: object + LLMObsPromptTemplate: + description: A text template or a list of chat messages. + example: "You are a helpful assistant for {{audience}}." + oneOf: + - $ref: "#/components/schemas/LLMObsPromptTextTemplate" + - $ref: "#/components/schemas/LLMObsPromptChatTemplate" + LLMObsPromptTextTemplate: + description: A text prompt template. + minLength: 1 + pattern: ".*\\S.*" + type: string + LLMObsPromptType: + description: Resource type of an LLM Observability prompt. + enum: + - prompt-templates + example: prompt-templates + type: string + x-enum-varnames: + - PROMPT_TEMPLATES + LLMObsPromptVersionData: + description: Data object for a specific version of an LLM Observability prompt. + properties: + attributes: + $ref: "#/components/schemas/LLMObsPromptVersionDataAttributes" + id: + description: Unique identifier of the prompt version. + example: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptVersionType" + required: + - id + - type + - attributes + type: object + LLMObsPromptVersionDataAttributes: + description: Attributes of a specific version of an LLM Observability prompt. + properties: + author: + description: UUID of the user who authored this version. + type: string + created_at: + description: Timestamp stored on this prompt version. + format: date-time + type: string + datasets: + description: Datasets observed in runs associated with this prompt version. + items: + $ref: "#/components/schemas/LLMObsPromptDataset" + type: array + description: + description: Description of this version. + type: string + labels: + deprecated: true + description: Labels attached to this version (for example `development`, `staging`, `production`). + items: + type: string + type: array + last_seen_at: + description: Timestamp of the most recent observed run of this prompt version. + format: date-time + type: string + ml_app: + description: The ML application this prompt is associated with. + type: string + ml_apps: + description: ML applications observed running this prompt version. + items: + type: string + type: array + prompt_id: + description: Customer-provided identifier of the parent prompt. + example: "customer-support-assistant" + type: string + prompt_uuid: + description: Unique identifier of the parent prompt. + example: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: string + tags: + description: Tags observed on runs of this prompt version. + items: + type: string + type: array + template: + $ref: "#/components/schemas/LLMObsPromptTemplate" + user_version: + description: User-supplied identifier for this version. + type: string + version: + description: Sequential version number. + example: 1 + format: int64 + minimum: 1 + type: integer + version_created_at: + description: Timestamp when this version was created. + format: date-time + type: string + required: + - prompt_uuid + - prompt_id + - template + - version + type: object + LLMObsPromptVersionLabel: + description: A label attached to an LLM Observability prompt version. + enum: + - production + - development + type: string + x-enum-varnames: + - PRODUCTION + - DEVELOPMENT + LLMObsPromptVersionListData: + description: Data object for a prompt version returned in a list. + properties: + attributes: + $ref: "#/components/schemas/LLMObsPromptVersionListDataAttributes" + id: + description: Unique identifier of the prompt version. + example: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: string + type: + $ref: "#/components/schemas/LLMObsPromptVersionType" + required: + - id + - type + - attributes + type: object + LLMObsPromptVersionListDataAttributes: + description: Attributes of a prompt version returned in a list, excluding its template. + properties: + author: + description: UUID of the user who authored this version. + type: string + created_at: + description: Timestamp stored on this prompt version. + format: date-time + type: string + datasets: + description: Datasets observed in runs associated with this prompt version. + items: + $ref: "#/components/schemas/LLMObsPromptDataset" + type: array + description: + description: Description of this version. + type: string + labels: + deprecated: true + description: Labels attached to this version (for example `development`, `staging`, `production`). + items: + type: string + type: array + last_seen_at: + description: Timestamp of the most recent observed run of this prompt version. + format: date-time + type: string + ml_app: + description: The ML application this prompt is associated with. + type: string + ml_apps: + description: ML applications observed running this prompt version. + items: + type: string + type: array + prompt_id: + description: Customer-provided identifier of the parent prompt. + example: "customer-support-assistant" + type: string + prompt_uuid: + description: Unique identifier of the parent prompt. + example: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: string + tags: + description: Tags observed on runs of this prompt version. + items: + type: string + type: array + user_version: + description: User-supplied identifier for this version. + type: string + version: + description: Sequential version number. + example: 1 + format: int64 + minimum: 1 + type: integer + version_created_at: + description: Timestamp when this version was created. + format: date-time + type: string + required: + - prompt_uuid + - prompt_id + - version + type: object + LLMObsPromptVersionResponse: + description: Response containing a specific version of an LLM Observability prompt. + example: + data: + attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions + properties: + data: + $ref: "#/components/schemas/LLMObsPromptVersionData" + required: + - data + type: object + LLMObsPromptVersionType: + description: Resource type of an LLM Observability prompt version. + enum: + - prompt-template-versions + example: prompt-template-versions + type: string + x-enum-varnames: + - PROMPT_TEMPLATE_VERSIONS + LLMObsPromptVersionsResponse: + description: Response containing the versions of an LLM Observability prompt. + example: + data: + - attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions + - attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + description: "Initial customer support prompt." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + version: 1 + version_created_at: "2025-01-15T10:00:00Z" + id: "20e5280b-c75d-5699-8a70-a2773a751428" + type: prompt-template-versions + properties: + data: + description: Prompt versions ordered from newest to oldest. + items: + $ref: "#/components/schemas/LLMObsPromptVersionListData" + type: array + required: + - data + type: object + LLMObsPromptsResponse: + description: Response containing a list of LLM Observability prompts. + example: + data: + - attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + created_from: "sdk-registry" + description: "Answers customer questions using the company knowledge base." + in_registry: true + last_version_created_at: "2025-02-01T14:30:00Z" + num_versions: 2 + prompt_id: "customer-support-assistant" + source: registry + title: "Customer Support Assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + properties: + data: + description: List of LLM Observability prompts. + items: + $ref: "#/components/schemas/LLMObsPromptData" + type: array + required: + - data + type: object LLMObsRecordType: description: Resource type of LLM Observability dataset records. enum: @@ -57135,6 +57825,79 @@ components: - TRACE - EXPERIMENT_TRACE - SESSION + LLMObsUpdatePromptData: + description: Data object for updating an LLM Observability prompt. + properties: + attributes: + $ref: "#/components/schemas/LLMObsUpdatePromptDataAttributes" + type: + $ref: "#/components/schemas/LLMObsPromptType" + required: + - type + - attributes + type: object + LLMObsUpdatePromptDataAttributes: + additionalProperties: false + description: >- + Attributes for updating an LLM Observability prompt. At least one of `title` or `description` must be provided; both attributes are optional individually. + minProperties: 1 + properties: + description: + description: Optional new description for the prompt. + type: string + title: + description: Optional new title for the prompt. + type: string + type: object + LLMObsUpdatePromptRequest: + description: Request to update an LLM Observability prompt's metadata. + properties: + data: + $ref: "#/components/schemas/LLMObsUpdatePromptData" + required: + - data + type: object + LLMObsUpdatePromptVersionData: + description: Data object for updating an LLM Observability prompt version. + properties: + attributes: + $ref: "#/components/schemas/LLMObsUpdatePromptVersionDataAttributes" + type: + $ref: "#/components/schemas/LLMObsPromptVersionType" + required: + - type + - attributes + type: object + LLMObsUpdatePromptVersionDataAttributes: + additionalProperties: false + description: >- + Attributes for updating an LLM Observability prompt version. At least one of `description`, `labels`, or `env_ids` must be provided; all three attributes are optional individually. + minProperties: 1 + properties: + description: + description: Optional new description for this version. + type: string + env_ids: + description: >- + Optional feature-flag environment UUIDs the service attempts to enable and configure to use this version as their default. + items: + type: string + type: array + labels: + deprecated: true + description: Optional new labels for this version. Do not use this attribute for new integrations. + items: + $ref: "#/components/schemas/LLMObsPromptVersionLabel" + type: array + type: object + LLMObsUpdatePromptVersionRequest: + description: Request to update an LLM Observability prompt version's metadata or feature-flag environments. + properties: + data: + $ref: "#/components/schemas/LLMObsUpdatePromptVersionData" + required: + - data + type: object LLMObsUpsertAnnotationItem: description: |- A single annotation to create or update. The annotation is matched by @@ -151608,18 +152371,700 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - summary: Push events for an LLM Observability experiment + summary: Push events for an LLM Observability experiment + 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/integrations/{integration}/accounts: + get: + description: Retrieve the list of configured accounts for the specified LLM provider integration. + operationId: ListLLMObsIntegrationAccounts + parameters: + - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + - account_id: "org-XYZ123" + account_name: "Production OpenAI" + account_region: "" + id: "account-abc123" + integration: "openai" + schema: + items: + $ref: "#/components/schemas/LLMObsIntegrationAccount" + type: array + 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 integration accounts + 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/integrations/{integration}/{account_id}/inference: + post: + description: Run an LLM inference request through the specified integration and account, returning the model response and token usage. + operationId: CreateLLMObsIntegrationInference + parameters: + - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" + - $ref: "#/components/parameters/LLMObsAccountIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + max_tokens: 256 + messages: + - content: "What is the capital of France?" + role: "user" + model_id: "gpt-4o" + temperature: 0.7 + schema: + $ref: "#/components/schemas/LLMObsIntegrationInferenceRequest" + description: Inference request parameters. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + max_tokens: 256 + messages: + - content: "What is the capital of France?" + role: "user" + model_id: "gpt-4o" + response: + assessment: "pass" + content: "The capital of France is Paris." + finish_reason: "stop" + inference_codes: [] + input_tokens: 15 + latency: 843 + output_tokens: 9 + tools: [] + total_tokens: 24 + temperature: 0.7 + schema: + $ref: "#/components/schemas/LLMObsIntegrationInferenceResponse" + 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" + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Internal Server Error + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Run an LLM inference + 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/integrations/{integration}/{account_id}/models: + get: + description: Retrieve the list of models available for the specified LLM provider integration and account. + operationId: ListLLMObsIntegrationModels + parameters: + - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" + - $ref: "#/components/parameters/LLMObsAccountIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + - has_access: true + id: "gpt-4o" + integration: "openai" + integration_display_name: "OpenAI" + json_schema: true + model_display_name: "GPT-4o" + model_id: "gpt-4o" + provider: "openai" + provider_display_name: "OpenAI" + schema: + items: + $ref: "#/components/schemas/LLMObsIntegrationModel" + type: array + 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 integration models + 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/projects: + get: + description: List all LLM Observability projects sorted by creation date, newest first. + operationId: ListLLMObsProjects + parameters: + - description: Filter projects by project ID. + in: query + name: filter[id] + schema: + type: string + - description: Filter projects by name. + in: query + name: filter[name] + schema: + type: string + - description: Use the Pagination cursor to retrieve the next page of results. + in: query + name: page[cursor] + schema: + type: string + - description: Maximum number of results to return per page. + in: query + name: page[limit] + schema: + format: int64 + type: integer + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: "" + name: My LLM Project + updated_at: "2024-01-01T00:00:00+00:00" + id: 00000000-0000-0000-0000-000000000001 + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectsResponse" + 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 projects + 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/). + post: + description: Create a new LLM Observability project. Returns the existing project if a name conflict occurs. + operationId: CreateLLMObsProject + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + name: My LLM Project + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectRequest" + description: Create project payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: "" + name: My LLM Project + updated_at: "2024-01-01T00:00:00+00:00" + id: 00000000-0000-0000-0000-000000000002 + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectResponse" + description: OK + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: "" + name: My LLM Project + updated_at: "2024-01-01T00:00:00+00:00" + id: 00000000-0000-0000-0000-000000000003 + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectResponse" + description: Created + "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: Create an LLM Observability project + 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/projects/delete: + post: + description: Delete one or more LLM Observability projects. + operationId: DeleteLLMObsProjects + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + project_ids: + - a33671aa-24fd-4dcd-9b33-a8ec7dde7751 + type: projects + schema: + $ref: "#/components/schemas/LLMObsDeleteProjectsRequest" + description: Delete projects payload. + required: true + responses: + "204": + description: No Content + "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 projects + 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/projects/{project_id}: + patch: + description: Partially update an existing LLM Observability project. + operationId: UpdateLLMObsProject + parameters: + - $ref: "#/components/parameters/LLMObsProjectIDPathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectUpdateRequest" + description: Update project payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T00:00:00+00:00" + description: "" + name: My LLM Project + updated_at: "2024-01-01T00:00:00+00:00" + id: 00000000-0000-0000-0000-000000000004 + type: projects + schema: + $ref: "#/components/schemas/LLMObsProjectResponse" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update an LLM Observability project + 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/prompts: + get: + description: List all LLM Observability prompts in the prompt registry for the organization. + operationId: ListLLMObsPrompts + parameters: + - description: Optional filter for prompts by prompt ID. + example: "customer-support-assistant" + in: query + name: filter[prompt_id] + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + created_from: "sdk-registry" + description: "Answers customer questions using the company knowledge base." + in_registry: true + last_version_created_at: "2025-02-01T14:30:00Z" + num_versions: 2 + prompt_id: "customer-support-assistant" + source: registry + title: "Customer Support Assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + schema: + $ref: "#/components/schemas/LLMObsPromptsResponse" + description: OK + "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 prompts + tags: + - LLM Observability + x-permission: + operator: OR + permissions: + - llm_observability_read + 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/). + post: + description: Create a new prompt (and its first version) in the LLM Observability prompt registry. + operationId: CreateLLMObsPrompt + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + description: "Answers customer questions using the company knowledge base." + prompt_id: "customer-support-assistant" + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + title: "Customer Support Assistant" + type: prompt-templates + schema: + $ref: "#/components/schemas/LLMObsCreatePromptRequest" + description: Create prompt payload. + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + created_from: "sdk-registry" + description: "Answers customer questions using the company knowledge base." + in_registry: true + last_version_created_at: "2025-01-15T10:00:00Z" + num_versions: 1 + prompt_id: "customer-support-assistant" + source: registry + title: "Customer Support Assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + schema: + $ref: "#/components/schemas/LLMObsPromptResponse" + 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 + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create an LLM Observability prompt + tags: + - LLM Observability + x-permission: + operator: AND + permissions: + - llm_observability_read + - llm_observability_write + - feature_flag_config_read + - feature_flag_config_write + - feature_flag_environment_config_read + 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/prompts/{prompt_id}: + delete: + description: >- + Soft-delete an LLM Observability prompt. The prompt's version rows are retained, but they are no longer accessible through the public prompt registry endpoints. + operationId: DeleteLLMObsPrompt + parameters: + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + deleted_at: "2025-02-10T09:15:00Z" + prompt_id: "customer-support-assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates + schema: + $ref: "#/components/schemas/LLMObsDeletedPromptResponse" + description: OK + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete an LLM Observability prompt tags: - LLM Observability + x-permission: + operator: AND + permissions: + - llm_observability_read + - llm_observability_write + - feature_flag_config_read + - feature_flag_config_write + - feature_flag_environment_config_read 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/integrations/{integration}/accounts: get: - description: Retrieve the list of configured accounts for the specified LLM provider integration. - operationId: ListLLMObsIntegrationAccounts + description: Get the latest version of an LLM Observability prompt by prompt ID. + operationId: GetLLMObsPrompt parameters: - - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" + - $ref: "#/components/parameters/LLMObsPromptLabelQueryParameter" responses: "200": content: @@ -151627,22 +153072,21 @@ paths: examples: default: value: - - account_id: "org-XYZ123" - account_name: "Production OpenAI" - account_region: "" - id: "account-abc123" - integration: "openai" + data: + attributes: + chat_template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + prompt_id: "customer-support-assistant" + prompt_version_uuid: "d83ab666-61cc-5545-a83b-2424bb85467b" + version: "2" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates schema: - items: - $ref: "#/components/schemas/LLMObsIntegrationAccount" - type: array + $ref: "#/components/schemas/LLMObsPromptSDKResponse" description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request "401": content: application/json: @@ -151655,39 +153099,46 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: List LLM integration accounts + summary: Get an LLM Observability prompt tags: - LLM Observability + x-permission: + operator: OR + permissions: + - llm_observability_read x-unstable: |- - **Note**: This endpoint is in Preview and is subject to change. + **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/integrations/{integration}/{account_id}/inference: - post: - description: Run an LLM inference request through the specified integration and account, returning the model response and token usage. - operationId: CreateLLMObsIntegrationInference + patch: + description: Update the title, the description, or both, for an LLM Observability prompt. + operationId: UpdateLLMObsPrompt parameters: - - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" - - $ref: "#/components/parameters/LLMObsAccountIDPathParameter" + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" requestBody: content: application/json: examples: default: value: - max_tokens: 256 - messages: - - content: "What is the capital of France?" - role: "user" - model_id: "gpt-4o" - temperature: 0.7 + data: + attributes: + description: "Answers customer questions using the company knowledge base." + title: "Customer Support Assistant" + type: prompt-templates schema: - $ref: "#/components/schemas/LLMObsIntegrationInferenceRequest" - description: Inference request parameters. + $ref: "#/components/schemas/LLMObsUpdatePromptRequest" + description: Update prompt payload. required: true responses: "200": @@ -151696,24 +153147,22 @@ paths: examples: default: value: - max_tokens: 256 - messages: - - content: "What is the capital of France?" - role: "user" - model_id: "gpt-4o" - response: - assessment: "pass" - content: "The capital of France is Paris." - finish_reason: "stop" - inference_codes: [] - input_tokens: 15 - latency: 843 - output_tokens: 9 - tools: [] - total_tokens: 24 - temperature: 0.7 + data: + attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + created_from: "sdk-registry" + description: "Answers customer questions using the company knowledge base." + in_registry: true + last_version_created_at: "2025-01-15T10:00:00Z" + num_versions: 1 + prompt_id: "customer-support-assistant" + source: registry + title: "Customer Support Assistant" + id: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + type: prompt-templates schema: - $ref: "#/components/schemas/LLMObsIntegrationInferenceResponse" + $ref: "#/components/schemas/LLMObsPromptResponse" description: OK "400": content: @@ -151733,106 +153182,38 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden - "429": - $ref: "#/components/responses/TooManyRequestsResponse" - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Internal Server Error - security: - - apiKeyAuth: [] - appKeyAuth: [] - summary: Run an LLM inference - 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/integrations/{integration}/{account_id}/models: - get: - description: Retrieve the list of models available for the specified LLM provider integration and account. - operationId: ListLLMObsIntegrationModels - parameters: - - $ref: "#/components/parameters/LLMObsIntegrationPathParameter" - - $ref: "#/components/parameters/LLMObsAccountIDPathParameter" - responses: - "200": - content: - application/json: - examples: - default: - value: - - has_access: true - id: "gpt-4o" - integration: "openai" - integration_display_name: "OpenAI" - json_schema: true - model_display_name: "GPT-4o" - model_id: "gpt-4o" - provider: "openai" - provider_display_name: "OpenAI" - schema: - items: - $ref: "#/components/schemas/LLMObsIntegrationModel" - type: array - 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": + "404": content: application/json: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Forbidden + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: List LLM integration models + summary: Update an LLM Observability prompt tags: - LLM Observability + x-permission: + operator: AND + permissions: + - llm_observability_read + - llm_observability_write + - feature_flag_config_read + - feature_flag_config_write + - feature_flag_environment_config_read x-unstable: |- - **Note**: This endpoint is in Preview and is subject to change. + **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/projects: + /api/v2/llm-obs/v1/prompts/{prompt_id}/versions: get: - description: List all LLM Observability projects sorted by creation date, newest first. - operationId: ListLLMObsProjects + description: >- + List all versions of an LLM Observability prompt, ordered newest to oldest. If the prompt does not exist, is not registered, or is archived, the response contains an empty list. + operationId: ListLLMObsPromptVersions parameters: - - description: Filter projects by project ID. - in: query - name: filter[id] - schema: - type: string - - description: Filter projects by name. - in: query - name: filter[name] - schema: - type: string - - description: Use the Pagination cursor to retrieve the next page of results. - in: query - name: page[cursor] - schema: - type: string - - description: Maximum number of results to return per page. - in: query - name: page[limit] - schema: - format: int64 - type: integer + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" responses: "200": content: @@ -151842,21 +153223,28 @@ paths: value: data: - attributes: - created_at: "2024-01-01T00:00:00+00:00" - description: "" - name: My LLM Project - updated_at: "2024-01-01T00:00:00+00:00" - id: 00000000-0000-0000-0000-000000000001 - type: projects + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions + - attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-01-15T10:00:00Z" + description: "Initial customer support prompt." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + version: 1 + version_created_at: "2025-01-15T10:00:00Z" + id: "20e5280b-c75d-5699-8a70-a2773a751428" + type: prompt-template-versions schema: - $ref: "#/components/schemas/LLMObsProjectsResponse" + $ref: "#/components/schemas/LLMObsPromptVersionsResponse" description: OK - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/JSONAPIErrorResponse" - description: Bad Request "401": content: application/json: @@ -151874,15 +153262,21 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - summary: List LLM Observability projects + summary: List versions of an LLM Observability prompt tags: - LLM Observability + x-permission: + operator: OR + permissions: + - llm_observability_read 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/). post: - description: Create a new LLM Observability project. Returns the existing project if a name conflict occurs. - operationId: CreateLLMObsProject + description: Create a new version of an existing LLM Observability prompt. + operationId: CreateLLMObsPromptVersion + parameters: + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" requestBody: content: application/json: @@ -151891,11 +153285,16 @@ paths: value: data: attributes: - name: My LLM Project - type: projects + description: "Give concise answers and cite relevant help-center articles." + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + type: prompt-template-versions schema: - $ref: "#/components/schemas/LLMObsProjectRequest" - description: Create project payload. + $ref: "#/components/schemas/LLMObsCreatePromptVersionRequest" + description: Create prompt version payload. required: true responses: "200": @@ -151906,32 +153305,23 @@ paths: value: data: attributes: - created_at: "2024-01-01T00:00:00+00:00" - description: "" - name: My LLM Project - updated_at: "2024-01-01T00:00:00+00:00" - id: 00000000-0000-0000-0000-000000000002 - type: projects + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions schema: - $ref: "#/components/schemas/LLMObsProjectResponse" + $ref: "#/components/schemas/LLMObsPromptVersionResponse" description: OK - "201": - content: - application/json: - examples: - default: - value: - data: - attributes: - created_at: "2024-01-01T00:00:00+00:00" - description: "" - name: My LLM Project - updated_at: "2024-01-01T00:00:00+00:00" - id: 00000000-0000-0000-0000-000000000003 - type: projects - schema: - $ref: "#/components/schemas/LLMObsProjectResponse" - description: Created "400": content: application/json: @@ -151950,39 +153340,64 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: Create an LLM Observability project + summary: Create a new LLM Observability prompt version tags: - LLM Observability + x-permission: + operator: AND + permissions: + - llm_observability_read + - llm_observability_write + - feature_flag_config_read + - feature_flag_config_write + - feature_flag_environment_config_read 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/projects/delete: - post: - description: Delete one or more LLM Observability projects. - operationId: DeleteLLMObsProjects - requestBody: - content: - application/json: - examples: - default: - value: - data: - attributes: - project_ids: - - a33671aa-24fd-4dcd-9b33-a8ec7dde7751 - type: projects - schema: - $ref: "#/components/schemas/LLMObsDeleteProjectsRequest" - description: Delete projects payload. - required: true + /api/v2/llm-obs/v1/prompts/{prompt_id}/versions/{version}: + get: + description: Get the full template of a single, specific version of an LLM Observability prompt. + operationId: GetLLMObsPromptVersion + parameters: + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" + - $ref: "#/components/parameters/LLMObsPromptVersionPathParameter" responses: - "204": - description: No Content + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions + schema: + $ref: "#/components/schemas/LLMObsPromptVersionResponse" + description: OK "400": content: application/json: @@ -152001,23 +153416,34 @@ paths: schema: $ref: "#/components/schemas/JSONAPIErrorResponse" description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found "429": $ref: "#/components/responses/TooManyRequestsResponse" security: - apiKeyAuth: [] appKeyAuth: [] - summary: Delete LLM Observability projects + summary: Get a specific LLM Observability prompt version tags: - LLM Observability + x-permission: + operator: OR + permissions: + - llm_observability_read 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/projects/{project_id}: patch: - description: Partially update an existing LLM Observability project. - operationId: UpdateLLMObsProject + description: >- + Update the description, the feature-flag environments, or both, for a specific version of an LLM Observability prompt. + operationId: UpdateLLMObsPromptVersion parameters: - - $ref: "#/components/parameters/LLMObsProjectIDPathParameter" + - $ref: "#/components/parameters/LLMObsPromptIDPathParameter" + - $ref: "#/components/parameters/LLMObsPromptVersionPathParameter" requestBody: content: application/json: @@ -152025,10 +153451,12 @@ paths: default: value: data: - type: projects + attributes: + description: "Give concise answers and cite relevant help-center articles." + type: prompt-template-versions schema: - $ref: "#/components/schemas/LLMObsProjectUpdateRequest" - description: Update project payload. + $ref: "#/components/schemas/LLMObsUpdatePromptVersionRequest" + description: Update prompt version payload. required: true responses: "200": @@ -152039,14 +153467,22 @@ paths: value: data: attributes: - created_at: "2024-01-01T00:00:00+00:00" - description: "" - name: My LLM Project - updated_at: "2024-01-01T00:00:00+00:00" - id: 00000000-0000-0000-0000-000000000004 - type: projects + author: "3b12f1df-14fd-4e12-bd6f-4a2f5c8b3d1e" + created_at: "2025-02-01T14:30:00Z" + description: "Give concise answers and cite relevant help-center articles." + prompt_id: "customer-support-assistant" + prompt_uuid: "4a1a28ff-8a25-5f0f-946f-f48264d772eb" + template: + - content: "You are a helpful customer support assistant for {{company_name}}." + role: "system" + - content: "Help {{customer_name}} with this question: {{question}}" + role: "user" + version: 2 + version_created_at: "2025-02-01T14:30:00Z" + id: "d83ab666-61cc-5545-a83b-2424bb85467b" + type: prompt-template-versions schema: - $ref: "#/components/schemas/LLMObsProjectResponse" + $ref: "#/components/schemas/LLMObsPromptVersionResponse" description: OK "400": content: @@ -152077,9 +153513,17 @@ paths: security: - apiKeyAuth: [] appKeyAuth: [] - summary: Update an LLM Observability project + summary: Update a specific LLM Observability prompt version tags: - LLM Observability + x-permission: + operator: AND + permissions: + - llm_observability_read + - llm_observability_write + - feature_flag_config_read + - feature_flag_config_write + - feature_flag_environment_config_read 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/). @@ -202449,7 +203893,8 @@ tags: description: Find out more at url: "https://docs.datadoghq.com/account_management/api-app-keys/" name: Key Management - - description: Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, and annotations. + - description: >- + Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, prompts, 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/examples/v2_llm-observability_CreateLLMObsPrompt.rs b/examples/v2_llm-observability_CreateLLMObsPrompt.rs new file mode 100644 index 000000000..901ec60cd --- /dev/null +++ b/examples/v2_llm-observability_CreateLLMObsPrompt.rs @@ -0,0 +1,40 @@ +// Create an LLM Observability prompt returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptData; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptDataAttributes; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptRequest; +use datadog_api_client::datadogV2::model::LLMObsPromptChatMessage; +use datadog_api_client::datadogV2::model::LLMObsPromptTemplate; +use datadog_api_client::datadogV2::model::LLMObsPromptType; + +#[tokio::main] +async fn main() { + let body = LLMObsCreatePromptRequest::new(LLMObsCreatePromptData::new( + LLMObsCreatePromptDataAttributes::new( + "Example-LLM-Observability".to_string(), + LLMObsPromptTemplate::LLMObsPromptChatTemplate(vec![ + LLMObsPromptChatMessage::new( + "You are a helpful customer support assistant for {{company_name}}." + .to_string(), + "system".to_string(), + ), + LLMObsPromptChatMessage::new( + "Help {{customer_name}} with this question: {{question}}".to_string(), + "user".to_string(), + ), + ]), + ) + .title("Customer Support Assistant".to_string()), + LLMObsPromptType::PROMPT_TEMPLATES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateLLMObsPrompt", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api.create_llm_obs_prompt(body).await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_CreateLLMObsPromptVersion.rs b/examples/v2_llm-observability_CreateLLMObsPromptVersion.rs new file mode 100644 index 000000000..708cbe0ad --- /dev/null +++ b/examples/v2_llm-observability_CreateLLMObsPromptVersion.rs @@ -0,0 +1,43 @@ +// Create a new LLM Observability prompt version returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptVersionData; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptVersionDataAttributes; +use datadog_api_client::datadogV2::model::LLMObsCreatePromptVersionRequest; +use datadog_api_client::datadogV2::model::LLMObsPromptChatMessage; +use datadog_api_client::datadogV2::model::LLMObsPromptTemplate; +use datadog_api_client::datadogV2::model::LLMObsPromptVersionType; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let body = LLMObsCreatePromptVersionRequest::new(LLMObsCreatePromptVersionData::new( + LLMObsCreatePromptVersionDataAttributes::new( + LLMObsPromptTemplate::LLMObsPromptChatTemplate(vec![ + LLMObsPromptChatMessage::new( + "You are a concise customer support assistant for {{company_name}}." + .to_string(), + "system".to_string(), + ), + LLMObsPromptChatMessage::new( + "Answer {{customer_name}}'s question: {{question}}".to_string(), + "user".to_string(), + ), + ]), + ), + LLMObsPromptVersionType::PROMPT_TEMPLATE_VERSIONS, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.CreateLLMObsPromptVersion", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .create_llm_obs_prompt_version(prompt_data_attributes_prompt_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_DeleteLLMObsPrompt.rs b/examples/v2_llm-observability_DeleteLLMObsPrompt.rs new file mode 100644 index 000000000..8d644f748 --- /dev/null +++ b/examples/v2_llm-observability_DeleteLLMObsPrompt.rs @@ -0,0 +1,21 @@ +// Delete an LLM Observability prompt returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.DeleteLLMObsPrompt", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .delete_llm_obs_prompt(prompt_data_attributes_prompt_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_GetLLMObsPrompt.rs b/examples/v2_llm-observability_GetLLMObsPrompt.rs new file mode 100644 index 000000000..874f9e051 --- /dev/null +++ b/examples/v2_llm-observability_GetLLMObsPrompt.rs @@ -0,0 +1,25 @@ +// Get an LLM Observability prompt returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::GetLLMObsPromptOptionalParams; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetLLMObsPrompt", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .get_llm_obs_prompt( + prompt_data_attributes_prompt_id.clone(), + GetLLMObsPromptOptionalParams::default(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_GetLLMObsPromptVersion.rs b/examples/v2_llm-observability_GetLLMObsPromptVersion.rs new file mode 100644 index 000000000..a9ac4e342 --- /dev/null +++ b/examples/v2_llm-observability_GetLLMObsPromptVersion.rs @@ -0,0 +1,31 @@ +// Get a specific LLM Observability prompt version returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + + // there is a valid "prompt_version" in the system + let prompt_version_data_attributes_version: i64 = + std::env::var("PROMPT_VERSION_DATA_ATTRIBUTES_VERSION") + .unwrap() + .parse() + .unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.GetLLMObsPromptVersion", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .get_llm_obs_prompt_version( + prompt_data_attributes_prompt_id.clone(), + prompt_version_data_attributes_version.clone(), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_ListLLMObsPromptVersions.rs b/examples/v2_llm-observability_ListLLMObsPromptVersions.rs new file mode 100644 index 000000000..fb731cd6b --- /dev/null +++ b/examples/v2_llm-observability_ListLLMObsPromptVersions.rs @@ -0,0 +1,21 @@ +// List versions of an LLM Observability prompt returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListLLMObsPromptVersions", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .list_llm_obs_prompt_versions(prompt_data_attributes_prompt_id.clone()) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_ListLLMObsPrompts.rs b/examples/v2_llm-observability_ListLLMObsPrompts.rs new file mode 100644 index 000000000..36bdd6344 --- /dev/null +++ b/examples/v2_llm-observability_ListLLMObsPrompts.rs @@ -0,0 +1,25 @@ +// List LLM Observability prompts returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::api_llm_observability::ListLLMObsPromptsOptionalParams; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.ListLLMObsPrompts", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .list_llm_obs_prompts( + ListLLMObsPromptsOptionalParams::default() + .filter_prompt_id(prompt_data_attributes_prompt_id.clone()), + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_UpdateLLMObsPrompt.rs b/examples/v2_llm-observability_UpdateLLMObsPrompt.rs new file mode 100644 index 000000000..7c500bffe --- /dev/null +++ b/examples/v2_llm-observability_UpdateLLMObsPrompt.rs @@ -0,0 +1,29 @@ +// Update an LLM Observability prompt returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsPromptType; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptData; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptDataAttributes; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptRequest; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + let body = LLMObsUpdatePromptRequest::new(LLMObsUpdatePromptData::new( + LLMObsUpdatePromptDataAttributes::new().title("Customer Support Assistant".to_string()), + LLMObsPromptType::PROMPT_TEMPLATES, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateLLMObsPrompt", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .update_llm_obs_prompt(prompt_data_attributes_prompt_id.clone(), body) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/examples/v2_llm-observability_UpdateLLMObsPromptVersion.rs b/examples/v2_llm-observability_UpdateLLMObsPromptVersion.rs new file mode 100644 index 000000000..d20a82479 --- /dev/null +++ b/examples/v2_llm-observability_UpdateLLMObsPromptVersion.rs @@ -0,0 +1,42 @@ +// Update a specific LLM Observability prompt version returns "OK" response +use datadog_api_client::datadog; +use datadog_api_client::datadogV2::api_llm_observability::LLMObservabilityAPI; +use datadog_api_client::datadogV2::model::LLMObsPromptVersionType; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptVersionData; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptVersionDataAttributes; +use datadog_api_client::datadogV2::model::LLMObsUpdatePromptVersionRequest; + +#[tokio::main] +async fn main() { + // there is a valid "prompt" in the system + let prompt_data_attributes_prompt_id = + std::env::var("PROMPT_DATA_ATTRIBUTES_PROMPT_ID").unwrap(); + + // there is a valid "prompt_version" in the system + let prompt_version_data_attributes_version: i64 = + std::env::var("PROMPT_VERSION_DATA_ATTRIBUTES_VERSION") + .unwrap() + .parse() + .unwrap(); + let body = LLMObsUpdatePromptVersionRequest::new(LLMObsUpdatePromptVersionData::new( + LLMObsUpdatePromptVersionDataAttributes::new().description( + "Give concise answers and cite relevant help-center articles.".to_string(), + ), + LLMObsPromptVersionType::PROMPT_TEMPLATE_VERSIONS, + )); + let mut configuration = datadog::Configuration::new(); + configuration.set_unstable_operation_enabled("v2.UpdateLLMObsPromptVersion", true); + let api = LLMObservabilityAPI::with_config(configuration); + let resp = api + .update_llm_obs_prompt_version( + prompt_data_attributes_prompt_id.clone(), + prompt_version_data_attributes_version.clone(), + body, + ) + .await; + if let Ok(value) = resp { + println!("{:#?}", value); + } else { + println!("{:#?}", resp.unwrap_err()); + } +} diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 14b321eae..e61234317 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -152,6 +152,8 @@ impl Default for Configuration { ("v2.create_llm_obs_experiment_events".to_owned(), false), ("v2.create_llm_obs_integration_inference".to_owned(), false), ("v2.create_llm_obs_project".to_owned(), false), + ("v2.create_llm_obs_prompt".to_owned(), false), + ("v2.create_llm_obs_prompt_version".to_owned(), false), ("v2.delete_llm_obs_annotation_queue".to_owned(), false), ( "v2.delete_llm_obs_annotation_queue_interactions".to_owned(), @@ -165,6 +167,7 @@ impl Default for Configuration { ("v2.delete_llm_obs_experiments".to_owned(), false), ("v2.delete_llm_obs_patterns_config".to_owned(), false), ("v2.delete_llm_obs_projects".to_owned(), false), + ("v2.delete_llm_obs_prompt".to_owned(), false), ("v2.export_llm_obs_dataset".to_owned(), false), ("v2.get_llm_obs_annotated_interactions".to_owned(), false), ( @@ -179,6 +182,8 @@ impl Default for Configuration { ("v2.get_llm_obs_dataset_draft_state".to_owned(), false), ("v2.get_llm_obs_patterns_config".to_owned(), false), ("v2.get_llm_obs_patterns_run_status".to_owned(), false), + ("v2.get_llm_obs_prompt".to_owned(), false), + ("v2.get_llm_obs_prompt_version".to_owned(), false), ("v2.list_llm_obs_annotation_queues".to_owned(), false), ("v2.list_llm_obs_dataset_records".to_owned(), false), ("v2.list_llm_obs_datasets".to_owned(), false), @@ -201,6 +206,8 @@ impl Default for Configuration { false, ), ("v2.list_llm_obs_projects".to_owned(), false), + ("v2.list_llm_obs_prompts".to_owned(), false), + ("v2.list_llm_obs_prompt_versions".to_owned(), false), ("v2.list_llm_obs_spans".to_owned(), false), ("v2.lock_llm_obs_dataset_draft_state".to_owned(), false), ("v2.restore_llm_obs_dataset_version".to_owned(), false), @@ -219,6 +226,8 @@ impl Default for Configuration { ("v2.update_llm_obs_dataset_records".to_owned(), false), ("v2.update_llm_obs_experiment".to_owned(), false), ("v2.update_llm_obs_project".to_owned(), false), + ("v2.update_llm_obs_prompt".to_owned(), false), + ("v2.update_llm_obs_prompt_version".to_owned(), false), ("v2.upload_llm_obs_dataset_records_file".to_owned(), false), ("v2.upsert_llm_obs_annotations".to_owned(), false), ("v2.upsert_llm_obs_patterns_config".to_owned(), false), diff --git a/src/datadogV2/api/api_llm_observability.rs b/src/datadogV2/api/api_llm_observability.rs index cbad0cd8a..22a81d8da 100644 --- a/src/datadogV2/api/api_llm_observability.rs +++ b/src/datadogV2/api/api_llm_observability.rs @@ -57,6 +57,22 @@ impl GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams { } } +/// GetLLMObsPromptOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::get_llm_obs_prompt`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct GetLLMObsPromptOptionalParams { + /// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. + pub label: Option, +} + +impl GetLLMObsPromptOptionalParams { + /// **Deprecated.** Optional label of the prompt version to return. Do not use this parameter for new integrations. If omitted, the latest version is returned. If the prompt has no labels, the latest version is returned even when a label is requested. If the prompt has labels but none match the requested label, a 404 response is returned. + pub fn label(mut self, value: String) -> Self { + self.label = Some(value); + self + } +} + /// ListLLMObsAnnotationQueuesOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::list_llm_obs_annotation_queues`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -370,6 +386,22 @@ impl ListLLMObsProjectsOptionalParams { } } +/// ListLLMObsPromptsOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::list_llm_obs_prompts`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListLLMObsPromptsOptionalParams { + /// Optional filter for prompts by prompt ID. + pub filter_prompt_id: Option, +} + +impl ListLLMObsPromptsOptionalParams { + /// Optional filter for prompts by prompt ID. + pub fn filter_prompt_id(mut self, value: String) -> Self { + self.filter_prompt_id = Some(value); + self + } +} + /// ListLLMObsSpansOptionalParams is a struct for passing parameters to the method [`LLMObservabilityAPI::list_llm_obs_spans`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -606,6 +638,24 @@ pub enum CreateLLMObsProjectError { UnknownValue(serde_json::Value), } +/// CreateLLMObsPromptError is a struct for typed errors of method [`LLMObservabilityAPI::create_llm_obs_prompt`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateLLMObsPromptError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// CreateLLMObsPromptVersionError is a struct for typed errors of method [`LLMObservabilityAPI::create_llm_obs_prompt_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateLLMObsPromptVersionError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// DeleteLLMObsAnnotationQueueError is a struct for typed errors of method [`LLMObservabilityAPI::delete_llm_obs_annotation_queue`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -696,6 +746,15 @@ pub enum DeleteLLMObsProjectsError { UnknownValue(serde_json::Value), } +/// DeleteLLMObsPromptError is a struct for typed errors of method [`LLMObservabilityAPI::delete_llm_obs_prompt`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteLLMObsPromptError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ExportLLMObsDatasetError is a struct for typed errors of method [`LLMObservabilityAPI::export_llm_obs_dataset`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -768,6 +827,24 @@ pub enum GetLLMObsPatternsRunStatusError { UnknownValue(serde_json::Value), } +/// GetLLMObsPromptError is a struct for typed errors of method [`LLMObservabilityAPI::get_llm_obs_prompt`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLLMObsPromptError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// GetLLMObsPromptVersionError is a struct for typed errors of method [`LLMObservabilityAPI::get_llm_obs_prompt_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLLMObsPromptVersionError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListLLMObsAnnotationQueuesError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_annotation_queues`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -912,6 +989,24 @@ pub enum ListLLMObsProjectsError { UnknownValue(serde_json::Value), } +/// ListLLMObsPromptVersionsError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_prompt_versions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListLLMObsPromptVersionsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// ListLLMObsPromptsError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_prompts`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListLLMObsPromptsError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListLLMObsSpansError is a struct for typed errors of method [`LLMObservabilityAPI::list_llm_obs_spans`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1047,6 +1142,24 @@ pub enum UpdateLLMObsProjectError { UnknownValue(serde_json::Value), } +/// UpdateLLMObsPromptError is a struct for typed errors of method [`LLMObservabilityAPI::update_llm_obs_prompt`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateLLMObsPromptError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + +/// UpdateLLMObsPromptVersionError is a struct for typed errors of method [`LLMObservabilityAPI::update_llm_obs_prompt_version`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateLLMObsPromptVersionError { + JSONAPIErrorResponse(crate::datadogV2::model::JSONAPIErrorResponse), + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// UploadLLMObsDatasetRecordsFileError is a struct for typed errors of method [`LLMObservabilityAPI::upload_llm_obs_dataset_records_file`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -1074,7 +1187,7 @@ pub enum UpsertLLMObsPatternsConfigError { UnknownValue(serde_json::Value), } -/// Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, and annotations. +/// Manage LLM Observability spans, data, projects, datasets, dataset records, experiments, prompts, and annotations. #[derive(Debug, Clone)] pub struct LLMObservabilityAPI { config: datadog::Configuration, @@ -3019,138 +3132,43 @@ impl LLMObservabilityAPI { } } - /// Delete an annotation queue by its ID. - pub async fn delete_llm_obs_annotation_queue( - &self, - queue_id: String, - ) -> Result<(), datadog::Error> { - match self - .delete_llm_obs_annotation_queue_with_http_info(queue_id) - .await - { - Ok(_) => Ok(()), - Err(err) => Err(err), - } - } - - /// Delete an annotation queue by its ID. - pub async fn delete_llm_obs_annotation_queue_with_http_info( + /// Create a new prompt (and its first version) in the LLM Observability prompt registry. + pub async fn create_llm_obs_prompt( &self, - queue_id: String, - ) -> Result, datadog::Error> - { - let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_annotation_queue"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_annotation_queue' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", - local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) + body: crate::datadogV2::model::LLMObsCreatePromptRequest, + ) -> Result< + crate::datadogV2::model::LLMObsPromptResponse, + datadog::Error, + > { + match self.create_llm_obs_prompt_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Delete one or more interactions from an annotation queue. - pub async fn delete_llm_obs_annotation_queue_interactions( - &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, - ) -> Result<(), datadog::Error> { - match self - .delete_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body) - .await - { - Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Delete one or more interactions from an annotation queue. - pub async fn delete_llm_obs_annotation_queue_interactions_with_http_info( + /// Create a new prompt (and its first version) in the LLM Observability prompt registry. + pub async fn create_llm_obs_prompt_with_http_info( &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, + body: crate::datadogV2::model::LLMObsCreatePromptRequest, ) -> Result< - datadog::ResponseContent<()>, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_annotation_queue_interactions"; + let operation_id = "v2.create_llm_obs_prompt"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_annotation_queue_interactions' is not enabled" - .to_string(), + msg: "Operation 'v2.create_llm_obs_prompt' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3158,9 +3176,8 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions/delete", - local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + "{}/api/v2/llm-obs/v1/prompts", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -3168,7 +3185,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -3254,13 +3271,20 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -3271,17 +3295,17 @@ impl LLMObservabilityAPI { } } - /// Delete one or more annotations from an annotation queue. - pub async fn delete_llm_obs_annotations( + /// Create a new version of an existing LLM Observability prompt. + pub async fn create_llm_obs_prompt_version( &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsDeleteAnnotationsRequest, + prompt_id: String, + body: crate::datadogV2::model::LLMObsCreatePromptVersionRequest, ) -> Result< - crate::datadogV2::model::LLMObsDeleteAnnotationsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptVersionResponse, + datadog::Error, > { match self - .delete_llm_obs_annotations_with_http_info(queue_id, body) + .create_llm_obs_prompt_version_with_http_info(prompt_id, body) .await { Ok(response_content) => { @@ -3297,22 +3321,22 @@ impl LLMObservabilityAPI { } } - /// Delete one or more annotations from an annotation queue. - pub async fn delete_llm_obs_annotations_with_http_info( + /// Create a new version of an existing LLM Observability prompt. + pub async fn create_llm_obs_prompt_version_with_http_info( &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsDeleteAnnotationsRequest, + prompt_id: String, + body: crate::datadogV2::model::LLMObsCreatePromptVersionRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_annotations"; + let operation_id = "v2.create_llm_obs_prompt_version"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_annotations' is not enabled".to_string(), + msg: "Operation 'v2.create_llm_obs_prompt_version' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3320,9 +3344,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotations/delete", + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}/versions", local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + prompt_id = datadog::urlencode(prompt_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -3416,7 +3440,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -3429,7 +3453,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -3440,13 +3464,13 @@ impl LLMObservabilityAPI { } } - /// Delete a custom LLM Observability evaluator configuration by its name. - pub async fn delete_llm_obs_custom_eval_config( + /// Delete an annotation queue by its ID. + pub async fn delete_llm_obs_annotation_queue( &self, - eval_name: String, - ) -> Result<(), datadog::Error> { - match self - .delete_llm_obs_custom_eval_config_with_http_info(eval_name) + queue_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_annotation_queue_with_http_info(queue_id) .await { Ok(_) => Ok(()), @@ -3454,19 +3478,19 @@ impl LLMObservabilityAPI { } } - /// Delete a custom LLM Observability evaluator configuration by its name. - pub async fn delete_llm_obs_custom_eval_config_with_http_info( + /// Delete an annotation queue by its ID. + pub async fn delete_llm_obs_annotation_queue_with_http_info( &self, - eval_name: String, - ) -> Result, datadog::Error> + queue_id: String, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_custom_eval_config"; + let operation_id = "v2.delete_llm_obs_annotation_queue"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_custom_eval_config' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_annotation_queue' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3474,9 +3498,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", local_configuration.get_operation_host(operation_id), - eval_name = datadog::urlencode(eval_name) + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); @@ -3529,7 +3553,7 @@ impl LLMObservabilityAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -3540,43 +3564,38 @@ impl LLMObservabilityAPI { } } - /// Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. - pub async fn delete_llm_obs_data( + /// Delete one or more interactions from an annotation queue. + pub async fn delete_llm_obs_annotation_queue_interactions( &self, - body: crate::datadogV2::model::LLMObsDataDeletionRequest, - ) -> Result< - crate::datadogV2::model::LLMObsDataDeletionResponse, - datadog::Error, - > { - match self.delete_llm_obs_data_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_annotation_queue_interactions_with_http_info(queue_id, body) + .await + { + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. - pub async fn delete_llm_obs_data_with_http_info( + /// Delete one or more interactions from an annotation queue. + pub async fn delete_llm_obs_annotation_queue_interactions_with_http_info( &self, - body: crate::datadogV2::model::LLMObsDataDeletionRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationQueueInteractionsRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent<()>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_data"; + let operation_id = "v2.delete_llm_obs_annotation_queue_interactions"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_data' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_annotation_queue_interactions' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3584,8 +3603,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/deletion/data/llmobs", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/interactions/delete", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -3593,7 +3613,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -3679,20 +3699,13 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -3703,36 +3716,48 @@ impl LLMObservabilityAPI { } } - /// Delete one or more records from an LLM Observability dataset. - pub async fn delete_llm_obs_dataset_records( + /// Delete one or more annotations from an annotation queue. + pub async fn delete_llm_obs_annotations( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, - ) -> Result<(), datadog::Error> { + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationsRequest, + ) -> Result< + crate::datadogV2::model::LLMObsDeleteAnnotationsResponse, + datadog::Error, + > { match self - .delete_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) + .delete_llm_obs_annotations_with_http_info(queue_id, body) .await { - Ok(_) => Ok(()), + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Delete one or more records from an LLM Observability dataset. - pub async fn delete_llm_obs_dataset_records_with_http_info( + /// Delete one or more annotations from an annotation queue. + pub async fn delete_llm_obs_annotations_with_http_info( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, - ) -> Result, datadog::Error> { + queue_id: String, + body: crate::datadogV2::model::LLMObsDeleteAnnotationsRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_dataset_records"; + let operation_id = "v2.delete_llm_obs_annotations"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_dataset_records' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_annotations' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3740,10 +3765,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records/delete", + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotations/delete", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -3751,7 +3775,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -3837,13 +3861,20 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -3854,14 +3885,13 @@ impl LLMObservabilityAPI { } } - /// Delete one or more LLM Observability datasets within the specified project. - pub async fn delete_llm_obs_datasets( + /// Delete a custom LLM Observability evaluator configuration by its name. + pub async fn delete_llm_obs_custom_eval_config( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsDeleteDatasetsRequest, - ) -> Result<(), datadog::Error> { + eval_name: String, + ) -> Result<(), datadog::Error> { match self - .delete_llm_obs_datasets_with_http_info(project_id, body) + .delete_llm_obs_custom_eval_config_with_http_info(eval_name) .await { Ok(_) => Ok(()), @@ -3869,19 +3899,19 @@ impl LLMObservabilityAPI { } } - /// Delete one or more LLM Observability datasets within the specified project. - pub async fn delete_llm_obs_datasets_with_http_info( + /// Delete a custom LLM Observability evaluator configuration by its name. + pub async fn delete_llm_obs_custom_eval_config_with_http_info( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsDeleteDatasetsRequest, - ) -> Result, datadog::Error> { + eval_name: String, + ) -> Result, datadog::Error> + { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_datasets"; + let operation_id = "v2.delete_llm_obs_custom_eval_config"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_datasets' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_custom_eval_config' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -3889,16 +3919,15 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/delete", + "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id) + eval_name = datadog::urlencode(eval_name) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent @@ -3929,52 +3958,6 @@ impl LLMObservabilityAPI { ); }; - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - #[cfg(feature = "zstd")] - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -3991,7 +3974,7 @@ impl LLMObservabilityAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4002,29 +3985,43 @@ impl LLMObservabilityAPI { } } - /// Delete one or more LLM Observability experiments. - pub async fn delete_llm_obs_experiments( + /// Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. + pub async fn delete_llm_obs_data( &self, - body: crate::datadogV2::model::LLMObsDeleteExperimentsRequest, - ) -> Result<(), datadog::Error> { - match self.delete_llm_obs_experiments_with_http_info(body).await { - Ok(_) => Ok(()), - Err(err) => Err(err), - } - } - - /// Delete one or more LLM Observability experiments. - pub async fn delete_llm_obs_experiments_with_http_info( + body: crate::datadogV2::model::LLMObsDataDeletionRequest, + ) -> Result< + crate::datadogV2::model::LLMObsDataDeletionResponse, + datadog::Error, + > { + match self.delete_llm_obs_data_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Submit a request to delete LLM Observability span data matching a trace ID filter within a specified time range. + pub async fn delete_llm_obs_data_with_http_info( &self, - body: crate::datadogV2::model::LLMObsDeleteExperimentsRequest, - ) -> Result, datadog::Error> { + body: crate::datadogV2::model::LLMObsDataDeletionRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_experiments"; + let operation_id = "v2.delete_llm_obs_data"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_experiments' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_data' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -4032,7 +4029,7 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments/delete", + "{}/api/v2/llm-obs/deletion/data/llmobs", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -4041,7 +4038,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -4127,13 +4124,20 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4144,13 +4148,15 @@ impl LLMObservabilityAPI { } } - /// Delete a patterns configuration by its ID. - pub async fn delete_llm_obs_patterns_config( + /// Delete one or more records from an LLM Observability dataset. + pub async fn delete_llm_obs_dataset_records( &self, - config_id: String, - ) -> Result<(), datadog::Error> { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, + ) -> Result<(), datadog::Error> { match self - .delete_llm_obs_patterns_config_with_http_info(config_id) + .delete_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) .await { Ok(_) => Ok(()), @@ -4158,18 +4164,20 @@ impl LLMObservabilityAPI { } } - /// Delete a patterns configuration by its ID. - pub async fn delete_llm_obs_patterns_config_with_http_info( + /// Delete one or more records from an LLM Observability dataset. + pub async fn delete_llm_obs_dataset_records_with_http_info( &self, - config_id: String, - ) -> Result, datadog::Error> { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDeleteDatasetRecordsRequest, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_patterns_config"; + let operation_id = "v2.delete_llm_obs_dataset_records"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_patterns_config' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_dataset_records' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -4177,15 +4185,17 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-configs/{config_id}", + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records/delete", local_configuration.get_operation_host(operation_id), - config_id = datadog::urlencode(config_id) + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent @@ -4216,6 +4226,52 @@ impl LLMObservabilityAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -4232,7 +4288,7 @@ impl LLMObservabilityAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4243,29 +4299,34 @@ impl LLMObservabilityAPI { } } - /// Delete one or more LLM Observability projects. - pub async fn delete_llm_obs_projects( + /// Delete one or more LLM Observability datasets within the specified project. + pub async fn delete_llm_obs_datasets( &self, - body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, - ) -> Result<(), datadog::Error> { - match self.delete_llm_obs_projects_with_http_info(body).await { + project_id: String, + body: crate::datadogV2::model::LLMObsDeleteDatasetsRequest, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_datasets_with_http_info(project_id, body) + .await + { Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Delete one or more LLM Observability projects. - pub async fn delete_llm_obs_projects_with_http_info( + /// Delete one or more LLM Observability datasets within the specified project. + pub async fn delete_llm_obs_datasets_with_http_info( &self, - body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, - ) -> Result, datadog::Error> { + project_id: String, + body: crate::datadogV2::model::LLMObsDeleteDatasetsRequest, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.delete_llm_obs_projects"; + let operation_id = "v2.delete_llm_obs_datasets"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_llm_obs_projects' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_datasets' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -4273,8 +4334,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/projects/delete", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets/delete", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -4374,7 +4436,7 @@ impl LLMObservabilityAPI { entity: None, }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4385,75 +4447,46 @@ impl LLMObservabilityAPI { } } - /// Download the contents of a dataset as a CSV file. The download is streamed and includes one row per dataset record. - pub async fn export_llm_obs_dataset( + /// Delete one or more LLM Observability experiments. + pub async fn delete_llm_obs_experiments( &self, - project_id: String, - dataset_id: String, - params: ExportLLMObsDatasetOptionalParams, - ) -> Result> { - match self - .export_llm_obs_dataset_with_http_info(project_id, dataset_id, params) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + body: crate::datadogV2::model::LLMObsDeleteExperimentsRequest, + ) -> Result<(), datadog::Error> { + match self.delete_llm_obs_experiments_with_http_info(body).await { + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// Download the contents of a dataset as a CSV file. The download is streamed and includes one row per dataset record. - pub async fn export_llm_obs_dataset_with_http_info( + /// Delete one or more LLM Observability experiments. + pub async fn delete_llm_obs_experiments_with_http_info( &self, - project_id: String, - dataset_id: String, - params: ExportLLMObsDatasetOptionalParams, - ) -> Result, datadog::Error> { + body: crate::datadogV2::model::LLMObsDeleteExperimentsRequest, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.export_llm_obs_dataset"; + let operation_id = "v2.delete_llm_obs_experiments"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.export_llm_obs_dataset' is not enabled".to_string(), + msg: "Operation 'v2.delete_llm_obs_experiments' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let format = params.format; - let version = params.version; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/export", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + "{}/api/v2/llm-obs/v1/experiments/delete", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = format { - local_req_builder = - local_req_builder.query(&[("format", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = version { - local_req_builder = - local_req_builder.query(&[("version", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -4483,28 +4516,1069 @@ impl LLMObservabilityAPI { ); }; - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::(&local_content) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete a patterns configuration by its ID. + pub async fn delete_llm_obs_patterns_config( + &self, + config_id: String, + ) -> Result<(), datadog::Error> { + match self + .delete_llm_obs_patterns_config_with_http_info(config_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete a patterns configuration by its ID. + pub async fn delete_llm_obs_patterns_config_with_http_info( + &self, + config_id: String, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_patterns_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_patterns_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/topic-discovery-configs/{config_id}", + local_configuration.get_operation_host(operation_id), + config_id = datadog::urlencode(config_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Delete one or more LLM Observability projects. + pub async fn delete_llm_obs_projects( + &self, + body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, + ) -> Result<(), datadog::Error> { + match self.delete_llm_obs_projects_with_http_info(body).await { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete one or more LLM Observability projects. + pub async fn delete_llm_obs_projects_with_http_info( + &self, + body: crate::datadogV2::model::LLMObsDeleteProjectsRequest, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_projects"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_projects' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/projects/delete", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Soft-delete an LLM Observability prompt. The prompt's version rows are retained, but they are no longer accessible through the public prompt registry endpoints. + pub async fn delete_llm_obs_prompt( + &self, + prompt_id: String, + ) -> Result< + crate::datadogV2::model::LLMObsDeletedPromptResponse, + datadog::Error, + > { + match self.delete_llm_obs_prompt_with_http_info(prompt_id).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Soft-delete an LLM Observability prompt. The prompt's version rows are retained, but they are no longer accessible through the public prompt registry endpoints. + pub async fn delete_llm_obs_prompt_with_http_info( + &self, + prompt_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.delete_llm_obs_prompt"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_llm_obs_prompt' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}", + local_configuration.get_operation_host(operation_id), + prompt_id = datadog::urlencode(prompt_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Download the contents of a dataset as a CSV file. The download is streamed and includes one row per dataset record. + pub async fn export_llm_obs_dataset( + &self, + project_id: String, + dataset_id: String, + params: ExportLLMObsDatasetOptionalParams, + ) -> Result> { + match self + .export_llm_obs_dataset_with_http_info(project_id, dataset_id, params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Download the contents of a dataset as a CSV file. The download is streamed and includes one row per dataset record. + pub async fn export_llm_obs_dataset_with_http_info( + &self, + project_id: String, + dataset_id: String, + params: ExportLLMObsDatasetOptionalParams, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.export_llm_obs_dataset"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.export_llm_obs_dataset' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let format = params.format; + let version = params.version; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/export", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = format { + local_req_builder = + local_req_builder.query(&[("format", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = version { + local_req_builder = + local_req_builder.query(&[("version", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::(&local_content) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Retrieve all interactions (traces and sessions) and their annotations for a given annotation queue. + pub async fn get_llm_obs_annotated_interactions( + &self, + queue_id: String, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotatedInteractionsResponse, + datadog::Error, + > { + match self + .get_llm_obs_annotated_interactions_with_http_info(queue_id) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Retrieve all interactions (traces and sessions) and their annotations for a given annotation queue. + pub async fn get_llm_obs_annotated_interactions_with_http_info( + &self, + queue_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_annotated_interactions"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_llm_obs_annotated_interactions' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Returns annotated interactions across all annotation queues for the given content IDs. + /// Results include queue metadata (ID and name) for each interaction. + pub async fn get_llm_obs_annotated_interactions_by_trace_i_ds( + &self, + content_ids: Vec, + params: GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, + datadog::Error, + > { + match self + .get_llm_obs_annotated_interactions_by_trace_i_ds_with_http_info(content_ids, params) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Returns annotated interactions across all annotation queues for the given content IDs. + /// Results include queue metadata (ID and name) for each interaction. + pub async fn get_llm_obs_annotated_interactions_by_trace_i_ds_with_http_info( + &self, + content_ids: Vec, + params: GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams, + ) -> Result< + datadog::ResponseContent< + crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, + >, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_annotated_interactions_by_trace_i_ds"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: + "Operation 'v2.get_llm_obs_annotated_interactions_by_trace_i_ds' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let offset = params.offset; + let limit = params.limit; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotated-interactions", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + local_req_builder = local_req_builder.query(&[( + "contentIds", + &content_ids + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + if let Some(ref local_query_param) = offset { + local_req_builder = + local_req_builder.query(&[("offset", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = limit { + local_req_builder = + local_req_builder.query(&[("limit", &local_query_param.to_string())]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Retrieve the label schema for a given annotation queue. + pub async fn get_llm_obs_annotation_queue_label_schema( + &self, + queue_id: String, + ) -> Result< + crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, + datadog::Error, + > { + match self + .get_llm_obs_annotation_queue_label_schema_with_http_info(queue_id) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Retrieve the label schema for a given annotation queue. + pub async fn get_llm_obs_annotation_queue_label_schema_with_http_info( + &self, + queue_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_annotation_queue_label_schema"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_llm_obs_annotation_queue_label_schema' is not enabled" + .to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/label-schema", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Retrieve a custom LLM Observability evaluator configuration by its name. + pub async fn get_llm_obs_custom_eval_config( + &self, + eval_name: String, + ) -> Result< + crate::datadogV2::model::LLMObsCustomEvalConfigResponse, + datadog::Error, + > { + match self + .get_llm_obs_custom_eval_config_with_http_info(eval_name) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Retrieve a custom LLM Observability evaluator configuration by its name. + pub async fn get_llm_obs_custom_eval_config_with_http_info( + &self, + eval_name: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_custom_eval_config"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_llm_obs_custom_eval_config' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", + local_configuration.get_operation_host(operation_id), + eval_name = datadog::urlencode(eval_name) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4515,16 +5589,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve all interactions (traces and sessions) and their annotations for a given annotation queue. - pub async fn get_llm_obs_annotated_interactions( + /// Retrieve the draft state of a dataset, including whether it is currently locked for editing and which user holds the lock. + pub async fn get_llm_obs_dataset_draft_state( &self, - queue_id: String, + project_id: String, + dataset_id: String, ) -> Result< - crate::datadogV2::model::LLMObsAnnotatedInteractionsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetDraftStateResponse, + datadog::Error, > { match self - .get_llm_obs_annotated_interactions_with_http_info(queue_id) + .get_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) .await { Ok(response_content) => { @@ -4540,21 +5615,22 @@ impl LLMObservabilityAPI { } } - /// Retrieve all interactions (traces and sessions) and their annotations for a given annotation queue. - pub async fn get_llm_obs_annotated_interactions_with_http_info( + /// Retrieve the draft state of a dataset, including whether it is currently locked for editing and which user holds the lock. + pub async fn get_llm_obs_dataset_draft_state_with_http_info( &self, - queue_id: String, + project_id: String, + dataset_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_annotated_interactions"; + let operation_id = "v2.get_llm_obs_dataset_draft_state"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_annotated_interactions' is not enabled".to_string(), + msg: "Operation 'v2.get_llm_obs_dataset_draft_state' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -4562,9 +5638,10 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/annotated-interactions", + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state", local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -4611,7 +5688,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -4624,7 +5701,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4635,20 +5712,14 @@ impl LLMObservabilityAPI { } } - /// Returns annotated interactions across all annotation queues for the given content IDs. - /// Results include queue metadata (ID and name) for each interaction. - pub async fn get_llm_obs_annotated_interactions_by_trace_i_ds( + /// Retrieve the patterns configuration for the organization. + pub async fn get_llm_obs_patterns_config( &self, - content_ids: Vec, - params: GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPatternsConfigResponse, + datadog::Error, > { - match self - .get_llm_obs_annotated_interactions_by_trace_i_ds_with_http_info(content_ids, params) - .await - { + match self.get_llm_obs_patterns_config_with_http_info().await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -4662,62 +5733,156 @@ impl LLMObservabilityAPI { } } - /// Returns annotated interactions across all annotation queues for the given content IDs. - /// Results include queue metadata (ID and name) for each interaction. - pub async fn get_llm_obs_annotated_interactions_by_trace_i_ds_with_http_info( + /// Retrieve the patterns configuration for the organization. + pub async fn get_llm_obs_patterns_config_with_http_info( &self, - content_ids: Vec, - params: GetLLMObsAnnotatedInteractionsByTraceIDsOptionalParams, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_annotated_interactions_by_trace_i_ds"; + let operation_id = "v2.get_llm_obs_patterns_config"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: - "Operation 'v2.get_llm_obs_annotated_interactions_by_trace_i_ds' is not enabled" - .to_string(), + msg: "Operation 'v2.get_llm_obs_patterns_config' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let offset = params.offset; - let limit = params.limit; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotated-interactions", + "{}/api/v2/llm-obs/v1/topic-discovery-configs/latest", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[( - "contentIds", - &content_ids - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - if let Some(ref local_query_param) = offset { - local_req_builder = - local_req_builder.query(&[("offset", &local_query_param.to_string())]); + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = limit { - local_req_builder = - local_req_builder.query(&[("limit", &local_query_param.to_string())]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Retrieve the status and step-by-step progress of the current or most recent + /// patterns run for a configuration. + pub async fn get_llm_obs_patterns_run_status( + &self, + config_id: String, + ) -> Result< + crate::datadogV2::model::LLMObsPatternsRunStatusResponse, + datadog::Error, + > { + match self + .get_llm_obs_patterns_run_status_with_http_info(config_id) + .await + { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Retrieve the status and step-by-step progress of the current or most recent + /// patterns run for a configuration. + pub async fn get_llm_obs_patterns_run_status_with_http_info( + &self, + config_id: String, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.get_llm_obs_patterns_run_status"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.get_llm_obs_patterns_run_status' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/topic-discovery-runs/status", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -4760,10 +5925,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsAnnotatedInteractionsByTraceResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -4774,7 +5938,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4785,16 +5949,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve the label schema for a given annotation queue. - pub async fn get_llm_obs_annotation_queue_label_schema( + /// Get the latest version of an LLM Observability prompt by prompt ID. + pub async fn get_llm_obs_prompt( &self, - queue_id: String, + prompt_id: String, + params: GetLLMObsPromptOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptSDKResponse, + datadog::Error, > { match self - .get_llm_obs_annotation_queue_label_schema_with_http_info(queue_id) + .get_llm_obs_prompt_with_http_info(prompt_id, params) .await { Ok(response_content) => { @@ -4810,36 +5975,44 @@ impl LLMObservabilityAPI { } } - /// Retrieve the label schema for a given annotation queue. - pub async fn get_llm_obs_annotation_queue_label_schema_with_http_info( + /// Get the latest version of an LLM Observability prompt by prompt ID. + pub async fn get_llm_obs_prompt_with_http_info( &self, - queue_id: String, + prompt_id: String, + params: GetLLMObsPromptOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_annotation_queue_label_schema"; + let operation_id = "v2.get_llm_obs_prompt"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_annotation_queue_label_schema' is not enabled" - .to_string(), + msg: "Operation 'v2.get_llm_obs_prompt' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let label = params.label; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/label-schema", + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}", local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + prompt_id = datadog::urlencode(prompt_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = label { + local_req_builder = + local_req_builder.query(&[("label", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -4882,10 +6055,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -4896,7 +6068,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -4907,16 +6079,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve a custom LLM Observability evaluator configuration by its name. - pub async fn get_llm_obs_custom_eval_config( + /// Get the full template of a single, specific version of an LLM Observability prompt. + pub async fn get_llm_obs_prompt_version( &self, - eval_name: String, + prompt_id: String, + version: i64, ) -> Result< - crate::datadogV2::model::LLMObsCustomEvalConfigResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptVersionResponse, + datadog::Error, > { match self - .get_llm_obs_custom_eval_config_with_http_info(eval_name) + .get_llm_obs_prompt_version_with_http_info(prompt_id, version) .await { Ok(response_content) => { @@ -4932,21 +6105,22 @@ impl LLMObservabilityAPI { } } - /// Retrieve a custom LLM Observability evaluator configuration by its name. - pub async fn get_llm_obs_custom_eval_config_with_http_info( + /// Get the full template of a single, specific version of an LLM Observability prompt. + pub async fn get_llm_obs_prompt_version_with_http_info( &self, - eval_name: String, + prompt_id: String, + version: i64, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_custom_eval_config"; + let operation_id = "v2.get_llm_obs_prompt_version"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_custom_eval_config' is not enabled".to_string(), + msg: "Operation 'v2.get_llm_obs_prompt_version' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -4954,9 +6128,10 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}/versions/{version}", local_configuration.get_operation_host(operation_id), - eval_name = datadog::urlencode(eval_name) + prompt_id = datadog::urlencode(prompt_id), + version = version ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -5003,7 +6178,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5016,7 +6191,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5027,17 +6202,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve the draft state of a dataset, including whether it is currently locked for editing and which user holds the lock. - pub async fn get_llm_obs_dataset_draft_state( + /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. + /// If neither is provided, all queues in the organization are returned. + pub async fn list_llm_obs_annotation_queues( &self, - project_id: String, - dataset_id: String, + params: ListLLMObsAnnotationQueuesOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsDatasetDraftStateResponse, - datadog::Error, + crate::datadogV2::model::LLMObsAnnotationQueuesResponse, + datadog::Error, > { match self - .get_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) + .list_llm_obs_annotation_queues_with_http_info(params) .await { Ok(response_content) => { @@ -5053,37 +6228,49 @@ impl LLMObservabilityAPI { } } - /// Retrieve the draft state of a dataset, including whether it is currently locked for editing and which user holds the lock. - pub async fn get_llm_obs_dataset_draft_state_with_http_info( + /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. + /// If neither is provided, all queues in the organization are returned. + pub async fn list_llm_obs_annotation_queues_with_http_info( &self, - project_id: String, - dataset_id: String, + params: ListLLMObsAnnotationQueuesOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_dataset_draft_state"; + let operation_id = "v2.list_llm_obs_annotation_queues"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_dataset_draft_state' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_annotation_queues' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let project_id = params.project_id; + let queue_ids = params.queue_ids; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + "{}/api/v2/llm-obs/v1/annotation-queues", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = project_id { + local_req_builder = + local_req_builder.query(&[("projectId", &local_query_param.to_string())]); + }; + if let Some(ref local) = queue_ids { + for param in local { + local_req_builder = local_req_builder.query(&[("queueIds", ¶m.to_string())]); + } + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -5126,7 +6313,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5139,7 +6326,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5150,14 +6337,20 @@ impl LLMObservabilityAPI { } } - /// Retrieve the patterns configuration for the organization. - pub async fn get_llm_obs_patterns_config( + /// List all records in an LLM Observability dataset, sorted by creation date, newest first. + pub async fn list_llm_obs_dataset_records( &self, + project_id: String, + dataset_id: String, + params: ListLLMObsDatasetRecordsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsPatternsConfigResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetRecordsListResponse, + datadog::Error, > { - match self.get_llm_obs_patterns_config_with_http_info().await { + match self + .list_llm_obs_dataset_records_with_http_info(project_id, dataset_id, params) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -5171,33 +6364,56 @@ impl LLMObservabilityAPI { } } - /// Retrieve the patterns configuration for the organization. - pub async fn get_llm_obs_patterns_config_with_http_info( + /// List all records in an LLM Observability dataset, sorted by creation date, newest first. + pub async fn list_llm_obs_dataset_records_with_http_info( &self, + project_id: String, + dataset_id: String, + params: ListLLMObsDatasetRecordsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_patterns_config"; + let operation_id = "v2.list_llm_obs_dataset_records"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_patterns_config' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_dataset_records' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let filter_version = params.filter_version; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-configs/latest", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = filter_version { + local_req_builder = + local_req_builder.query(&[("filter[version]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -5240,7 +6456,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5253,7 +6469,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5264,17 +6480,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve the status and step-by-step progress of the current or most recent - /// patterns run for a configuration. - pub async fn get_llm_obs_patterns_run_status( + /// List the active versions of a dataset. A version is created each time a dataset is referenced by an experiment run. + pub async fn list_llm_obs_dataset_versions( &self, - config_id: String, + project_id: String, + dataset_id: String, ) -> Result< - crate::datadogV2::model::LLMObsPatternsRunStatusResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetVersionsResponse, + datadog::Error, > { match self - .get_llm_obs_patterns_run_status_with_http_info(config_id) + .list_llm_obs_dataset_versions_with_http_info(project_id, dataset_id) .await { Ok(response_content) => { @@ -5290,22 +6506,22 @@ impl LLMObservabilityAPI { } } - /// Retrieve the status and step-by-step progress of the current or most recent - /// patterns run for a configuration. - pub async fn get_llm_obs_patterns_run_status_with_http_info( + /// List the active versions of a dataset. A version is created each time a dataset is referenced by an experiment run. + pub async fn list_llm_obs_dataset_versions_with_http_info( &self, - config_id: String, + project_id: String, + dataset_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.get_llm_obs_patterns_run_status"; + let operation_id = "v2.list_llm_obs_dataset_versions"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.get_llm_obs_patterns_run_status' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_dataset_versions' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -5313,14 +6529,14 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-runs/status", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/versions", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -5363,7 +6579,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5376,7 +6592,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5387,17 +6603,17 @@ impl LLMObservabilityAPI { } } - /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. - /// If neither is provided, all queues in the organization are returned. - pub async fn list_llm_obs_annotation_queues( + /// List all LLM Observability datasets for a project, sorted by creation date, newest first. + pub async fn list_llm_obs_datasets( &self, - params: ListLLMObsAnnotationQueuesOptionalParams, + project_id: String, + params: ListLLMObsDatasetsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsAnnotationQueuesResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetsResponse, + datadog::Error, > { match self - .list_llm_obs_annotation_queues_with_http_info(params) + .list_llm_obs_datasets_with_http_info(project_id, params) .await { Ok(response_content) => { @@ -5413,47 +6629,57 @@ impl LLMObservabilityAPI { } } - /// List annotation queues. Optionally filter by project ID or queue IDs. These parameters are mutually exclusive. - /// If neither is provided, all queues in the organization are returned. - pub async fn list_llm_obs_annotation_queues_with_http_info( + /// List all LLM Observability datasets for a project, sorted by creation date, newest first. + pub async fn list_llm_obs_datasets_with_http_info( &self, - params: ListLLMObsAnnotationQueuesOptionalParams, + project_id: String, + params: ListLLMObsDatasetsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_annotation_queues"; + let operation_id = "v2.list_llm_obs_datasets"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_annotation_queues' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_datasets' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let project_id = params.project_id; - let queue_ids = params.queue_ids; + let filter_name = params.filter_name; + let filter_id = params.filter_id; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = project_id { + if let Some(ref local_query_param) = filter_name { local_req_builder = - local_req_builder.query(&[("projectId", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); }; - if let Some(ref local) = queue_ids { - for param in local { - local_req_builder = local_req_builder.query(&[("queueIds", ¶m.to_string())]); - } + if let Some(ref local_query_param) = filter_id { + local_req_builder = + local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); }; // build headers @@ -5498,7 +6724,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5511,7 +6737,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5522,18 +6748,17 @@ impl LLMObservabilityAPI { } } - /// List all records in an LLM Observability dataset, sorted by creation date, newest first. - pub async fn list_llm_obs_dataset_records( + /// Retrieve spans and experiment-level summary metrics for a given experiment with cursor-based pagination. + pub async fn list_llm_obs_experiment_events( &self, - project_id: String, - dataset_id: String, - params: ListLLMObsDatasetRecordsOptionalParams, + experiment_id: String, + params: ListLLMObsExperimentEventsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsDatasetRecordsListResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentEventsV2Response, + datadog::Error, > { match self - .list_llm_obs_dataset_records_with_http_info(project_id, dataset_id, params) + .list_llm_obs_experiment_events_with_http_info(experiment_id, params) .await { Ok(response_content) => { @@ -5549,55 +6774,48 @@ impl LLMObservabilityAPI { } } - /// List all records in an LLM Observability dataset, sorted by creation date, newest first. - pub async fn list_llm_obs_dataset_records_with_http_info( + /// Retrieve spans and experiment-level summary metrics for a given experiment with cursor-based pagination. + pub async fn list_llm_obs_experiment_events_with_http_info( &self, - project_id: String, - dataset_id: String, - params: ListLLMObsDatasetRecordsOptionalParams, + experiment_id: String, + params: ListLLMObsExperimentEventsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_dataset_records"; + let operation_id = "v2.list_llm_obs_experiment_events"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_dataset_records' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_experiment_events' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let filter_version = params.filter_version; - let page_cursor = params.page_cursor; let page_limit = params.page_limit; + let page_cursor = params.page_cursor; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", + "{}/api/v2/llm-obs/v3/experiments/{experiment_id}/events", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + experiment_id = datadog::urlencode(experiment_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_version { + if let Some(ref local_query_param) = page_limit { local_req_builder = - local_req_builder.query(&[("filter[version]", &local_query_param.to_string())]); + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); }; if let Some(ref local_query_param) = page_cursor { local_req_builder = local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; // build headers let mut headers = HeaderMap::new(); @@ -5641,7 +6859,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5654,7 +6872,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5665,17 +6883,16 @@ impl LLMObservabilityAPI { } } - /// List the active versions of a dataset. A version is created each time a dataset is referenced by an experiment run. - pub async fn list_llm_obs_dataset_versions( + /// Retrieve spans with their evaluation metrics for a given experiment. Returns spans only, with no summary metrics and no pagination. Deprecated in favor of `ListLLMObsExperimentEventsV3`. + pub async fn list_llm_obs_experiment_events_v1( &self, - project_id: String, - dataset_id: String, + experiment_id: String, ) -> Result< - crate::datadogV2::model::LLMObsDatasetVersionsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentSpansResponse, + datadog::Error, > { match self - .list_llm_obs_dataset_versions_with_http_info(project_id, dataset_id) + .list_llm_obs_experiment_events_v1_with_http_info(experiment_id) .await { Ok(response_content) => { @@ -5691,22 +6908,21 @@ impl LLMObservabilityAPI { } } - /// List the active versions of a dataset. A version is created each time a dataset is referenced by an experiment run. - pub async fn list_llm_obs_dataset_versions_with_http_info( + /// Retrieve spans with their evaluation metrics for a given experiment. Returns spans only, with no summary metrics and no pagination. Deprecated in favor of `ListLLMObsExperimentEventsV3`. + pub async fn list_llm_obs_experiment_events_v1_with_http_info( &self, - project_id: String, - dataset_id: String, + experiment_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_dataset_versions"; + let operation_id = "v2.list_llm_obs_experiment_events_v1"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_dataset_versions' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_experiment_events_v1' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -5714,10 +6930,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/versions", + "{}/api/v2/llm-obs/v1/experiments/{experiment_id}/events", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + experiment_id = datadog::urlencode(experiment_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -5764,7 +6979,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5777,7 +6992,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5788,17 +7003,16 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability datasets for a project, sorted by creation date, newest first. - pub async fn list_llm_obs_datasets( + /// Retrieve spans and experiment-level summary metrics for a given experiment. Returns the full events payload without pagination. Deprecated: use `ListLLMObsExperimentEventsV3` instead. + pub async fn list_llm_obs_experiment_events_v2( &self, - project_id: String, - params: ListLLMObsDatasetsOptionalParams, + experiment_id: String, ) -> Result< - crate::datadogV2::model::LLMObsDatasetsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentEventsV2Response, + datadog::Error, > { match self - .list_llm_obs_datasets_with_http_info(project_id, params) + .list_llm_obs_experiment_events_v2_with_http_info(experiment_id) .await { Ok(response_content) => { @@ -5814,59 +7028,35 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability datasets for a project, sorted by creation date, newest first. - pub async fn list_llm_obs_datasets_with_http_info( + /// Retrieve spans and experiment-level summary metrics for a given experiment. Returns the full events payload without pagination. Deprecated: use `ListLLMObsExperimentEventsV3` instead. + pub async fn list_llm_obs_experiment_events_v2_with_http_info( &self, - project_id: String, - params: ListLLMObsDatasetsOptionalParams, + experiment_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_datasets"; + let operation_id = "v2.list_llm_obs_experiment_events_v2"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_datasets' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_experiment_events_v2' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let filter_name = params.filter_name; - let filter_id = params.filter_id; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets", + "{}/api/v2/llm-obs/v2/experiments/{experiment_id}/events", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id) + experiment_id = datadog::urlencode(experiment_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_name { - local_req_builder = - local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_id { - local_req_builder = - local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -5909,7 +7099,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -5922,7 +7112,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -5933,19 +7123,15 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans and experiment-level summary metrics for a given experiment with cursor-based pagination. - pub async fn list_llm_obs_experiment_events( + /// List all LLM Observability experiments sorted by creation date, newest first. + pub async fn list_llm_obs_experiments( &self, - experiment_id: String, - params: ListLLMObsExperimentEventsOptionalParams, + params: ListLLMObsExperimentsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsExperimentEventsV2Response, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentsResponse, + datadog::Error, > { - match self - .list_llm_obs_experiment_events_with_http_info(experiment_id, params) - .await - { + match self.list_llm_obs_experiments_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -5959,48 +7145,98 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans and experiment-level summary metrics for a given experiment with cursor-based pagination. - pub async fn list_llm_obs_experiment_events_with_http_info( + /// List all LLM Observability experiments sorted by creation date, newest first. + pub async fn list_llm_obs_experiments_with_http_info( &self, - experiment_id: String, - params: ListLLMObsExperimentEventsOptionalParams, + params: ListLLMObsExperimentsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_experiment_events"; + let operation_id = "v2.list_llm_obs_experiments"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_experiment_events' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_experiments' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_limit = params.page_limit; + let filter_project_id = params.filter_project_id; + let filter_dataset_id = params.filter_dataset_id; + let filter_id = params.filter_id; + let filter_name = params.filter_name; + let filter_experiment = params.filter_experiment; + let filter_metadata = params.filter_metadata; + let filter_parent_experiment_id = params.filter_parent_experiment_id; + let filter_is_deleted = params.filter_is_deleted; + let include_user_data = params.include_user_data; + let include_dataset_names = params.include_dataset_names; let page_cursor = params.page_cursor; + let page_limit = params.page_limit; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v3/experiments/{experiment_id}/events", - local_configuration.get_operation_host(operation_id), - experiment_id = datadog::urlencode(experiment_id) + "{}/api/v2/llm-obs/v1/experiments", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = page_limit { + if let Some(ref local_query_param) = filter_project_id { + local_req_builder = + local_req_builder.query(&[("filter[project_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_dataset_id { + local_req_builder = + local_req_builder.query(&[("filter[dataset_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_id { + local_req_builder = + local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_name { + local_req_builder = + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_experiment { + local_req_builder = + local_req_builder.query(&[("filter[experiment]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_metadata { + local_req_builder = + local_req_builder.query(&[("filter[metadata]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_parent_experiment_id { + local_req_builder = local_req_builder.query(&[( + "filter[parent_experiment_id]", + &local_query_param.to_string(), + )]); + }; + if let Some(ref local_query_param) = filter_is_deleted { local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[is_deleted]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = include_user_data { + local_req_builder = + local_req_builder.query(&[("include[user_data]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = include_dataset_names { + local_req_builder = local_req_builder + .query(&[("include[dataset_names]", &local_query_param.to_string())]); }; if let Some(ref local_query_param) = page_cursor { local_req_builder = local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; // build headers let mut headers = HeaderMap::new(); @@ -6044,7 +7280,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -6057,7 +7293,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6068,16 +7304,16 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans with their evaluation metrics for a given experiment. Returns spans only, with no summary metrics and no pagination. Deprecated in favor of `ListLLMObsExperimentEventsV3`. - pub async fn list_llm_obs_experiment_events_v1( + /// Retrieve the list of configured accounts for the specified LLM provider integration. + pub async fn list_llm_obs_integration_accounts( &self, - experiment_id: String, + integration: crate::datadogV2::model::LLMObsIntegrationName, ) -> Result< - crate::datadogV2::model::LLMObsExperimentSpansResponse, - datadog::Error, + Vec, + datadog::Error, > { match self - .list_llm_obs_experiment_events_v1_with_http_info(experiment_id) + .list_llm_obs_integration_accounts_with_http_info(integration) .await { Ok(response_content) => { @@ -6093,21 +7329,21 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans with their evaluation metrics for a given experiment. Returns spans only, with no summary metrics and no pagination. Deprecated in favor of `ListLLMObsExperimentEventsV3`. - pub async fn list_llm_obs_experiment_events_v1_with_http_info( + /// Retrieve the list of configured accounts for the specified LLM provider integration. + pub async fn list_llm_obs_integration_accounts_with_http_info( &self, - experiment_id: String, + integration: crate::datadogV2::model::LLMObsIntegrationName, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_experiment_events_v1"; + let operation_id = "v2.list_llm_obs_integration_accounts"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_experiment_events_v1' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_integration_accounts' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -6115,9 +7351,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments/{experiment_id}/events", + "{}/api/v2/llm-obs/v1/integrations/{integration}/accounts", local_configuration.get_operation_host(operation_id), - experiment_id = datadog::urlencode(experiment_id) + integration = datadog::urlencode(integration.to_string()) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -6164,7 +7400,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::>( &local_content, ) { Ok(e) => { @@ -6177,7 +7413,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6188,16 +7424,17 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans and experiment-level summary metrics for a given experiment. Returns the full events payload without pagination. Deprecated: use `ListLLMObsExperimentEventsV3` instead. - pub async fn list_llm_obs_experiment_events_v2( + /// Retrieve the list of models available for the specified LLM provider integration and account. + pub async fn list_llm_obs_integration_models( &self, - experiment_id: String, + integration: crate::datadogV2::model::LLMObsIntegrationName, + account_id: String, ) -> Result< - crate::datadogV2::model::LLMObsExperimentEventsV2Response, - datadog::Error, + Vec, + datadog::Error, > { match self - .list_llm_obs_experiment_events_v2_with_http_info(experiment_id) + .list_llm_obs_integration_models_with_http_info(integration, account_id) .await { Ok(response_content) => { @@ -6213,21 +7450,22 @@ impl LLMObservabilityAPI { } } - /// Retrieve spans and experiment-level summary metrics for a given experiment. Returns the full events payload without pagination. Deprecated: use `ListLLMObsExperimentEventsV3` instead. - pub async fn list_llm_obs_experiment_events_v2_with_http_info( + /// Retrieve the list of models available for the specified LLM provider integration and account. + pub async fn list_llm_obs_integration_models_with_http_info( &self, - experiment_id: String, + integration: crate::datadogV2::model::LLMObsIntegrationName, + account_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent>, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_experiment_events_v2"; + let operation_id = "v2.list_llm_obs_integration_models"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_experiment_events_v2' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_integration_models' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -6235,9 +7473,10 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v2/experiments/{experiment_id}/events", + "{}/api/v2/llm-obs/v1/integrations/{integration}/{account_id}/models", local_configuration.get_operation_host(operation_id), - experiment_id = datadog::urlencode(experiment_id) + integration = datadog::urlencode(integration.to_string()), + account_id = datadog::urlencode(account_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); @@ -6284,7 +7523,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::>( &local_content, ) { Ok(e) => { @@ -6297,7 +7536,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6308,15 +7547,20 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability experiments sorted by creation date, newest first. - pub async fn list_llm_obs_experiments( + /// List the data points grouped into a topic. For a parent topic, points from all + /// of its leaf topics are returned. + pub async fn list_llm_obs_patterns_clustered_points( &self, - params: ListLLMObsExperimentsOptionalParams, + topic_id: String, + params: ListLLMObsPatternsClusteredPointsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsExperimentsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPatternsClusteredPointsResponse, + datadog::Error, > { - match self.list_llm_obs_experiments_with_http_info(params).await { + match self + .list_llm_obs_patterns_clustered_points_with_http_info(topic_id, params) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -6330,99 +7574,166 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability experiments sorted by creation date, newest first. - pub async fn list_llm_obs_experiments_with_http_info( + /// List the data points grouped into a topic. For a parent topic, points from all + /// of its leaf topics are returned. + pub async fn list_llm_obs_patterns_clustered_points_with_http_info( &self, - params: ListLLMObsExperimentsOptionalParams, + topic_id: String, + params: ListLLMObsPatternsClusteredPointsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_experiments"; + let operation_id = "v2.list_llm_obs_patterns_clustered_points"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_experiments' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_patterns_clustered_points' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let filter_project_id = params.filter_project_id; - let filter_dataset_id = params.filter_dataset_id; - let filter_id = params.filter_id; - let filter_name = params.filter_name; - let filter_experiment = params.filter_experiment; - let filter_metadata = params.filter_metadata; - let filter_parent_experiment_id = params.filter_parent_experiment_id; - let filter_is_deleted = params.filter_is_deleted; - let include_user_data = params.include_user_data; - let include_dataset_names = params.include_dataset_names; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; + let page_size = params.page_size; + let page_token = params.page_token; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments", + "{}/api/v2/llm-obs/v1/topic-discovery-clustered-points", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - if let Some(ref local_query_param) = filter_project_id { - local_req_builder = - local_req_builder.query(&[("filter[project_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_dataset_id { - local_req_builder = - local_req_builder.query(&[("filter[dataset_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_id { - local_req_builder = - local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_name { - local_req_builder = - local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_experiment { - local_req_builder = - local_req_builder.query(&[("filter[experiment]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_metadata { - local_req_builder = - local_req_builder.query(&[("filter[metadata]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_parent_experiment_id { - local_req_builder = local_req_builder.query(&[( - "filter[parent_experiment_id]", - &local_query_param.to_string(), - )]); - }; - if let Some(ref local_query_param) = filter_is_deleted { + local_req_builder = local_req_builder.query(&[("topic_id", &topic_id.to_string())]); + if let Some(ref local_query_param) = page_size { local_req_builder = - local_req_builder.query(&[("filter[is_deleted]", &local_query_param.to_string())]); + local_req_builder.query(&[("page_size", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = include_user_data { + if let Some(ref local_query_param) = page_token { local_req_builder = - local_req_builder.query(&[("include[user_data]", &local_query_param.to_string())]); + local_req_builder.query(&[("page_token", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = include_dataset_names { - local_req_builder = local_req_builder - .query(&[("include[dataset_names]", &local_query_param.to_string())]); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); }; + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::< + crate::datadogV2::model::LLMObsPatternsClusteredPointsResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// List all patterns configurations for the organization. + pub async fn list_llm_obs_patterns_configs( + &self, + ) -> Result< + crate::datadogV2::model::LLMObsPatternsConfigsResponse, + datadog::Error, + > { + match self.list_llm_obs_patterns_configs_with_http_info().await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// List all patterns configurations for the organization. + pub async fn list_llm_obs_patterns_configs_with_http_info( + &self, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_llm_obs_patterns_configs"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_llm_obs_patterns_configs' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/topic-discovery-configs", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -6465,7 +7776,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -6478,7 +7789,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6489,16 +7800,16 @@ impl LLMObservabilityAPI { } } - /// Retrieve the list of configured accounts for the specified LLM provider integration. - pub async fn list_llm_obs_integration_accounts( + /// List the completed patterns runs for a configuration. + pub async fn list_llm_obs_patterns_runs( &self, - integration: crate::datadogV2::model::LLMObsIntegrationName, + config_id: String, ) -> Result< - Vec, - datadog::Error, + crate::datadogV2::model::LLMObsPatternsRunsResponse, + datadog::Error, > { match self - .list_llm_obs_integration_accounts_with_http_info(integration) + .list_llm_obs_patterns_runs_with_http_info(config_id) .await { Ok(response_content) => { @@ -6514,21 +7825,21 @@ impl LLMObservabilityAPI { } } - /// Retrieve the list of configured accounts for the specified LLM provider integration. - pub async fn list_llm_obs_integration_accounts_with_http_info( + /// List the completed patterns runs for a configuration. + pub async fn list_llm_obs_patterns_runs_with_http_info( &self, - integration: crate::datadogV2::model::LLMObsIntegrationName, + config_id: String, ) -> Result< - datadog::ResponseContent>, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_integration_accounts"; + let operation_id = "v2.list_llm_obs_patterns_runs"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_integration_accounts' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_patterns_runs' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -6536,13 +7847,14 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/integrations/{integration}/accounts", - local_configuration.get_operation_host(operation_id), - integration = datadog::urlencode(integration.to_string()) + "{}/api/v2/llm-obs/v1/topic-discovery-runs", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -6585,7 +7897,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::>( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -6598,7 +7910,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6609,17 +7921,18 @@ impl LLMObservabilityAPI { } } - /// Retrieve the list of models available for the specified LLM provider integration and account. - pub async fn list_llm_obs_integration_models( + /// List the topics discovered by a patterns run. When no run is specified, + /// the most recent completed run is used. + pub async fn list_llm_obs_patterns_topics( &self, - integration: crate::datadogV2::model::LLMObsIntegrationName, - account_id: String, + config_id: String, + params: ListLLMObsPatternsTopicsOptionalParams, ) -> Result< - Vec, - datadog::Error, + crate::datadogV2::model::LLMObsPatternsTopicsResponse, + datadog::Error, > { match self - .list_llm_obs_integration_models_with_http_info(integration, account_id) + .list_llm_obs_patterns_topics_with_http_info(config_id, params) .await { Ok(response_content) => { @@ -6635,37 +7948,45 @@ impl LLMObservabilityAPI { } } - /// Retrieve the list of models available for the specified LLM provider integration and account. - pub async fn list_llm_obs_integration_models_with_http_info( + /// List the topics discovered by a patterns run. When no run is specified, + /// the most recent completed run is used. + pub async fn list_llm_obs_patterns_topics_with_http_info( &self, - integration: crate::datadogV2::model::LLMObsIntegrationName, - account_id: String, + config_id: String, + params: ListLLMObsPatternsTopicsOptionalParams, ) -> Result< - datadog::ResponseContent>, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_integration_models"; + let operation_id = "v2.list_llm_obs_patterns_topics"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_integration_models' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_patterns_topics' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let run_id = params.run_id; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/integrations/{integration}/{account_id}/models", - local_configuration.get_operation_host(operation_id), - integration = datadog::urlencode(integration.to_string()), - account_id = datadog::urlencode(account_id) + "{}/api/v2/llm-obs/v1/topic-discovery-topics", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); + if let Some(ref local_query_param) = run_id { + local_req_builder = + local_req_builder.query(&[("run_id", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -6708,7 +8029,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::>( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -6721,7 +8042,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6732,18 +8053,19 @@ impl LLMObservabilityAPI { } } - /// List the data points grouped into a topic. For a parent topic, points from all - /// of its leaf topics are returned. - pub async fn list_llm_obs_patterns_clustered_points( + /// List the topics discovered by a patterns run, with the clustered points attached + /// inline to each leaf topic. When no run is specified, the most recent completed + /// run is used. + pub async fn list_llm_obs_patterns_topics_with_clustered_points( &self, - topic_id: String, - params: ListLLMObsPatternsClusteredPointsOptionalParams, + config_id: String, + params: ListLLMObsPatternsTopicsWithClusteredPointsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsPatternsClusteredPointsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, + datadog::Error, > { match self - .list_llm_obs_patterns_clustered_points_with_http_info(topic_id, params) + .list_llm_obs_patterns_topics_with_clustered_points_with_http_info(config_id, params) .await { Ok(response_content) => { @@ -6759,49 +8081,51 @@ impl LLMObservabilityAPI { } } - /// List the data points grouped into a topic. For a parent topic, points from all - /// of its leaf topics are returned. - pub async fn list_llm_obs_patterns_clustered_points_with_http_info( + /// List the topics discovered by a patterns run, with the clustered points attached + /// inline to each leaf topic. When no run is specified, the most recent completed + /// run is used. + pub async fn list_llm_obs_patterns_topics_with_clustered_points_with_http_info( &self, - topic_id: String, - params: ListLLMObsPatternsClusteredPointsOptionalParams, + config_id: String, + params: ListLLMObsPatternsTopicsWithClusteredPointsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_patterns_clustered_points"; + let operation_id = "v2.list_llm_obs_patterns_topics_with_clustered_points"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_patterns_clustered_points' is not enabled" - .to_string(), + msg: "Operation 'v2.list_llm_obs_patterns_topics_with_clustered_points' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let page_size = params.page_size; - let page_token = params.page_token; + let run_id = params.run_id; + let include_metrics = params.include_metrics; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-clustered-points", + "{}/api/v2/llm-obs/v1/topic-discovery-topics/with-cluster-points", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("topic_id", &topic_id.to_string())]); - if let Some(ref local_query_param) = page_size { + local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); + if let Some(ref local_query_param) = run_id { local_req_builder = - local_req_builder.query(&[("page_size", &local_query_param.to_string())]); + local_req_builder.query(&[("run_id", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = page_token { + if let Some(ref local_query_param) = include_metrics { local_req_builder = - local_req_builder.query(&[("page_token", &local_query_param.to_string())]); + local_req_builder.query(&[("include_metrics", &local_query_param.to_string())]); }; // build headers @@ -6847,7 +8171,7 @@ impl LLMObservabilityAPI { if !local_status.is_client_error() && !local_status.is_server_error() { match serde_json::from_str::< - crate::datadogV2::model::LLMObsPatternsClusteredPointsResponse, + crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, >(&local_content) { Ok(e) => { @@ -6860,7 +8184,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6871,14 +8195,15 @@ impl LLMObservabilityAPI { } } - /// List all patterns configurations for the organization. - pub async fn list_llm_obs_patterns_configs( + /// List all LLM Observability projects sorted by creation date, newest first. + pub async fn list_llm_obs_projects( &self, + params: ListLLMObsProjectsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsPatternsConfigsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsProjectsResponse, + datadog::Error, > { - match self.list_llm_obs_patterns_configs_with_http_info().await { + match self.list_llm_obs_projects_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -6892,33 +8217,57 @@ impl LLMObservabilityAPI { } } - /// List all patterns configurations for the organization. - pub async fn list_llm_obs_patterns_configs_with_http_info( + /// List all LLM Observability projects sorted by creation date, newest first. + pub async fn list_llm_obs_projects_with_http_info( &self, + params: ListLLMObsProjectsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_patterns_configs"; + let operation_id = "v2.list_llm_obs_projects"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_patterns_configs' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_projects' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } + // unbox and build optional parameters + let filter_id = params.filter_id; + let filter_name = params.filter_name; + let page_cursor = params.page_cursor; + let page_limit = params.page_limit; + let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-configs", + "{}/api/v2/llm-obs/v1/projects", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + if let Some(ref local_query_param) = filter_id { + local_req_builder = + local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_name { + local_req_builder = + local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -6961,7 +8310,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -6974,7 +8323,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -6985,16 +8334,16 @@ impl LLMObservabilityAPI { } } - /// List the completed patterns runs for a configuration. - pub async fn list_llm_obs_patterns_runs( + /// List all versions of an LLM Observability prompt, ordered newest to oldest. If the prompt does not exist, is not registered, or is archived, the response contains an empty list. + pub async fn list_llm_obs_prompt_versions( &self, - config_id: String, + prompt_id: String, ) -> Result< - crate::datadogV2::model::LLMObsPatternsRunsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptVersionsResponse, + datadog::Error, > { match self - .list_llm_obs_patterns_runs_with_http_info(config_id) + .list_llm_obs_prompt_versions_with_http_info(prompt_id) .await { Ok(response_content) => { @@ -7010,21 +8359,21 @@ impl LLMObservabilityAPI { } } - /// List the completed patterns runs for a configuration. - pub async fn list_llm_obs_patterns_runs_with_http_info( + /// List all versions of an LLM Observability prompt, ordered newest to oldest. If the prompt does not exist, is not registered, or is archived, the response contains an empty list. + pub async fn list_llm_obs_prompt_versions_with_http_info( &self, - config_id: String, + prompt_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_patterns_runs"; + let operation_id = "v2.list_llm_obs_prompt_versions"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_patterns_runs' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_prompt_versions' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -7032,14 +8381,13 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-runs", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}/versions", + local_configuration.get_operation_host(operation_id), + prompt_id = datadog::urlencode(prompt_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); - // build headers let mut headers = HeaderMap::new(); headers.insert("Accept", HeaderValue::from_static("application/json")); @@ -7082,7 +8430,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -7095,7 +8443,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7106,20 +8454,15 @@ impl LLMObservabilityAPI { } } - /// List the topics discovered by a patterns run. When no run is specified, - /// the most recent completed run is used. - pub async fn list_llm_obs_patterns_topics( + /// List all LLM Observability prompts in the prompt registry for the organization. + pub async fn list_llm_obs_prompts( &self, - config_id: String, - params: ListLLMObsPatternsTopicsOptionalParams, + params: ListLLMObsPromptsOptionalParams, ) -> Result< - crate::datadogV2::model::LLMObsPatternsTopicsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptsResponse, + datadog::Error, > { - match self - .list_llm_obs_patterns_topics_with_http_info(config_id, params) - .await - { + match self.list_llm_obs_prompts_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7133,43 +8476,40 @@ impl LLMObservabilityAPI { } } - /// List the topics discovered by a patterns run. When no run is specified, - /// the most recent completed run is used. - pub async fn list_llm_obs_patterns_topics_with_http_info( + /// List all LLM Observability prompts in the prompt registry for the organization. + pub async fn list_llm_obs_prompts_with_http_info( &self, - config_id: String, - params: ListLLMObsPatternsTopicsOptionalParams, + params: ListLLMObsPromptsOptionalParams, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_patterns_topics"; + let operation_id = "v2.list_llm_obs_prompts"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_patterns_topics' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_prompts' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let run_id = params.run_id; + let filter_prompt_id = params.filter_prompt_id; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-topics", + "{}/api/v2/llm-obs/v1/prompts", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); - if let Some(ref local_query_param) = run_id { + if let Some(ref local_query_param) = filter_prompt_id { local_req_builder = - local_req_builder.query(&[("run_id", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[prompt_id]", &local_query_param.to_string())]); }; // build headers @@ -7214,7 +8554,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -7227,7 +8567,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7238,21 +8578,13 @@ impl LLMObservabilityAPI { } } - /// List the topics discovered by a patterns run, with the clustered points attached - /// inline to each leaf topic. When no run is specified, the most recent completed - /// run is used. - pub async fn list_llm_obs_patterns_topics_with_clustered_points( + /// List LLM Observability spans matching the specified filters. + pub async fn list_llm_obs_spans( &self, - config_id: String, - params: ListLLMObsPatternsTopicsWithClusteredPointsOptionalParams, - ) -> Result< - crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, - datadog::Error, - > { - match self - .list_llm_obs_patterns_topics_with_clustered_points_with_http_info(config_id, params) - .await - { + params: ListLLMObsSpansOptionalParams, + ) -> Result> + { + match self.list_llm_obs_spans_with_http_info(params).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7266,51 +8598,95 @@ impl LLMObservabilityAPI { } } - /// List the topics discovered by a patterns run, with the clustered points attached - /// inline to each leaf topic. When no run is specified, the most recent completed - /// run is used. - pub async fn list_llm_obs_patterns_topics_with_clustered_points_with_http_info( + /// List LLM Observability spans matching the specified filters. + pub async fn list_llm_obs_spans_with_http_info( &self, - config_id: String, - params: ListLLMObsPatternsTopicsWithClusteredPointsOptionalParams, + params: ListLLMObsSpansOptionalParams, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_patterns_topics_with_clustered_points"; + let operation_id = "v2.list_llm_obs_spans"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_patterns_topics_with_clustered_points' is not enabled".to_string(), + msg: "Operation 'v2.list_llm_obs_spans' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } // unbox and build optional parameters - let run_id = params.run_id; - let include_metrics = params.include_metrics; + let filter_from = params.filter_from; + let filter_to = params.filter_to; + let filter_query = params.filter_query; + let filter_span_id = params.filter_span_id; + let filter_trace_id = params.filter_trace_id; + let filter_span_kind = params.filter_span_kind; + let filter_span_name = params.filter_span_name; + let filter_ml_app = params.filter_ml_app; + let page_limit = params.page_limit; + let page_cursor = params.page_cursor; + let sort = params.sort; + let include_attachments = params.include_attachments; let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-topics/with-cluster-points", + "{}/api/v2/llm-obs/v1/spans/events", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - local_req_builder = local_req_builder.query(&[("config_id", &config_id.to_string())]); - if let Some(ref local_query_param) = run_id { + if let Some(ref local_query_param) = filter_from { local_req_builder = - local_req_builder.query(&[("run_id", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[from]", &local_query_param.to_string())]); }; - if let Some(ref local_query_param) = include_metrics { + if let Some(ref local_query_param) = filter_to { local_req_builder = - local_req_builder.query(&[("include_metrics", &local_query_param.to_string())]); + local_req_builder.query(&[("filter[to]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_query { + local_req_builder = + local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_span_id { + local_req_builder = + local_req_builder.query(&[("filter[span_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_trace_id { + local_req_builder = + local_req_builder.query(&[("filter[trace_id]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_span_kind { + local_req_builder = + local_req_builder.query(&[("filter[span_kind]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_span_name { + local_req_builder = + local_req_builder.query(&[("filter[span_name]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = filter_ml_app { + local_req_builder = + local_req_builder.query(&[("filter[ml_app]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_limit { + local_req_builder = + local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_cursor { + local_req_builder = + local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = sort { + local_req_builder = + local_req_builder.query(&[("sort", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = include_attachments { + local_req_builder = + local_req_builder.query(&[("include_attachments", &local_query_param.to_string())]); }; // build headers @@ -7355,10 +8731,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsPatternsTopicsWithClusteredPointsResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -7369,7 +8744,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7380,15 +8755,19 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability projects sorted by creation date, newest first. - pub async fn list_llm_obs_projects( + /// Acquire the draft lock on a dataset for the calling user. The lock prevents other users from concurrently editing the dataset draft. + pub async fn lock_llm_obs_dataset_draft_state( &self, - params: ListLLMObsProjectsOptionalParams, + project_id: String, + dataset_id: String, ) -> Result< - crate::datadogV2::model::LLMObsProjectsResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetDraftStateResponse, + datadog::Error, > { - match self.list_llm_obs_projects_with_http_info(params).await { + match self + .lock_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -7402,56 +8781,36 @@ impl LLMObservabilityAPI { } } - /// List all LLM Observability projects sorted by creation date, newest first. - pub async fn list_llm_obs_projects_with_http_info( + /// Acquire the draft lock on a dataset for the calling user. The lock prevents other users from concurrently editing the dataset draft. + pub async fn lock_llm_obs_dataset_draft_state_with_http_info( &self, - params: ListLLMObsProjectsOptionalParams, + project_id: String, + dataset_id: String, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_projects"; + let operation_id = "v2.lock_llm_obs_dataset_draft_state"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_projects' is not enabled".to_string(), + msg: "Operation 'v2.lock_llm_obs_dataset_draft_state' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let filter_id = params.filter_id; - let filter_name = params.filter_name; - let page_cursor = params.page_cursor; - let page_limit = params.page_limit; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/projects", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state/lock", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = filter_id { - local_req_builder = - local_req_builder.query(&[("filter[id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_name { - local_req_builder = - local_req_builder.query(&[("filter[name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -7495,7 +8854,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -7508,7 +8867,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7519,120 +8878,56 @@ impl LLMObservabilityAPI { } } - /// List LLM Observability spans matching the specified filters. - pub async fn list_llm_obs_spans( + /// Restore a dataset to a previous version. The dataset's current version is bumped, and its records are replaced with the records from the specified prior version. + pub async fn restore_llm_obs_dataset_version( &self, - params: ListLLMObsSpansOptionalParams, - ) -> Result> - { - match self.list_llm_obs_spans_with_http_info(params).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRestoreVersionRequest, + ) -> Result<(), datadog::Error> { + match self + .restore_llm_obs_dataset_version_with_http_info(project_id, dataset_id, body) + .await + { + Ok(_) => Ok(()), Err(err) => Err(err), } } - /// List LLM Observability spans matching the specified filters. - pub async fn list_llm_obs_spans_with_http_info( + /// Restore a dataset to a previous version. The dataset's current version is bumped, and its records are replaced with the records from the specified prior version. + pub async fn restore_llm_obs_dataset_version_with_http_info( &self, - params: ListLLMObsSpansOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRestoreVersionRequest, + ) -> Result, datadog::Error> + { let local_configuration = &self.config; - let operation_id = "v2.list_llm_obs_spans"; + let operation_id = "v2.restore_llm_obs_dataset_version"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_llm_obs_spans' is not enabled".to_string(), + msg: "Operation 'v2.restore_llm_obs_dataset_version' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } - // unbox and build optional parameters - let filter_from = params.filter_from; - let filter_to = params.filter_to; - let filter_query = params.filter_query; - let filter_span_id = params.filter_span_id; - let filter_trace_id = params.filter_trace_id; - let filter_span_kind = params.filter_span_kind; - let filter_span_name = params.filter_span_name; - let filter_ml_app = params.filter_ml_app; - let page_limit = params.page_limit; - let page_cursor = params.page_cursor; - let sort = params.sort; - let include_attachments = params.include_attachments; - let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/spans/events", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/restore", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = filter_from { - local_req_builder = - local_req_builder.query(&[("filter[from]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_to { - local_req_builder = - local_req_builder.query(&[("filter[to]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_query { - local_req_builder = - local_req_builder.query(&[("filter[query]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_span_id { - local_req_builder = - local_req_builder.query(&[("filter[span_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_trace_id { - local_req_builder = - local_req_builder.query(&[("filter[trace_id]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_span_kind { - local_req_builder = - local_req_builder.query(&[("filter[span_kind]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_span_name { - local_req_builder = - local_req_builder.query(&[("filter[span_name]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = filter_ml_app { - local_req_builder = - local_req_builder.query(&[("filter[ml_app]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_limit { - local_req_builder = - local_req_builder.query(&[("page[limit]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_cursor { - local_req_builder = - local_req_builder.query(&[("page[cursor]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = sort { - local_req_builder = - local_req_builder.query(&[("sort", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = include_attachments { - local_req_builder = - local_req_builder.query(&[("include_attachments", &local_query_param.to_string())]); - }; + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -7662,6 +8957,52 @@ impl LLMObservabilityAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -7672,20 +9013,13 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7696,17 +9030,20 @@ impl LLMObservabilityAPI { } } - /// Acquire the draft lock on a dataset for the calling user. The lock prevents other users from concurrently editing the dataset draft. - pub async fn lock_llm_obs_dataset_draft_state( + /// Search across LLM Observability experimentation entities — projects, datasets, dataset records, experiments, and experiment runs — using cursor-based pagination. + /// + /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. + /// + /// Returns `200 OK` when all results fit in a single page. Returns `206 Partial Content` with a cursor in `meta.after` when additional pages are available. + pub async fn search_llm_obs_experimentation( &self, - project_id: String, - dataset_id: String, + body: crate::datadogV2::model::LLMObsExperimentationSearchRequest, ) -> Result< - crate::datadogV2::model::LLMObsDatasetDraftStateResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentationSearchResponse, + datadog::Error, > { match self - .lock_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) + .search_llm_obs_experimentation_with_http_info(body) .await { Ok(response_content) => { @@ -7722,22 +9059,25 @@ impl LLMObservabilityAPI { } } - /// Acquire the draft lock on a dataset for the calling user. The lock prevents other users from concurrently editing the dataset draft. - pub async fn lock_llm_obs_dataset_draft_state_with_http_info( + /// Search across LLM Observability experimentation entities — projects, datasets, dataset records, experiments, and experiment runs — using cursor-based pagination. + /// + /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. + /// + /// Returns `200 OK` when all results fit in a single page. Returns `206 Partial Content` with a cursor in `meta.after` when additional pages are available. + pub async fn search_llm_obs_experimentation_with_http_info( &self, - project_id: String, - dataset_id: String, + body: crate::datadogV2::model::LLMObsExperimentationSearchRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.lock_llm_obs_dataset_draft_state"; + let operation_id = "v2.search_llm_obs_experimentation"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.lock_llm_obs_dataset_draft_state' is not enabled".to_string(), + msg: "Operation 'v2.search_llm_obs_experimentation' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -7745,16 +9085,15 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state/lock", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + "{}/api/v2/llm-obs/v1/experimentation/search", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent @@ -7785,6 +9124,52 @@ impl LLMObservabilityAPI { ); }; + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + #[cfg(feature = "zstd")] + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + local_req_builder = local_req_builder.headers(headers); let local_req = local_req_builder.build()?; log::debug!("request content: {:?}", local_req.body()); @@ -7795,7 +9180,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -7808,7 +9193,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7819,37 +9204,41 @@ impl LLMObservabilityAPI { } } - /// Restore a dataset to a previous version. The dataset's current version is bumped, and its records are replaced with the records from the specified prior version. - pub async fn restore_llm_obs_dataset_version( - &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRestoreVersionRequest, - ) -> Result<(), datadog::Error> { - match self - .restore_llm_obs_dataset_version_with_http_info(project_id, dataset_id, body) - .await - { - Ok(_) => Ok(()), + /// Search LLM Observability spans using structured filters in the request body. + pub async fn search_llm_obs_spans( + &self, + body: crate::datadogV2::model::LLMObsSearchSpansRequest, + ) -> Result> + { + match self.search_llm_obs_spans_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Restore a dataset to a previous version. The dataset's current version is bumped, and its records are replaced with the records from the specified prior version. - pub async fn restore_llm_obs_dataset_version_with_http_info( + /// Search LLM Observability spans using structured filters in the request body. + pub async fn search_llm_obs_spans_with_http_info( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRestoreVersionRequest, - ) -> Result, datadog::Error> - { + body: crate::datadogV2::model::LLMObsSearchSpansRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.restore_llm_obs_dataset_version"; + let operation_id = "v2.search_llm_obs_spans"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.restore_llm_obs_dataset_version' is not enabled".to_string(), + msg: "Operation 'v2.search_llm_obs_spans' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -7857,10 +9246,8 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/restore", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + "{}/api/v2/llm-obs/v1/spans/events/search", + local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = local_client.request(reqwest::Method::POST, local_uri_str.as_str()); @@ -7868,7 +9255,7 @@ impl LLMObservabilityAPI { // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -7954,13 +9341,20 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -7971,20 +9365,19 @@ impl LLMObservabilityAPI { } } - /// Search across LLM Observability experimentation entities — projects, datasets, dataset records, experiments, and experiment runs — using cursor-based pagination. + /// Search across LLM Observability experimentation entities using offset-based (page-number) pagination. + /// Use this endpoint when you need total page count or want to navigate to a specific page number. /// /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. - /// - /// Returns `200 OK` when all results fit in a single page. Returns `206 Partial Content` with a cursor in `meta.after` when additional pages are available. - pub async fn search_llm_obs_experimentation( + pub async fn simple_search_llm_obs_experimentation( &self, - body: crate::datadogV2::model::LLMObsExperimentationSearchRequest, + body: crate::datadogV2::model::LLMObsExperimentationSimpleSearchRequest, ) -> Result< - crate::datadogV2::model::LLMObsExperimentationSearchResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, + datadog::Error, > { match self - .search_llm_obs_experimentation_with_http_info(body) + .simple_search_llm_obs_experimentation_with_http_info(body) .await { Ok(response_content) => { @@ -8000,25 +9393,27 @@ impl LLMObservabilityAPI { } } - /// Search across LLM Observability experimentation entities — projects, datasets, dataset records, experiments, and experiment runs — using cursor-based pagination. + /// Search across LLM Observability experimentation entities using offset-based (page-number) pagination. + /// Use this endpoint when you need total page count or want to navigate to a specific page number. /// /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. - /// - /// Returns `200 OK` when all results fit in a single page. Returns `206 Partial Content` with a cursor in `meta.after` when additional pages are available. - pub async fn search_llm_obs_experimentation_with_http_info( + pub async fn simple_search_llm_obs_experimentation_with_http_info( &self, - body: crate::datadogV2::model::LLMObsExperimentationSearchRequest, + body: crate::datadogV2::model::LLMObsExperimentationSimpleSearchRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent< + crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, + >, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.search_llm_obs_experimentation"; + let operation_id = "v2.simple_search_llm_obs_experimentation"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.search_llm_obs_experimentation' is not enabled".to_string(), + msg: "Operation 'v2.simple_search_llm_obs_experimentation' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8026,7 +9421,7 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experimentation/search", + "{}/api/v2/llm-obs/v1/experimentation/simple-search", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -8121,9 +9516,10 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -8134,7 +9530,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8145,13 +9541,15 @@ impl LLMObservabilityAPI { } } - /// Search LLM Observability spans using structured filters in the request body. - pub async fn search_llm_obs_spans( + /// Start a patterns run for a given configuration. The run executes asynchronously. + pub async fn trigger_llm_obs_patterns( &self, - body: crate::datadogV2::model::LLMObsSearchSpansRequest, - ) -> Result> - { - match self.search_llm_obs_spans_with_http_info(body).await { + body: crate::datadogV2::model::LLMObsPatternsTriggerRequest, + ) -> Result< + crate::datadogV2::model::LLMObsPatternsTriggerResponse, + datadog::Error, + > { + match self.trigger_llm_obs_patterns_with_http_info(body).await { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -8165,21 +9563,21 @@ impl LLMObservabilityAPI { } } - /// Search LLM Observability spans using structured filters in the request body. - pub async fn search_llm_obs_spans_with_http_info( + /// Start a patterns run for a given configuration. The run executes asynchronously. + pub async fn trigger_llm_obs_patterns_with_http_info( &self, - body: crate::datadogV2::model::LLMObsSearchSpansRequest, + body: crate::datadogV2::model::LLMObsPatternsTriggerRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.search_llm_obs_spans"; + let operation_id = "v2.trigger_llm_obs_patterns"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.search_llm_obs_spans' is not enabled".to_string(), + msg: "Operation 'v2.trigger_llm_obs_patterns' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8187,7 +9585,7 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/spans/events/search", + "{}/api/v2/llm-obs/v1/topic-discovery-runs", local_configuration.get_operation_host(operation_id) ); let mut local_req_builder = @@ -8282,7 +9680,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -8295,7 +9693,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8306,19 +9704,120 @@ impl LLMObservabilityAPI { } } - /// Search across LLM Observability experimentation entities using offset-based (page-number) pagination. - /// Use this endpoint when you need total page count or want to navigate to a specific page number. - /// - /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. - pub async fn simple_search_llm_obs_experimentation( + /// Release the draft lock on a dataset held by the calling user, allowing other users to edit the dataset draft. + pub async fn unlock_llm_obs_dataset_draft_state( &self, - body: crate::datadogV2::model::LLMObsExperimentationSimpleSearchRequest, + project_id: String, + dataset_id: String, + ) -> Result<(), datadog::Error> { + match self + .unlock_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) + .await + { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Release the draft lock on a dataset held by the calling user, allowing other users to edit the dataset draft. + pub async fn unlock_llm_obs_dataset_draft_state_with_http_info( + &self, + project_id: String, + dataset_id: String, + ) -> Result, datadog::Error> + { + let local_configuration = &self.config; + let operation_id = "v2.unlock_llm_obs_dataset_draft_state"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.unlock_llm_obs_dataset_draft_state' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state/unlock", + local_configuration.get_operation_host(operation_id), + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + + /// Partially update an annotation queue. The `name`, `description`, and `annotation_schema` fields can be updated. + pub async fn update_llm_obs_annotation_queue( + &self, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, ) -> Result< - crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, - datadog::Error, + crate::datadogV2::model::LLMObsAnnotationQueueResponse, + datadog::Error, > { match self - .simple_search_llm_obs_experimentation_with_http_info(body) + .update_llm_obs_annotation_queue_with_http_info(queue_id, body) .await { Ok(response_content) => { @@ -8334,27 +9833,22 @@ impl LLMObservabilityAPI { } } - /// Search across LLM Observability experimentation entities using offset-based (page-number) pagination. - /// Use this endpoint when you need total page count or want to navigate to a specific page number. - /// - /// The `filter.scope` field controls which entity types are returned. At least one valid scope must be provided. - pub async fn simple_search_llm_obs_experimentation_with_http_info( + /// Partially update an annotation queue. The `name`, `description`, and `annotation_schema` fields can be updated. + pub async fn update_llm_obs_annotation_queue_with_http_info( &self, - body: crate::datadogV2::model::LLMObsExperimentationSimpleSearchRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, ) -> Result< - datadog::ResponseContent< - crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, - >, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.simple_search_llm_obs_experimentation"; + let operation_id = "v2.update_llm_obs_annotation_queue"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.simple_search_llm_obs_experimentation' is not enabled" - .to_string(), + msg: "Operation 'v2.update_llm_obs_annotation_queue' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8362,11 +9856,12 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experimentation/simple-search", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -8457,10 +9952,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsExperimentationSimpleSearchResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -8471,7 +9965,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8482,15 +9976,22 @@ impl LLMObservabilityAPI { } } - /// Start a patterns run for a given configuration. The run executes asynchronously. - pub async fn trigger_llm_obs_patterns( + /// Create or replace the label schema for a given annotation queue. + /// The label schema defines the labels annotators can apply to interactions in the queue. + /// Label names must be unique within the queue and match the pattern `^[a-zA-Z0-9_-]+$`. + /// Each label must have a valid type: score, categorical, boolean, or text. + pub async fn update_llm_obs_annotation_queue_label_schema( &self, - body: crate::datadogV2::model::LLMObsPatternsTriggerRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaUpdateRequest, ) -> Result< - crate::datadogV2::model::LLMObsPatternsTriggerResponse, - datadog::Error, + crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, + datadog::Error, > { - match self.trigger_llm_obs_patterns_with_http_info(body).await { + match self + .update_llm_obs_annotation_queue_label_schema_with_http_info(queue_id, body) + .await + { Ok(response_content) => { if let Some(e) = response_content.entity { Ok(e) @@ -8504,21 +10005,26 @@ impl LLMObservabilityAPI { } } - /// Start a patterns run for a given configuration. The run executes asynchronously. - pub async fn trigger_llm_obs_patterns_with_http_info( + /// Create or replace the label schema for a given annotation queue. + /// The label schema defines the labels annotators can apply to interactions in the queue. + /// Label names must be unique within the queue and match the pattern `^[a-zA-Z0-9_-]+$`. + /// Each label must have a valid type: score, categorical, boolean, or text. + pub async fn update_llm_obs_annotation_queue_label_schema_with_http_info( &self, - body: crate::datadogV2::model::LLMObsPatternsTriggerRequest, + queue_id: String, + body: crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.trigger_llm_obs_patterns"; + let operation_id = "v2.update_llm_obs_annotation_queue_label_schema"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.trigger_llm_obs_patterns' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_annotation_queue_label_schema' is not enabled" + .to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8526,11 +10032,12 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/topic-discovery-runs", - local_configuration.get_operation_host(operation_id) + "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/label-schema", + local_configuration.get_operation_host(operation_id), + queue_id = datadog::urlencode(queue_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -8621,9 +10128,10 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { + match serde_json::from_str::< + crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, + >(&local_content) + { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -8634,7 +10142,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8645,14 +10153,14 @@ impl LLMObservabilityAPI { } } - /// Release the draft lock on a dataset held by the calling user, allowing other users to edit the dataset draft. - pub async fn unlock_llm_obs_dataset_draft_state( + /// Create or update a custom LLM Observability evaluator configuration by its name. + pub async fn update_llm_obs_custom_eval_config( &self, - project_id: String, - dataset_id: String, - ) -> Result<(), datadog::Error> { + eval_name: String, + body: crate::datadogV2::model::LLMObsCustomEvalConfigUpdateRequest, + ) -> Result<(), datadog::Error> { match self - .unlock_llm_obs_dataset_draft_state_with_http_info(project_id, dataset_id) + .update_llm_obs_custom_eval_config_with_http_info(eval_name, body) .await { Ok(_) => Ok(()), @@ -8660,136 +10168,20 @@ impl LLMObservabilityAPI { } } - /// Release the draft lock on a dataset held by the calling user, allowing other users to edit the dataset draft. - pub async fn unlock_llm_obs_dataset_draft_state_with_http_info( + /// Create or update a custom LLM Observability evaluator configuration by its name. + pub async fn update_llm_obs_custom_eval_config_with_http_info( &self, - project_id: String, - dataset_id: String, - ) -> Result, datadog::Error> + eval_name: String, + body: crate::datadogV2::model::LLMObsCustomEvalConfigUpdateRequest, + ) -> Result, datadog::Error> { let local_configuration = &self.config; - let operation_id = "v2.unlock_llm_obs_dataset_draft_state"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.unlock_llm_obs_dataset_draft_state' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/draft_state/unlock", - local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("*/*")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Partially update an annotation queue. The `name`, `description`, and `annotation_schema` fields can be updated. - pub async fn update_llm_obs_annotation_queue( - &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, - ) -> Result< - crate::datadogV2::model::LLMObsAnnotationQueueResponse, - datadog::Error, - > { - match self - .update_llm_obs_annotation_queue_with_http_info(queue_id, body) - .await - { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Partially update an annotation queue. The `name`, `description`, and `annotation_schema` fields can be updated. - pub async fn update_llm_obs_annotation_queue_with_http_info( - &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsAnnotationQueueUpdateRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_annotation_queue"; + let operation_id = "v2.update_llm_obs_custom_eval_config"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_annotation_queue' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_custom_eval_config' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8797,17 +10189,17 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}", + "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + eval_name = datadog::urlencode(eval_name) ); let mut local_req_builder = - local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); + local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -8893,20 +10285,13 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -8917,20 +10302,18 @@ impl LLMObservabilityAPI { } } - /// Create or replace the label schema for a given annotation queue. - /// The label schema defines the labels annotators can apply to interactions in the queue. - /// Label names must be unique within the queue and match the pattern `^[a-zA-Z0-9_-]+$`. - /// Each label must have a valid type: score, categorical, boolean, or text. - pub async fn update_llm_obs_annotation_queue_label_schema( + /// Partially update an existing LLM Observability dataset within the specified project. + pub async fn update_llm_obs_dataset( &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaUpdateRequest, + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetUpdateRequest, ) -> Result< - crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, - datadog::Error, + crate::datadogV2::model::LLMObsDatasetResponse, + datadog::Error, > { match self - .update_llm_obs_annotation_queue_label_schema_with_http_info(queue_id, body) + .update_llm_obs_dataset_with_http_info(project_id, dataset_id, body) .await { Ok(response_content) => { @@ -8946,26 +10329,23 @@ impl LLMObservabilityAPI { } } - /// Create or replace the label schema for a given annotation queue. - /// The label schema defines the labels annotators can apply to interactions in the queue. - /// Label names must be unique within the queue and match the pattern `^[a-zA-Z0-9_-]+$`. - /// Each label must have a valid type: score, categorical, boolean, or text. - pub async fn update_llm_obs_annotation_queue_label_schema_with_http_info( + /// Partially update an existing LLM Observability dataset within the specified project. + pub async fn update_llm_obs_dataset_with_http_info( &self, - queue_id: String, - body: crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaUpdateRequest, + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_annotation_queue_label_schema"; + let operation_id = "v2.update_llm_obs_dataset"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_annotation_queue_label_schema' is not enabled" - .to_string(), + msg: "Operation 'v2.update_llm_obs_dataset' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -8973,12 +10353,13 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/annotation-queues/{queue_id}/label-schema", + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}", local_configuration.get_operation_host(operation_id), - queue_id = datadog::urlencode(queue_id) + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); @@ -9069,10 +10450,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsAnnotationQueueLabelSchemaResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -9083,7 +10463,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9094,35 +10474,50 @@ impl LLMObservabilityAPI { } } - /// Create or update a custom LLM Observability evaluator configuration by its name. - pub async fn update_llm_obs_custom_eval_config( + /// Update one or more existing records in an LLM Observability dataset. + pub async fn update_llm_obs_dataset_records( &self, - eval_name: String, - body: crate::datadogV2::model::LLMObsCustomEvalConfigUpdateRequest, - ) -> Result<(), datadog::Error> { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRecordsUpdateRequest, + ) -> Result< + crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, + datadog::Error, + > { match self - .update_llm_obs_custom_eval_config_with_http_info(eval_name, body) + .update_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) .await { - Ok(_) => Ok(()), + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } Err(err) => Err(err), } } - /// Create or update a custom LLM Observability evaluator configuration by its name. - pub async fn update_llm_obs_custom_eval_config_with_http_info( + /// Update one or more existing records in an LLM Observability dataset. + pub async fn update_llm_obs_dataset_records_with_http_info( &self, - eval_name: String, - body: crate::datadogV2::model::LLMObsCustomEvalConfigUpdateRequest, - ) -> Result, datadog::Error> - { + project_id: String, + dataset_id: String, + body: crate::datadogV2::model::LLMObsDatasetRecordsUpdateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_custom_eval_config"; + let operation_id = "v2.update_llm_obs_dataset_records"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_custom_eval_config' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_dataset_records' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -9130,17 +10525,18 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/unstable/llm-obs/config/evaluators/custom/{eval_name}", + "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", local_configuration.get_operation_host(operation_id), - eval_name = datadog::urlencode(eval_name) + project_id = datadog::urlencode(project_id), + dataset_id = datadog::urlencode(dataset_id) ); let mut local_req_builder = - local_client.request(reqwest::Method::PUT, local_uri_str.as_str()); + local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); // build headers let mut headers = HeaderMap::new(); headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); + headers.insert("Accept", HeaderValue::from_static("application/json")); // build user agent match HeaderValue::from_str(local_configuration.user_agent.as_str()) { @@ -9226,13 +10622,21 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) + match serde_json::from_str::< + crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, + >(&local_content) + { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9243,18 +10647,17 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability dataset within the specified project. - pub async fn update_llm_obs_dataset( + /// Partially update an existing LLM Observability experiment. + pub async fn update_llm_obs_experiment( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetUpdateRequest, + experiment_id: String, + body: crate::datadogV2::model::LLMObsExperimentUpdateRequest, ) -> Result< - crate::datadogV2::model::LLMObsDatasetResponse, - datadog::Error, + crate::datadogV2::model::LLMObsExperimentResponse, + datadog::Error, > { match self - .update_llm_obs_dataset_with_http_info(project_id, dataset_id, body) + .update_llm_obs_experiment_with_http_info(experiment_id, body) .await { Ok(response_content) => { @@ -9270,23 +10673,22 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability dataset within the specified project. - pub async fn update_llm_obs_dataset_with_http_info( + /// Partially update an existing LLM Observability experiment. + pub async fn update_llm_obs_experiment_with_http_info( &self, - project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetUpdateRequest, + experiment_id: String, + body: crate::datadogV2::model::LLMObsExperimentUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_dataset"; + let operation_id = "v2.update_llm_obs_experiment"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_dataset' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_experiment' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -9294,10 +10696,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}", + "{}/api/v2/llm-obs/v1/experiments/{experiment_id}", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + experiment_id = datadog::urlencode(experiment_id) ); let mut local_req_builder = local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); @@ -9391,7 +10792,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -9404,7 +10805,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9415,18 +10816,17 @@ impl LLMObservabilityAPI { } } - /// Update one or more existing records in an LLM Observability dataset. - pub async fn update_llm_obs_dataset_records( + /// Partially update an existing LLM Observability project. + pub async fn update_llm_obs_project( &self, project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRecordsUpdateRequest, + body: crate::datadogV2::model::LLMObsProjectUpdateRequest, ) -> Result< - crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, - datadog::Error, + crate::datadogV2::model::LLMObsProjectResponse, + datadog::Error, > { match self - .update_llm_obs_dataset_records_with_http_info(project_id, dataset_id, body) + .update_llm_obs_project_with_http_info(project_id, body) .await { Ok(response_content) => { @@ -9442,23 +10842,22 @@ impl LLMObservabilityAPI { } } - /// Update one or more existing records in an LLM Observability dataset. - pub async fn update_llm_obs_dataset_records_with_http_info( + /// Partially update an existing LLM Observability project. + pub async fn update_llm_obs_project_with_http_info( &self, project_id: String, - dataset_id: String, - body: crate::datadogV2::model::LLMObsDatasetRecordsUpdateRequest, + body: crate::datadogV2::model::LLMObsProjectUpdateRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_dataset_records"; + let operation_id = "v2.update_llm_obs_project"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_dataset_records' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_project' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -9466,10 +10865,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/{project_id}/datasets/{dataset_id}/records", + "{}/api/v2/llm-obs/v1/projects/{project_id}", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id), - dataset_id = datadog::urlencode(dataset_id) + project_id = datadog::urlencode(project_id) ); let mut local_req_builder = local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); @@ -9563,10 +10961,9 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::< - crate::datadogV2::model::LLMObsDatasetRecordsMutationResponse, - >(&local_content) - { + match serde_json::from_str::( + &local_content, + ) { Ok(e) => { return Ok(datadog::ResponseContent { status: local_status, @@ -9577,7 +10974,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9588,17 +10985,17 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability experiment. - pub async fn update_llm_obs_experiment( + /// Update the title, the description, or both, for an LLM Observability prompt. + pub async fn update_llm_obs_prompt( &self, - experiment_id: String, - body: crate::datadogV2::model::LLMObsExperimentUpdateRequest, + prompt_id: String, + body: crate::datadogV2::model::LLMObsUpdatePromptRequest, ) -> Result< - crate::datadogV2::model::LLMObsExperimentResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptResponse, + datadog::Error, > { match self - .update_llm_obs_experiment_with_http_info(experiment_id, body) + .update_llm_obs_prompt_with_http_info(prompt_id, body) .await { Ok(response_content) => { @@ -9614,22 +11011,22 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability experiment. - pub async fn update_llm_obs_experiment_with_http_info( + /// Update the title, the description, or both, for an LLM Observability prompt. + pub async fn update_llm_obs_prompt_with_http_info( &self, - experiment_id: String, - body: crate::datadogV2::model::LLMObsExperimentUpdateRequest, + prompt_id: String, + body: crate::datadogV2::model::LLMObsUpdatePromptRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_experiment"; + let operation_id = "v2.update_llm_obs_prompt"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_experiment' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_prompt' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -9637,9 +11034,9 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/experiments/{experiment_id}", + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}", local_configuration.get_operation_host(operation_id), - experiment_id = datadog::urlencode(experiment_id) + prompt_id = datadog::urlencode(prompt_id) ); let mut local_req_builder = local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); @@ -9733,7 +11130,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -9746,7 +11143,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, @@ -9757,17 +11154,18 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability project. - pub async fn update_llm_obs_project( + /// Update the description, the feature-flag environments, or both, for a specific version of an LLM Observability prompt. + pub async fn update_llm_obs_prompt_version( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsProjectUpdateRequest, + prompt_id: String, + version: i64, + body: crate::datadogV2::model::LLMObsUpdatePromptVersionRequest, ) -> Result< - crate::datadogV2::model::LLMObsProjectResponse, - datadog::Error, + crate::datadogV2::model::LLMObsPromptVersionResponse, + datadog::Error, > { match self - .update_llm_obs_project_with_http_info(project_id, body) + .update_llm_obs_prompt_version_with_http_info(prompt_id, version, body) .await { Ok(response_content) => { @@ -9783,22 +11181,23 @@ impl LLMObservabilityAPI { } } - /// Partially update an existing LLM Observability project. - pub async fn update_llm_obs_project_with_http_info( + /// Update the description, the feature-flag environments, or both, for a specific version of an LLM Observability prompt. + pub async fn update_llm_obs_prompt_version_with_http_info( &self, - project_id: String, - body: crate::datadogV2::model::LLMObsProjectUpdateRequest, + prompt_id: String, + version: i64, + body: crate::datadogV2::model::LLMObsUpdatePromptVersionRequest, ) -> Result< - datadog::ResponseContent, - datadog::Error, + datadog::ResponseContent, + datadog::Error, > { let local_configuration = &self.config; - let operation_id = "v2.update_llm_obs_project"; + let operation_id = "v2.update_llm_obs_prompt_version"; if local_configuration.is_unstable_operation_enabled(operation_id) { warn!("Using unstable operation {operation_id}"); } else { let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.update_llm_obs_project' is not enabled".to_string(), + msg: "Operation 'v2.update_llm_obs_prompt_version' is not enabled".to_string(), }; return Err(datadog::Error::UnstableOperationDisabledError(local_error)); } @@ -9806,9 +11205,10 @@ impl LLMObservabilityAPI { let local_client = &self.client; let local_uri_str = format!( - "{}/api/v2/llm-obs/v1/projects/{project_id}", + "{}/api/v2/llm-obs/v1/prompts/{prompt_id}/versions/{version}", local_configuration.get_operation_host(operation_id), - project_id = datadog::urlencode(project_id) + prompt_id = datadog::urlencode(prompt_id), + version = version ); let mut local_req_builder = local_client.request(reqwest::Method::PATCH, local_uri_str.as_str()); @@ -9902,7 +11302,7 @@ impl LLMObservabilityAPI { log::debug!("response content: {}", local_content); if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( + match serde_json::from_str::( &local_content, ) { Ok(e) => { @@ -9915,7 +11315,7 @@ impl LLMObservabilityAPI { Err(e) => return Err(datadog::Error::Serde(e)), }; } else { - let local_entity: Option = + let local_entity: Option = serde_json::from_str(&local_content).ok(); let local_error = datadog::ResponseContent { status: local_status, diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs index 23e11356f..afd71a72d 100644 --- a/src/datadogV2/model/mod.rs +++ b/src/datadogV2/model/mod.rs @@ -6122,6 +6122,76 @@ pub mod model_llm_obs_project_update_data_request; pub use self::model_llm_obs_project_update_data_request::LLMObsProjectUpdateDataRequest; pub mod model_llm_obs_project_update_data_attributes_request; pub use self::model_llm_obs_project_update_data_attributes_request::LLMObsProjectUpdateDataAttributesRequest; +pub mod model_llm_obs_prompts_response; +pub use self::model_llm_obs_prompts_response::LLMObsPromptsResponse; +pub mod model_llm_obs_prompt_data; +pub use self::model_llm_obs_prompt_data::LLMObsPromptData; +pub mod model_llm_obs_prompt_data_attributes; +pub use self::model_llm_obs_prompt_data_attributes::LLMObsPromptDataAttributes; +pub mod model_llm_obs_prompt_dataset; +pub use self::model_llm_obs_prompt_dataset::LLMObsPromptDataset; +pub mod model_llm_obs_prompt_response_source; +pub use self::model_llm_obs_prompt_response_source::LLMObsPromptResponseSource; +pub mod model_llm_obs_prompt_type; +pub use self::model_llm_obs_prompt_type::LLMObsPromptType; +pub mod model_llm_obs_create_prompt_request; +pub use self::model_llm_obs_create_prompt_request::LLMObsCreatePromptRequest; +pub mod model_llm_obs_create_prompt_data; +pub use self::model_llm_obs_create_prompt_data::LLMObsCreatePromptData; +pub mod model_llm_obs_create_prompt_data_attributes; +pub use self::model_llm_obs_create_prompt_data_attributes::LLMObsCreatePromptDataAttributes; +pub mod model_llm_obs_prompt_version_label; +pub use self::model_llm_obs_prompt_version_label::LLMObsPromptVersionLabel; +pub mod model_llm_obs_prompt_chat_message; +pub use self::model_llm_obs_prompt_chat_message::LLMObsPromptChatMessage; +pub mod model_llm_obs_prompt_template; +pub use self::model_llm_obs_prompt_template::LLMObsPromptTemplate; +pub mod model_llm_obs_prompt_response; +pub use self::model_llm_obs_prompt_response::LLMObsPromptResponse; +pub mod model_llm_obs_deleted_prompt_response; +pub use self::model_llm_obs_deleted_prompt_response::LLMObsDeletedPromptResponse; +pub mod model_llm_obs_deleted_prompt_data; +pub use self::model_llm_obs_deleted_prompt_data::LLMObsDeletedPromptData; +pub mod model_llm_obs_deleted_prompt_data_attributes; +pub use self::model_llm_obs_deleted_prompt_data_attributes::LLMObsDeletedPromptDataAttributes; +pub mod model_llm_obs_prompt_sdk_response; +pub use self::model_llm_obs_prompt_sdk_response::LLMObsPromptSDKResponse; +pub mod model_llm_obs_prompt_sdk_data; +pub use self::model_llm_obs_prompt_sdk_data::LLMObsPromptSDKData; +pub mod model_llm_obs_prompt_sdk_data_attributes; +pub use self::model_llm_obs_prompt_sdk_data_attributes::LLMObsPromptSDKDataAttributes; +pub mod model_llm_obs_update_prompt_request; +pub use self::model_llm_obs_update_prompt_request::LLMObsUpdatePromptRequest; +pub mod model_llm_obs_update_prompt_data; +pub use self::model_llm_obs_update_prompt_data::LLMObsUpdatePromptData; +pub mod model_llm_obs_update_prompt_data_attributes; +pub use self::model_llm_obs_update_prompt_data_attributes::LLMObsUpdatePromptDataAttributes; +pub mod model_llm_obs_prompt_versions_response; +pub use self::model_llm_obs_prompt_versions_response::LLMObsPromptVersionsResponse; +pub mod model_llm_obs_prompt_version_list_data; +pub use self::model_llm_obs_prompt_version_list_data::LLMObsPromptVersionListData; +pub mod model_llm_obs_prompt_version_list_data_attributes; +pub use self::model_llm_obs_prompt_version_list_data_attributes::LLMObsPromptVersionListDataAttributes; +pub mod model_llm_obs_prompt_version_type; +pub use self::model_llm_obs_prompt_version_type::LLMObsPromptVersionType; +pub mod model_llm_obs_create_prompt_version_request; +pub use self::model_llm_obs_create_prompt_version_request::LLMObsCreatePromptVersionRequest; +pub mod model_llm_obs_create_prompt_version_data; +pub use self::model_llm_obs_create_prompt_version_data::LLMObsCreatePromptVersionData; +pub mod model_llm_obs_create_prompt_version_data_attributes; +pub use self::model_llm_obs_create_prompt_version_data_attributes::LLMObsCreatePromptVersionDataAttributes; +pub mod model_llm_obs_prompt_version_response; +pub use self::model_llm_obs_prompt_version_response::LLMObsPromptVersionResponse; +pub mod model_llm_obs_prompt_version_data; +pub use self::model_llm_obs_prompt_version_data::LLMObsPromptVersionData; +pub mod model_llm_obs_prompt_version_data_attributes; +pub use self::model_llm_obs_prompt_version_data_attributes::LLMObsPromptVersionDataAttributes; +pub mod model_llm_obs_update_prompt_version_request; +pub use self::model_llm_obs_update_prompt_version_request::LLMObsUpdatePromptVersionRequest; +pub mod model_llm_obs_update_prompt_version_data; +pub use self::model_llm_obs_update_prompt_version_data::LLMObsUpdatePromptVersionData; +pub mod model_llm_obs_update_prompt_version_data_attributes; +pub use self::model_llm_obs_update_prompt_version_data_attributes::LLMObsUpdatePromptVersionDataAttributes; pub mod model_llm_obs_spans_response; pub use self::model_llm_obs_spans_response::LLMObsSpansResponse; pub mod model_llm_obs_span_data; diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_data.rs b/src/datadogV2/model/model_llm_obs_create_prompt_data.rs new file mode 100644 index 000000000..7631e5986 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_data.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for creating an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptData { + /// Attributes for creating an LLM Observability prompt and its first version. `prompt_id` and `template` are required; all other attributes are optional. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsCreatePromptDataAttributes, + /// Resource type of an LLM Observability prompt. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsCreatePromptDataAttributes, + type_: crate::datadogV2::model::LLMObsPromptType, + ) -> LLMObsCreatePromptData { + LLMObsCreatePromptData { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptDataVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptDataVisitor { + type Value = LLMObsCreatePromptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsCreatePromptDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsCreatePromptData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_data_attributes.rs b/src/datadogV2/model/model_llm_obs_create_prompt_data_attributes.rs new file mode 100644 index 000000000..6287cd992 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_data_attributes.rs @@ -0,0 +1,209 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating an LLM Observability prompt and its first version. `prompt_id` and `template` are required; all other attributes are optional. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptDataAttributes { + /// Optional description of the prompt. + #[serde(rename = "description")] + pub description: Option, + /// Optional feature-flag environment UUIDs the service attempts to enable and configure to use the first version as their default after creation. + #[serde(rename = "env_ids")] + pub env_ids: Option>, + /// Optional labels to attach to the first version. Do not use this attribute for new integrations. + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + /// Customer-provided identifier for the new prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: String, + /// A text template or a list of chat messages. + #[serde(rename = "template")] + pub template: crate::datadogV2::model::LLMObsPromptTemplate, + /// Optional title of the prompt. + #[serde(rename = "title")] + pub title: Option, + /// Optional user-supplied version identifier for the first version. + #[serde(rename = "user_version")] + pub user_version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptDataAttributes { + pub fn new( + prompt_id: String, + template: crate::datadogV2::model::LLMObsPromptTemplate, + ) -> LLMObsCreatePromptDataAttributes { + #[allow(deprecated)] + LLMObsCreatePromptDataAttributes { + description: None, + env_ids: None, + labels: None, + prompt_id, + template, + title: None, + user_version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + #[allow(deprecated)] + pub fn env_ids(mut self, value: Vec) -> Self { + self.env_ids = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } + + #[allow(deprecated)] + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + #[allow(deprecated)] + pub fn user_version(mut self, value: String) -> Self { + self.user_version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptDataAttributesVisitor { + type Value = LLMObsCreatePromptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut env_ids: Option> = None; + let mut labels: Option> = + None; + let mut prompt_id: Option = None; + let mut template: Option = None; + let mut title: Option = None; + let mut user_version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "env_ids" => { + if v.is_null() { + continue; + } + env_ids = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "template" => { + template = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _template) = template { + match _template { + crate::datadogV2::model::LLMObsPromptTemplate::UnparsedObject(_template) => { + _unparsed = true; + }, + _ => {} + } + } + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_version" => { + if v.is_null() { + continue; + } + user_version = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let prompt_id = prompt_id.ok_or_else(|| M::Error::missing_field("prompt_id"))?; + let template = template.ok_or_else(|| M::Error::missing_field("template"))?; + + #[allow(deprecated)] + let content = LLMObsCreatePromptDataAttributes { + description, + env_ids, + labels, + prompt_id, + template, + title, + user_version, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_request.rs b/src/datadogV2/model/model_llm_obs_create_prompt_request.rs new file mode 100644 index 000000000..f610f7320 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_request.rs @@ -0,0 +1,92 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to create an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptRequest { + /// Data object for creating an LLM Observability prompt. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsCreatePromptData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptRequest { + pub fn new(data: crate::datadogV2::model::LLMObsCreatePromptData) -> LLMObsCreatePromptRequest { + LLMObsCreatePromptRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptRequestVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptRequestVisitor { + type Value = LLMObsCreatePromptRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsCreatePromptRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_version_data.rs b/src/datadogV2/model/model_llm_obs_create_prompt_version_data.rs new file mode 100644 index 000000000..33c0aefe4 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_version_data.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for creating an LLM Observability prompt version. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptVersionData { + /// Attributes for creating a new version of an LLM Observability prompt. `template` is required; all other attributes are optional. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsCreatePromptVersionDataAttributes, + /// Resource type of an LLM Observability prompt version. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptVersionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptVersionData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsCreatePromptVersionDataAttributes, + type_: crate::datadogV2::model::LLMObsPromptVersionType, + ) -> LLMObsCreatePromptVersionData { + LLMObsCreatePromptVersionData { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptVersionData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptVersionDataVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptVersionDataVisitor { + type Value = LLMObsCreatePromptVersionData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsCreatePromptVersionDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptVersionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsCreatePromptVersionData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptVersionDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_version_data_attributes.rs b/src/datadogV2/model/model_llm_obs_create_prompt_version_data_attributes.rs new file mode 100644 index 000000000..0d7d497fd --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_version_data_attributes.rs @@ -0,0 +1,180 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for creating a new version of an LLM Observability prompt. `template` is required; all other attributes are optional. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptVersionDataAttributes { + /// Optional description of this version. + #[serde(rename = "description")] + pub description: Option, + /// Optional feature-flag environment UUIDs the service attempts to enable and configure to use this version as their default after creation. + #[serde(rename = "env_ids")] + pub env_ids: Option>, + /// Optional labels to attach to this version. Do not use this attribute for new integrations. + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + /// A text template or a list of chat messages. + #[serde(rename = "template")] + pub template: crate::datadogV2::model::LLMObsPromptTemplate, + /// Optional user-supplied version identifier for this version. + #[serde(rename = "user_version")] + pub user_version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptVersionDataAttributes { + pub fn new( + template: crate::datadogV2::model::LLMObsPromptTemplate, + ) -> LLMObsCreatePromptVersionDataAttributes { + #[allow(deprecated)] + LLMObsCreatePromptVersionDataAttributes { + description: None, + env_ids: None, + labels: None, + template, + user_version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + #[allow(deprecated)] + pub fn env_ids(mut self, value: Vec) -> Self { + self.env_ids = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } + + #[allow(deprecated)] + pub fn user_version(mut self, value: String) -> Self { + self.user_version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptVersionDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptVersionDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptVersionDataAttributesVisitor { + type Value = LLMObsCreatePromptVersionDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut env_ids: Option> = None; + let mut labels: Option> = + None; + let mut template: Option = None; + let mut user_version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "env_ids" => { + if v.is_null() { + continue; + } + env_ids = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "template" => { + template = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _template) = template { + match _template { + crate::datadogV2::model::LLMObsPromptTemplate::UnparsedObject(_template) => { + _unparsed = true; + }, + _ => {} + } + } + } + "user_version" => { + if v.is_null() { + continue; + } + user_version = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let template = template.ok_or_else(|| M::Error::missing_field("template"))?; + + #[allow(deprecated)] + let content = LLMObsCreatePromptVersionDataAttributes { + description, + env_ids, + labels, + template, + user_version, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptVersionDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_create_prompt_version_request.rs b/src/datadogV2/model/model_llm_obs_create_prompt_version_request.rs new file mode 100644 index 000000000..ed8fae85d --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_create_prompt_version_request.rs @@ -0,0 +1,94 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to create a new version of an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsCreatePromptVersionRequest { + /// Data object for creating an LLM Observability prompt version. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsCreatePromptVersionData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsCreatePromptVersionRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsCreatePromptVersionData, + ) -> LLMObsCreatePromptVersionRequest { + LLMObsCreatePromptVersionRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsCreatePromptVersionRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsCreatePromptVersionRequestVisitor; + impl<'a> Visitor<'a> for LLMObsCreatePromptVersionRequestVisitor { + type Value = LLMObsCreatePromptVersionRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsCreatePromptVersionRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsCreatePromptVersionRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_deleted_prompt_data.rs b/src/datadogV2/model/model_llm_obs_deleted_prompt_data.rs new file mode 100644 index 000000000..6ab260b15 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_deleted_prompt_data.rs @@ -0,0 +1,128 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object confirming that an LLM Observability prompt was deleted. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeletedPromptData { + /// Attributes confirming that an LLM Observability prompt was deleted. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsDeletedPromptDataAttributes, + /// Unique identifier of the deleted prompt. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability prompt. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeletedPromptData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsDeletedPromptDataAttributes, + id: String, + type_: crate::datadogV2::model::LLMObsPromptType, + ) -> LLMObsDeletedPromptData { + LLMObsDeletedPromptData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeletedPromptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeletedPromptDataVisitor; + impl<'a> Visitor<'a> for LLMObsDeletedPromptDataVisitor { + type Value = LLMObsDeletedPromptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsDeletedPromptDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsDeletedPromptData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsDeletedPromptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_deleted_prompt_data_attributes.rs b/src/datadogV2/model/model_llm_obs_deleted_prompt_data_attributes.rs new file mode 100644 index 000000000..82ebf8a01 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_deleted_prompt_data_attributes.rs @@ -0,0 +1,105 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes confirming that an LLM Observability prompt was deleted. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeletedPromptDataAttributes { + /// Timestamp when the prompt was deleted. + #[serde(rename = "deleted_at")] + pub deleted_at: chrono::DateTime, + /// Customer-provided identifier of the deleted prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeletedPromptDataAttributes { + pub fn new( + deleted_at: chrono::DateTime, + prompt_id: String, + ) -> LLMObsDeletedPromptDataAttributes { + LLMObsDeletedPromptDataAttributes { + deleted_at, + prompt_id, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeletedPromptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeletedPromptDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsDeletedPromptDataAttributesVisitor { + type Value = LLMObsDeletedPromptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut deleted_at: Option> = None; + let mut prompt_id: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "deleted_at" => { + deleted_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let deleted_at = deleted_at.ok_or_else(|| M::Error::missing_field("deleted_at"))?; + let prompt_id = prompt_id.ok_or_else(|| M::Error::missing_field("prompt_id"))?; + + let content = LLMObsDeletedPromptDataAttributes { + deleted_at, + prompt_id, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsDeletedPromptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_deleted_prompt_response.rs b/src/datadogV2/model/model_llm_obs_deleted_prompt_response.rs new file mode 100644 index 000000000..f5ea48636 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_deleted_prompt_response.rs @@ -0,0 +1,94 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response confirming that an LLM Observability prompt was deleted. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsDeletedPromptResponse { + /// Data object confirming that an LLM Observability prompt was deleted. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsDeletedPromptData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsDeletedPromptResponse { + pub fn new( + data: crate::datadogV2::model::LLMObsDeletedPromptData, + ) -> LLMObsDeletedPromptResponse { + LLMObsDeletedPromptResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsDeletedPromptResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsDeletedPromptResponseVisitor; + impl<'a> Visitor<'a> for LLMObsDeletedPromptResponseVisitor { + type Value = LLMObsDeletedPromptResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsDeletedPromptResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsDeletedPromptResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_chat_message.rs b/src/datadogV2/model/model_llm_obs_prompt_chat_message.rs new file mode 100644 index 000000000..aabec678e --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_chat_message.rs @@ -0,0 +1,102 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A single chat message in a prompt template. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptChatMessage { + /// Content of the message. + #[serde(rename = "content")] + pub content: String, + /// Role of the message (for example `system`, `user`, or `assistant`). + #[serde(rename = "role")] + pub role: String, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptChatMessage { + pub fn new(content: String, role: String) -> LLMObsPromptChatMessage { + LLMObsPromptChatMessage { + content, + role, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptChatMessage { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptChatMessageVisitor; + impl<'a> Visitor<'a> for LLMObsPromptChatMessageVisitor { + type Value = LLMObsPromptChatMessage; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut content: Option = None; + let mut role: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "content" => { + content = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "role" => { + role = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let content = content.ok_or_else(|| M::Error::missing_field("content"))?; + let role = role.ok_or_else(|| M::Error::missing_field("role"))?; + + let content = LLMObsPromptChatMessage { + content, + role, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptChatMessageVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_data.rs b/src/datadogV2/model/model_llm_obs_prompt_data.rs new file mode 100644 index 000000000..4077551c7 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_data.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptData { + /// Attributes of an LLM Observability prompt registry entry. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsPromptDataAttributes, + /// Unique identifier of the prompt. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability prompt. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsPromptDataAttributes, + id: String, + type_: crate::datadogV2::model::LLMObsPromptType, + ) -> LLMObsPromptData { + LLMObsPromptData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptDataVisitor; + impl<'a> Visitor<'a> for LLMObsPromptDataVisitor { + type Value = LLMObsPromptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsPromptData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_data_attributes.rs b/src/datadogV2/model/model_llm_obs_prompt_data_attributes.rs new file mode 100644 index 000000000..63dba9ace --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_data_attributes.rs @@ -0,0 +1,343 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of an LLM Observability prompt registry entry. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptDataAttributes { + /// UUID of the user who authored the prompt. + #[serde(rename = "author")] + pub author: Option, + /// Timestamp when the prompt was created. + #[serde(rename = "created_at")] + pub created_at: Option>, + /// Source that created the prompt, such as `ui-registry`, `sdk-registry`, or `sdk-instrumentation`. + #[serde(rename = "created_from")] + pub created_from: String, + /// Datasets observed in runs associated with this prompt. + #[serde(rename = "datasets")] + pub datasets: Option>, + /// Description of the prompt. + #[serde(rename = "description")] + pub description: Option, + /// Source prompt from which this prompt was extracted, when applicable. + #[serde(rename = "extracted_from")] + pub extracted_from: Option, + /// Whether the prompt is a registry entry (as opposed to a code-discovered prompt). + #[serde(rename = "in_registry")] + pub in_registry: bool, + /// Timestamp of the most recent observed run of this prompt. + #[serde(rename = "last_seen_at")] + pub last_seen_at: Option>, + /// Timestamp when the most recent version of the prompt was created. + #[serde(rename = "last_version_created_at")] + pub last_version_created_at: Option>, + /// The ML application this prompt is associated with. + #[serde(rename = "ml_app")] + pub ml_app: Option, + /// ML applications observed running this prompt. + #[serde(rename = "ml_apps")] + pub ml_apps: Option>, + /// Number of versions of the prompt. + #[serde(rename = "num_versions")] + pub num_versions: i64, + /// Customer-provided identifier of the prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: String, + /// Whether the prompt was created from the registry or discovered from observed LLM calls. + #[serde(rename = "source")] + pub source: crate::datadogV2::model::LLMObsPromptResponseSource, + /// Tags observed on runs of this prompt. + #[serde(rename = "tags")] + pub tags: Option>, + /// Title of the prompt. + #[serde(rename = "title")] + pub title: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptDataAttributes { + pub fn new( + created_from: String, + in_registry: bool, + num_versions: i64, + prompt_id: String, + source: crate::datadogV2::model::LLMObsPromptResponseSource, + ) -> LLMObsPromptDataAttributes { + LLMObsPromptDataAttributes { + author: None, + created_at: None, + created_from, + datasets: None, + description: None, + extracted_from: None, + in_registry, + last_seen_at: None, + last_version_created_at: None, + ml_app: None, + ml_apps: None, + num_versions, + prompt_id, + source, + tags: None, + title: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn author(mut self, value: String) -> Self { + self.author = Some(value); + self + } + + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + pub fn datasets(mut self, value: Vec) -> Self { + self.datasets = Some(value); + self + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn extracted_from(mut self, value: String) -> Self { + self.extracted_from = Some(value); + self + } + + pub fn last_seen_at(mut self, value: chrono::DateTime) -> Self { + self.last_seen_at = Some(value); + self + } + + pub fn last_version_created_at(mut self, value: chrono::DateTime) -> Self { + self.last_version_created_at = Some(value); + self + } + + pub fn ml_app(mut self, value: String) -> Self { + self.ml_app = Some(value); + self + } + + pub fn ml_apps(mut self, value: Vec) -> Self { + self.ml_apps = Some(value); + self + } + + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsPromptDataAttributesVisitor { + type Value = LLMObsPromptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut author: Option = None; + let mut created_at: Option> = None; + let mut created_from: Option = None; + let mut datasets: Option> = None; + let mut description: Option = None; + let mut extracted_from: Option = None; + let mut in_registry: Option = None; + let mut last_seen_at: Option> = None; + let mut last_version_created_at: Option> = None; + let mut ml_app: Option = None; + let mut ml_apps: Option> = None; + let mut num_versions: Option = None; + let mut prompt_id: Option = None; + let mut source: Option = None; + let mut tags: Option> = None; + let mut title: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "author" => { + if v.is_null() { + continue; + } + author = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_from" => { + created_from = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "datasets" => { + if v.is_null() { + continue; + } + datasets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "extracted_from" => { + if v.is_null() { + continue; + } + extracted_from = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "in_registry" => { + in_registry = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_seen_at" => { + if v.is_null() { + continue; + } + last_seen_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_version_created_at" => { + if v.is_null() { + continue; + } + last_version_created_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_app" => { + if v.is_null() { + continue; + } + ml_app = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_apps" => { + if v.is_null() { + continue; + } + ml_apps = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "num_versions" => { + num_versions = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "source" => { + source = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _source) = source { + match _source { + crate::datadogV2::model::LLMObsPromptResponseSource::UnparsedObject(_source) => { + _unparsed = true; + }, + _ => {} + } + } + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let created_from = + created_from.ok_or_else(|| M::Error::missing_field("created_from"))?; + let in_registry = + in_registry.ok_or_else(|| M::Error::missing_field("in_registry"))?; + let num_versions = + num_versions.ok_or_else(|| M::Error::missing_field("num_versions"))?; + let prompt_id = prompt_id.ok_or_else(|| M::Error::missing_field("prompt_id"))?; + let source = source.ok_or_else(|| M::Error::missing_field("source"))?; + + let content = LLMObsPromptDataAttributes { + author, + created_at, + created_from, + datasets, + description, + extracted_from, + in_registry, + last_seen_at, + last_version_created_at, + ml_app, + ml_apps, + num_versions, + prompt_id, + source, + tags, + title, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_dataset.rs b/src/datadogV2/model/model_llm_obs_prompt_dataset.rs new file mode 100644 index 000000000..7c877dacd --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_dataset.rs @@ -0,0 +1,109 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// A dataset observed in runs associated with a prompt or prompt version. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptDataset { + /// Unique identifier of the dataset. + #[serde(rename = "id")] + pub id: String, + /// Name of the dataset. + #[serde(rename = "name")] + pub name: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptDataset { + pub fn new(id: String) -> LLMObsPromptDataset { + LLMObsPromptDataset { + id, + name: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn name(mut self, value: String) -> Self { + self.name = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptDataset { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptDatasetVisitor; + impl<'a> Visitor<'a> for LLMObsPromptDatasetVisitor { + type Value = LLMObsPromptDataset; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut id: Option = None; + let mut name: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "name" => { + if v.is_null() { + continue; + } + name = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + + let content = LLMObsPromptDataset { + id, + name, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptDatasetVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_response.rs b/src/datadogV2/model/model_llm_obs_prompt_response.rs new file mode 100644 index 000000000..fca2fc82a --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_response.rs @@ -0,0 +1,92 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a single LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptResponse { + /// Data object for an LLM Observability prompt. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsPromptData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptResponse { + pub fn new(data: crate::datadogV2::model::LLMObsPromptData) -> LLMObsPromptResponse { + LLMObsPromptResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptResponseVisitor; + impl<'a> Visitor<'a> for LLMObsPromptResponseVisitor { + type Value = LLMObsPromptResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsPromptResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_response_source.rs b/src/datadogV2/model/model_llm_obs_prompt_response_source.rs new file mode 100644 index 000000000..9f825be6f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_response_source.rs @@ -0,0 +1,51 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsPromptResponseSource { + REGISTRY, + CODE, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsPromptResponseSource { + fn to_string(&self) -> String { + match self { + Self::REGISTRY => String::from("registry"), + Self::CODE => String::from("code"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsPromptResponseSource { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptResponseSource { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "registry" => Self::REGISTRY, + "code" => Self::CODE, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_sdk_data.rs b/src/datadogV2/model/model_llm_obs_prompt_sdk_data.rs new file mode 100644 index 000000000..f714c6a86 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_sdk_data.rs @@ -0,0 +1,127 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for a flattened LLM Observability prompt version returned for SDK consumption. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptSDKData { + /// Attributes of a flattened prompt version returned for SDK consumption. Exactly one of `template` and `chat_template` is returned. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsPromptSDKDataAttributes, + /// Unique identifier of the prompt. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability prompt. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptSDKData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsPromptSDKDataAttributes, + id: String, + type_: crate::datadogV2::model::LLMObsPromptType, + ) -> LLMObsPromptSDKData { + LLMObsPromptSDKData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptSDKData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptSDKDataVisitor; + impl<'a> Visitor<'a> for LLMObsPromptSDKDataVisitor { + type Value = LLMObsPromptSDKData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option = + None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsPromptSDKData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptSDKDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_sdk_data_attributes.rs b/src/datadogV2/model/model_llm_obs_prompt_sdk_data_attributes.rs new file mode 100644 index 000000000..dc6e28520 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_sdk_data_attributes.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a flattened prompt version returned for SDK consumption. Exactly one of `template` and `chat_template` is returned. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptSDKDataAttributes { + /// Chat template for this prompt version, as a list of role and content messages. Omitted for text templates. + #[serde(rename = "chat_template")] + pub chat_template: Option>, + /// Labels attached to the selected version. + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + /// Customer-provided identifier of the prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: Option, + /// Unique identifier of this prompt version. + #[serde(rename = "prompt_version_uuid")] + pub prompt_version_uuid: Option, + /// Text template for this prompt version. Omitted for chat templates. + #[serde(rename = "template")] + pub template: Option, + /// Version identifier for this prompt version. This is the sequential version number unless a user-supplied version identifier was set, in which case that identifier is used instead. + #[serde(rename = "version")] + pub version: Option, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptSDKDataAttributes { + pub fn new() -> LLMObsPromptSDKDataAttributes { + #[allow(deprecated)] + LLMObsPromptSDKDataAttributes { + chat_template: None, + labels: None, + prompt_id: None, + prompt_version_uuid: None, + template: None, + version: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn chat_template( + mut self, + value: Vec, + ) -> Self { + self.chat_template = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } + + #[allow(deprecated)] + pub fn prompt_id(mut self, value: String) -> Self { + self.prompt_id = Some(value); + self + } + + #[allow(deprecated)] + pub fn prompt_version_uuid(mut self, value: String) -> Self { + self.prompt_version_uuid = Some(value); + self + } + + #[allow(deprecated)] + pub fn template(mut self, value: String) -> Self { + self.template = Some(value); + self + } + + #[allow(deprecated)] + pub fn version(mut self, value: String) -> Self { + self.version = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl Default for LLMObsPromptSDKDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptSDKDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptSDKDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsPromptSDKDataAttributesVisitor { + type Value = LLMObsPromptSDKDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut chat_template: Option< + Vec, + > = None; + let mut labels: Option> = None; + let mut prompt_id: Option = None; + let mut prompt_version_uuid: Option = None; + let mut template: Option = None; + let mut version: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "chat_template" => { + if v.is_null() { + continue; + } + chat_template = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + if v.is_null() { + continue; + } + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_version_uuid" => { + if v.is_null() { + continue; + } + prompt_version_uuid = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "template" => { + if v.is_null() { + continue; + } + template = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + if v.is_null() { + continue; + } + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + + #[allow(deprecated)] + let content = LLMObsPromptSDKDataAttributes { + chat_template, + labels, + prompt_id, + prompt_version_uuid, + template, + version, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptSDKDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_sdk_response.rs b/src/datadogV2/model/model_llm_obs_prompt_sdk_response.rs new file mode 100644 index 000000000..b67f34bf0 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_sdk_response.rs @@ -0,0 +1,92 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a flattened LLM Observability prompt version for SDK consumption. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptSDKResponse { + /// Data object for a flattened LLM Observability prompt version returned for SDK consumption. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsPromptSDKData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptSDKResponse { + pub fn new(data: crate::datadogV2::model::LLMObsPromptSDKData) -> LLMObsPromptSDKResponse { + LLMObsPromptSDKResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptSDKResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptSDKResponseVisitor; + impl<'a> Visitor<'a> for LLMObsPromptSDKResponseVisitor { + type Value = LLMObsPromptSDKResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsPromptSDKResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptSDKResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_template.rs b/src/datadogV2/model/model_llm_obs_prompt_template.rs new file mode 100644 index 000000000..3bd2212f9 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_template.rs @@ -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. +use serde::{Deserialize, Deserializer, Serialize}; + +/// A text template or a list of chat messages. +#[non_exhaustive] +#[derive(Clone, Debug, PartialEq, Serialize)] +#[serde(untagged)] +pub enum LLMObsPromptTemplate { + LLMObsPromptTextTemplate(String), + LLMObsPromptChatTemplate(Vec), + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl<'de> Deserialize<'de> for LLMObsPromptTemplate { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value: serde_json::Value = Deserialize::deserialize(deserializer)?; + if let Ok(_v) = serde_json::from_value::(value.clone()) { + return Ok(LLMObsPromptTemplate::LLMObsPromptTextTemplate(_v)); + } + if let Ok(_v) = serde_json::from_value::< + Vec, + >(value.clone()) + { + return Ok(LLMObsPromptTemplate::LLMObsPromptChatTemplate(_v)); + } + + return Ok(LLMObsPromptTemplate::UnparsedObject( + crate::datadog::UnparsedObject { value }, + )); + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_type.rs b/src/datadogV2/model/model_llm_obs_prompt_type.rs new file mode 100644 index 000000000..dfaed24c2 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsPromptType { + PROMPT_TEMPLATES, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsPromptType { + fn to_string(&self) -> String { + match self { + Self::PROMPT_TEMPLATES => String::from("prompt-templates"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsPromptType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "prompt-templates" => Self::PROMPT_TEMPLATES, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_data.rs b/src/datadogV2/model/model_llm_obs_prompt_version_data.rs new file mode 100644 index 000000000..03ec32aff --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_data.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for a specific version of an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionData { + /// Attributes of a specific version of an LLM Observability prompt. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsPromptVersionDataAttributes, + /// Unique identifier of the prompt version. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability prompt version. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptVersionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsPromptVersionDataAttributes, + id: String, + type_: crate::datadogV2::model::LLMObsPromptVersionType, + ) -> LLMObsPromptVersionData { + LLMObsPromptVersionData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionDataVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionDataVisitor { + type Value = LLMObsPromptVersionData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsPromptVersionDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptVersionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsPromptVersionData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_data_attributes.rs b/src/datadogV2/model/model_llm_obs_prompt_version_data_attributes.rs new file mode 100644 index 000000000..afe7476e9 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_data_attributes.rs @@ -0,0 +1,342 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a specific version of an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionDataAttributes { + /// UUID of the user who authored this version. + #[serde(rename = "author")] + pub author: Option, + /// Timestamp stored on this prompt version. + #[serde(rename = "created_at")] + pub created_at: Option>, + /// Datasets observed in runs associated with this prompt version. + #[serde(rename = "datasets")] + pub datasets: Option>, + /// Description of this version. + #[serde(rename = "description")] + pub description: Option, + /// Labels attached to this version (for example `development`, `staging`, `production`). + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + /// Timestamp of the most recent observed run of this prompt version. + #[serde(rename = "last_seen_at")] + pub last_seen_at: Option>, + /// The ML application this prompt is associated with. + #[serde(rename = "ml_app")] + pub ml_app: Option, + /// ML applications observed running this prompt version. + #[serde(rename = "ml_apps")] + pub ml_apps: Option>, + /// Customer-provided identifier of the parent prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: String, + /// Unique identifier of the parent prompt. + #[serde(rename = "prompt_uuid")] + pub prompt_uuid: String, + /// Tags observed on runs of this prompt version. + #[serde(rename = "tags")] + pub tags: Option>, + /// A text template or a list of chat messages. + #[serde(rename = "template")] + pub template: crate::datadogV2::model::LLMObsPromptTemplate, + /// User-supplied identifier for this version. + #[serde(rename = "user_version")] + pub user_version: Option, + /// Sequential version number. + #[serde(rename = "version")] + pub version: i64, + /// Timestamp when this version was created. + #[serde(rename = "version_created_at")] + pub version_created_at: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionDataAttributes { + pub fn new( + prompt_id: String, + prompt_uuid: String, + template: crate::datadogV2::model::LLMObsPromptTemplate, + version: i64, + ) -> LLMObsPromptVersionDataAttributes { + #[allow(deprecated)] + LLMObsPromptVersionDataAttributes { + author: None, + created_at: None, + datasets: None, + description: None, + labels: None, + last_seen_at: None, + ml_app: None, + ml_apps: None, + prompt_id, + prompt_uuid, + tags: None, + template, + user_version: None, + version, + version_created_at: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn author(mut self, value: String) -> Self { + self.author = Some(value); + self + } + + #[allow(deprecated)] + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + #[allow(deprecated)] + pub fn datasets(mut self, value: Vec) -> Self { + self.datasets = Some(value); + self + } + + #[allow(deprecated)] + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } + + #[allow(deprecated)] + pub fn last_seen_at(mut self, value: chrono::DateTime) -> Self { + self.last_seen_at = Some(value); + self + } + + #[allow(deprecated)] + pub fn ml_app(mut self, value: String) -> Self { + self.ml_app = Some(value); + self + } + + #[allow(deprecated)] + pub fn ml_apps(mut self, value: Vec) -> Self { + self.ml_apps = Some(value); + self + } + + #[allow(deprecated)] + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + #[allow(deprecated)] + pub fn user_version(mut self, value: String) -> Self { + self.user_version = Some(value); + self + } + + #[allow(deprecated)] + pub fn version_created_at(mut self, value: chrono::DateTime) -> Self { + self.version_created_at = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionDataAttributesVisitor { + type Value = LLMObsPromptVersionDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut author: Option = None; + let mut created_at: Option> = None; + let mut datasets: Option> = None; + let mut description: Option = None; + let mut labels: Option> = None; + let mut last_seen_at: Option> = None; + let mut ml_app: Option = None; + let mut ml_apps: Option> = None; + let mut prompt_id: Option = None; + let mut prompt_uuid: Option = None; + let mut tags: Option> = None; + let mut template: Option = None; + let mut user_version: Option = None; + let mut version: Option = None; + let mut version_created_at: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "author" => { + if v.is_null() { + continue; + } + author = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "datasets" => { + if v.is_null() { + continue; + } + datasets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_seen_at" => { + if v.is_null() { + continue; + } + last_seen_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_app" => { + if v.is_null() { + continue; + } + ml_app = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_apps" => { + if v.is_null() { + continue; + } + ml_apps = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_uuid" => { + prompt_uuid = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "template" => { + template = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _template) = template { + match _template { + crate::datadogV2::model::LLMObsPromptTemplate::UnparsedObject(_template) => { + _unparsed = true; + }, + _ => {} + } + } + } + "user_version" => { + if v.is_null() { + continue; + } + user_version = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version_created_at" => { + if v.is_null() { + continue; + } + version_created_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let prompt_id = prompt_id.ok_or_else(|| M::Error::missing_field("prompt_id"))?; + let prompt_uuid = + prompt_uuid.ok_or_else(|| M::Error::missing_field("prompt_uuid"))?; + let template = template.ok_or_else(|| M::Error::missing_field("template"))?; + let version = version.ok_or_else(|| M::Error::missing_field("version"))?; + + #[allow(deprecated)] + let content = LLMObsPromptVersionDataAttributes { + author, + created_at, + datasets, + description, + labels, + last_seen_at, + ml_app, + ml_apps, + prompt_id, + prompt_uuid, + tags, + template, + user_version, + version, + version_created_at, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_label.rs b/src/datadogV2/model/model_llm_obs_prompt_version_label.rs new file mode 100644 index 000000000..47f3afb9b --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_label.rs @@ -0,0 +1,51 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsPromptVersionLabel { + PRODUCTION, + DEVELOPMENT, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsPromptVersionLabel { + fn to_string(&self) -> String { + match self { + Self::PRODUCTION => String::from("production"), + Self::DEVELOPMENT => String::from("development"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsPromptVersionLabel { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionLabel { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "production" => Self::PRODUCTION, + "development" => Self::DEVELOPMENT, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_list_data.rs b/src/datadogV2/model/model_llm_obs_prompt_version_list_data.rs new file mode 100644 index 000000000..e23c27865 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_list_data.rs @@ -0,0 +1,126 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for a prompt version returned in a list. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionListData { + /// Attributes of a prompt version returned in a list, excluding its template. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsPromptVersionListDataAttributes, + /// Unique identifier of the prompt version. + #[serde(rename = "id")] + pub id: String, + /// Resource type of an LLM Observability prompt version. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptVersionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionListData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsPromptVersionListDataAttributes, + id: String, + type_: crate::datadogV2::model::LLMObsPromptVersionType, + ) -> LLMObsPromptVersionListData { + LLMObsPromptVersionListData { + attributes, + id, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionListData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionListDataVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionListDataVisitor { + type Value = LLMObsPromptVersionListData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsPromptVersionListDataAttributes, + > = None; + let mut id: Option = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "id" => { + id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptVersionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let id = id.ok_or_else(|| M::Error::missing_field("id"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsPromptVersionListData { + attributes, + id, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionListDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_list_data_attributes.rs b/src/datadogV2/model/model_llm_obs_prompt_version_list_data_attributes.rs new file mode 100644 index 000000000..8d118926c --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_list_data_attributes.rs @@ -0,0 +1,323 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes of a prompt version returned in a list, excluding its template. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionListDataAttributes { + /// UUID of the user who authored this version. + #[serde(rename = "author")] + pub author: Option, + /// Timestamp stored on this prompt version. + #[serde(rename = "created_at")] + pub created_at: Option>, + /// Datasets observed in runs associated with this prompt version. + #[serde(rename = "datasets")] + pub datasets: Option>, + /// Description of this version. + #[serde(rename = "description")] + pub description: Option, + /// Labels attached to this version (for example `development`, `staging`, `production`). + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + /// Timestamp of the most recent observed run of this prompt version. + #[serde(rename = "last_seen_at")] + pub last_seen_at: Option>, + /// The ML application this prompt is associated with. + #[serde(rename = "ml_app")] + pub ml_app: Option, + /// ML applications observed running this prompt version. + #[serde(rename = "ml_apps")] + pub ml_apps: Option>, + /// Customer-provided identifier of the parent prompt. + #[serde(rename = "prompt_id")] + pub prompt_id: String, + /// Unique identifier of the parent prompt. + #[serde(rename = "prompt_uuid")] + pub prompt_uuid: String, + /// Tags observed on runs of this prompt version. + #[serde(rename = "tags")] + pub tags: Option>, + /// User-supplied identifier for this version. + #[serde(rename = "user_version")] + pub user_version: Option, + /// Sequential version number. + #[serde(rename = "version")] + pub version: i64, + /// Timestamp when this version was created. + #[serde(rename = "version_created_at")] + pub version_created_at: Option>, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionListDataAttributes { + pub fn new( + prompt_id: String, + prompt_uuid: String, + version: i64, + ) -> LLMObsPromptVersionListDataAttributes { + #[allow(deprecated)] + LLMObsPromptVersionListDataAttributes { + author: None, + created_at: None, + datasets: None, + description: None, + labels: None, + last_seen_at: None, + ml_app: None, + ml_apps: None, + prompt_id, + prompt_uuid, + tags: None, + user_version: None, + version, + version_created_at: None, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn author(mut self, value: String) -> Self { + self.author = Some(value); + self + } + + #[allow(deprecated)] + pub fn created_at(mut self, value: chrono::DateTime) -> Self { + self.created_at = Some(value); + self + } + + #[allow(deprecated)] + pub fn datasets(mut self, value: Vec) -> Self { + self.datasets = Some(value); + self + } + + #[allow(deprecated)] + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } + + #[allow(deprecated)] + pub fn last_seen_at(mut self, value: chrono::DateTime) -> Self { + self.last_seen_at = Some(value); + self + } + + #[allow(deprecated)] + pub fn ml_app(mut self, value: String) -> Self { + self.ml_app = Some(value); + self + } + + #[allow(deprecated)] + pub fn ml_apps(mut self, value: Vec) -> Self { + self.ml_apps = Some(value); + self + } + + #[allow(deprecated)] + pub fn tags(mut self, value: Vec) -> Self { + self.tags = Some(value); + self + } + + #[allow(deprecated)] + pub fn user_version(mut self, value: String) -> Self { + self.user_version = Some(value); + self + } + + #[allow(deprecated)] + pub fn version_created_at(mut self, value: chrono::DateTime) -> Self { + self.version_created_at = Some(value); + self + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionListDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionListDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionListDataAttributesVisitor { + type Value = LLMObsPromptVersionListDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut author: Option = None; + let mut created_at: Option> = None; + let mut datasets: Option> = None; + let mut description: Option = None; + let mut labels: Option> = None; + let mut last_seen_at: Option> = None; + let mut ml_app: Option = None; + let mut ml_apps: Option> = None; + let mut prompt_id: Option = None; + let mut prompt_uuid: Option = None; + let mut tags: Option> = None; + let mut user_version: Option = None; + let mut version: Option = None; + let mut version_created_at: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "author" => { + if v.is_null() { + continue; + } + author = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "created_at" => { + if v.is_null() { + continue; + } + created_at = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "datasets" => { + if v.is_null() { + continue; + } + datasets = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "last_seen_at" => { + if v.is_null() { + continue; + } + last_seen_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_app" => { + if v.is_null() { + continue; + } + ml_app = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "ml_apps" => { + if v.is_null() { + continue; + } + ml_apps = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_id" => { + prompt_id = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "prompt_uuid" => { + prompt_uuid = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "tags" => { + if v.is_null() { + continue; + } + tags = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "user_version" => { + if v.is_null() { + continue; + } + user_version = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version" => { + version = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "version_created_at" => { + if v.is_null() { + continue; + } + version_created_at = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let prompt_id = prompt_id.ok_or_else(|| M::Error::missing_field("prompt_id"))?; + let prompt_uuid = + prompt_uuid.ok_or_else(|| M::Error::missing_field("prompt_uuid"))?; + let version = version.ok_or_else(|| M::Error::missing_field("version"))?; + + #[allow(deprecated)] + let content = LLMObsPromptVersionListDataAttributes { + author, + created_at, + datasets, + description, + labels, + last_seen_at, + ml_app, + ml_apps, + prompt_id, + prompt_uuid, + tags, + user_version, + version, + version_created_at, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionListDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_response.rs b/src/datadogV2/model/model_llm_obs_prompt_version_response.rs new file mode 100644 index 000000000..9abdaf000 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_response.rs @@ -0,0 +1,94 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a specific version of an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionResponse { + /// Data object for a specific version of an LLM Observability prompt. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsPromptVersionData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionResponse { + pub fn new( + data: crate::datadogV2::model::LLMObsPromptVersionData, + ) -> LLMObsPromptVersionResponse { + LLMObsPromptVersionResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionResponseVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionResponseVisitor { + type Value = LLMObsPromptVersionResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsPromptVersionResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_version_type.rs b/src/datadogV2/model/model_llm_obs_prompt_version_type.rs new file mode 100644 index 000000000..6941fbdb2 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_version_type.rs @@ -0,0 +1,48 @@ +// 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. + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +#[non_exhaustive] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum LLMObsPromptVersionType { + PROMPT_TEMPLATE_VERSIONS, + UnparsedObject(crate::datadog::UnparsedObject), +} + +impl ToString for LLMObsPromptVersionType { + fn to_string(&self) -> String { + match self { + Self::PROMPT_TEMPLATE_VERSIONS => String::from("prompt-template-versions"), + Self::UnparsedObject(v) => v.value.to_string(), + } + } +} + +impl Serialize for LLMObsPromptVersionType { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self { + Self::UnparsedObject(v) => v.serialize(serializer), + _ => serializer.serialize_str(self.to_string().as_str()), + } + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionType { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let s: String = String::deserialize(deserializer)?; + Ok(match s.as_str() { + "prompt-template-versions" => Self::PROMPT_TEMPLATE_VERSIONS, + _ => Self::UnparsedObject(crate::datadog::UnparsedObject { + value: serde_json::Value::String(s.into()), + }), + }) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompt_versions_response.rs b/src/datadogV2/model/model_llm_obs_prompt_versions_response.rs new file mode 100644 index 000000000..0ea1d1f3f --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompt_versions_response.rs @@ -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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing the versions of an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptVersionsResponse { + /// Prompt versions ordered from newest to oldest. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptVersionsResponse { + pub fn new( + data: Vec, + ) -> LLMObsPromptVersionsResponse { + LLMObsPromptVersionsResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptVersionsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptVersionsResponseVisitor; + impl<'a> Visitor<'a> for LLMObsPromptVersionsResponseVisitor { + type Value = LLMObsPromptVersionsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = + None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsPromptVersionsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptVersionsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_prompts_response.rs b/src/datadogV2/model/model_llm_obs_prompts_response.rs new file mode 100644 index 000000000..6e4aa1b78 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_prompts_response.rs @@ -0,0 +1,92 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Response containing a list of LLM Observability prompts. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsPromptsResponse { + /// List of LLM Observability prompts. + #[serde(rename = "data")] + pub data: Vec, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsPromptsResponse { + pub fn new(data: Vec) -> LLMObsPromptsResponse { + LLMObsPromptsResponse { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsPromptsResponse { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsPromptsResponseVisitor; + impl<'a> Visitor<'a> for LLMObsPromptsResponseVisitor { + type Value = LLMObsPromptsResponse; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option> = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsPromptsResponse { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsPromptsResponseVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_data.rs b/src/datadogV2/model/model_llm_obs_update_prompt_data.rs new file mode 100644 index 000000000..13ad12569 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_data.rs @@ -0,0 +1,117 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for updating an LLM Observability prompt. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptData { + /// Attributes for updating an LLM Observability prompt. At least one of `title` or `description` must be provided; both attributes are optional individually. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsUpdatePromptDataAttributes, + /// Resource type of an LLM Observability prompt. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsUpdatePromptDataAttributes, + type_: crate::datadogV2::model::LLMObsPromptType, + ) -> LLMObsUpdatePromptData { + LLMObsUpdatePromptData { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptDataVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptDataVisitor { + type Value = LLMObsUpdatePromptData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsUpdatePromptDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptType::UnparsedObject( + _type_, + ) => { + _unparsed = true; + } + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsUpdatePromptData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_data_attributes.rs b/src/datadogV2/model/model_llm_obs_update_prompt_data_attributes.rs new file mode 100644 index 000000000..e22442bdc --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_data_attributes.rs @@ -0,0 +1,107 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for updating an LLM Observability prompt. At least one of `title` or `description` must be provided; both attributes are optional individually. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptDataAttributes { + /// Optional new description for the prompt. + #[serde(rename = "description")] + pub description: Option, + /// Optional new title for the prompt. + #[serde(rename = "title")] + pub title: Option, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptDataAttributes { + pub fn new() -> LLMObsUpdatePromptDataAttributes { + LLMObsUpdatePromptDataAttributes { + description: None, + title: None, + _unparsed: false, + } + } + + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + pub fn title(mut self, value: String) -> Self { + self.title = Some(value); + self + } +} + +impl Default for LLMObsUpdatePromptDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptDataAttributesVisitor { + type Value = LLMObsUpdatePromptDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut title: Option = None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "title" => { + if v.is_null() { + continue; + } + title = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + + let content = LLMObsUpdatePromptDataAttributes { + description, + title, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_request.rs b/src/datadogV2/model/model_llm_obs_update_prompt_request.rs new file mode 100644 index 000000000..3a8815866 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_request.rs @@ -0,0 +1,92 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to update an LLM Observability prompt's metadata. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptRequest { + /// Data object for updating an LLM Observability prompt. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsUpdatePromptData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptRequest { + pub fn new(data: crate::datadogV2::model::LLMObsUpdatePromptData) -> LLMObsUpdatePromptRequest { + LLMObsUpdatePromptRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptRequestVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptRequestVisitor { + type Value = LLMObsUpdatePromptRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsUpdatePromptRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptRequestVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_version_data.rs b/src/datadogV2/model/model_llm_obs_update_prompt_version_data.rs new file mode 100644 index 000000000..d2bc828ed --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_version_data.rs @@ -0,0 +1,115 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Data object for updating an LLM Observability prompt version. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptVersionData { + /// Attributes for updating an LLM Observability prompt version. At least one of `description`, `labels`, or `env_ids` must be provided; all three attributes are optional individually. + #[serde(rename = "attributes")] + pub attributes: crate::datadogV2::model::LLMObsUpdatePromptVersionDataAttributes, + /// Resource type of an LLM Observability prompt version. + #[serde(rename = "type")] + pub type_: crate::datadogV2::model::LLMObsPromptVersionType, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptVersionData { + pub fn new( + attributes: crate::datadogV2::model::LLMObsUpdatePromptVersionDataAttributes, + type_: crate::datadogV2::model::LLMObsPromptVersionType, + ) -> LLMObsUpdatePromptVersionData { + LLMObsUpdatePromptVersionData { + attributes, + type_, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptVersionData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptVersionDataVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptVersionDataVisitor { + type Value = LLMObsUpdatePromptVersionData; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut attributes: Option< + crate::datadogV2::model::LLMObsUpdatePromptVersionDataAttributes, + > = None; + let mut type_: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "attributes" => { + attributes = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "type" => { + type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + if let Some(ref _type_) = type_ { + match _type_ { + crate::datadogV2::model::LLMObsPromptVersionType::UnparsedObject(_type_) => { + _unparsed = true; + }, + _ => {} + } + } + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let attributes = attributes.ok_or_else(|| M::Error::missing_field("attributes"))?; + let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?; + + let content = LLMObsUpdatePromptVersionData { + attributes, + type_, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptVersionDataVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_version_data_attributes.rs b/src/datadogV2/model/model_llm_obs_update_prompt_version_data_attributes.rs new file mode 100644 index 000000000..f25780ff7 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_version_data_attributes.rs @@ -0,0 +1,131 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Attributes for updating an LLM Observability prompt version. At least one of `description`, `labels`, or `env_ids` must be provided; all three attributes are optional individually. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptVersionDataAttributes { + /// Optional new description for this version. + #[serde(rename = "description")] + pub description: Option, + /// Optional feature-flag environment UUIDs the service attempts to enable and configure to use this version as their default. + #[serde(rename = "env_ids")] + pub env_ids: Option>, + /// Optional new labels for this version. Do not use this attribute for new integrations. + #[deprecated] + #[serde(rename = "labels")] + pub labels: Option>, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptVersionDataAttributes { + pub fn new() -> LLMObsUpdatePromptVersionDataAttributes { + #[allow(deprecated)] + LLMObsUpdatePromptVersionDataAttributes { + description: None, + env_ids: None, + labels: None, + _unparsed: false, + } + } + + #[allow(deprecated)] + pub fn description(mut self, value: String) -> Self { + self.description = Some(value); + self + } + + #[allow(deprecated)] + pub fn env_ids(mut self, value: Vec) -> Self { + self.env_ids = Some(value); + self + } + + #[allow(deprecated)] + pub fn labels(mut self, value: Vec) -> Self { + self.labels = Some(value); + self + } +} + +impl Default for LLMObsUpdatePromptVersionDataAttributes { + fn default() -> Self { + Self::new() + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptVersionDataAttributes { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptVersionDataAttributesVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptVersionDataAttributesVisitor { + type Value = LLMObsUpdatePromptVersionDataAttributes; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut description: Option = None; + let mut env_ids: Option> = None; + let mut labels: Option> = + None; + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "description" => { + if v.is_null() { + continue; + } + description = + Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "env_ids" => { + if v.is_null() { + continue; + } + env_ids = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + "labels" => { + if v.is_null() { + continue; + } + labels = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + return Err(serde::de::Error::custom( + "Additional properties not allowed", + )); + } + } + } + + #[allow(deprecated)] + let content = LLMObsUpdatePromptVersionDataAttributes { + description, + env_ids, + labels, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptVersionDataAttributesVisitor) + } +} diff --git a/src/datadogV2/model/model_llm_obs_update_prompt_version_request.rs b/src/datadogV2/model/model_llm_obs_update_prompt_version_request.rs new file mode 100644 index 000000000..e15bcf5f9 --- /dev/null +++ b/src/datadogV2/model/model_llm_obs_update_prompt_version_request.rs @@ -0,0 +1,94 @@ +// 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. +use serde::de::{Error, MapAccess, Visitor}; +use serde::{Deserialize, Deserializer, Serialize}; +use serde_with::skip_serializing_none; +use std::fmt::{self, Formatter}; + +/// Request to update an LLM Observability prompt version's metadata or feature-flag environments. +#[non_exhaustive] +#[skip_serializing_none] +#[derive(Clone, Debug, PartialEq, Serialize)] +pub struct LLMObsUpdatePromptVersionRequest { + /// Data object for updating an LLM Observability prompt version. + #[serde(rename = "data")] + pub data: crate::datadogV2::model::LLMObsUpdatePromptVersionData, + #[serde(flatten)] + pub additional_properties: std::collections::BTreeMap, + #[serde(skip)] + #[serde(default)] + pub(crate) _unparsed: bool, +} + +impl LLMObsUpdatePromptVersionRequest { + pub fn new( + data: crate::datadogV2::model::LLMObsUpdatePromptVersionData, + ) -> LLMObsUpdatePromptVersionRequest { + LLMObsUpdatePromptVersionRequest { + data, + additional_properties: std::collections::BTreeMap::new(), + _unparsed: false, + } + } + + pub fn additional_properties( + mut self, + value: std::collections::BTreeMap, + ) -> Self { + self.additional_properties = value; + self + } +} + +impl<'de> Deserialize<'de> for LLMObsUpdatePromptVersionRequest { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct LLMObsUpdatePromptVersionRequestVisitor; + impl<'a> Visitor<'a> for LLMObsUpdatePromptVersionRequestVisitor { + type Value = LLMObsUpdatePromptVersionRequest; + + fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result { + f.write_str("a mapping") + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'a>, + { + let mut data: Option = None; + let mut additional_properties: std::collections::BTreeMap< + String, + serde_json::Value, + > = std::collections::BTreeMap::new(); + let mut _unparsed = false; + + while let Some((k, v)) = map.next_entry::()? { + match k.as_str() { + "data" => { + data = Some(serde_json::from_value(v).map_err(M::Error::custom)?); + } + &_ => { + if let Ok(value) = serde_json::from_value(v.clone()) { + additional_properties.insert(k, value); + } + } + } + } + let data = data.ok_or_else(|| M::Error::missing_field("data"))?; + + let content = LLMObsUpdatePromptVersionRequest { + data, + additional_properties, + _unparsed, + }; + + Ok(content) + } + } + + deserializer.deserialize_any(LLMObsUpdatePromptVersionRequestVisitor) + } +} diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..c9cc8bd3d --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2026-07-20T10:28:03.829Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.json new file mode 100644 index 000000000..744ff600d --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Bad-Request-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_Bad_Request_response-1784543283\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9c67c0e2-0806-589b-8e8c-83ab2e6f76e3\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T10:28:04.139526235Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T10:28:04.139526235Z\",\"num_versions\":1,\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_Bad_Request_response-1784543283\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:28:03 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"template\":\" \"},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_a_new_LLM_Observability_prompt_version_returns_Bad_Request_response-1784543283/versions" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid prompt template\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:28:03 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_a_new_LLM_Observability_prompt_version_returns_Bad_Request_response-1784543283" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"9c67c0e2-0806-589b-8e8c-83ab2e6f76e3\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T10:28:05.328346Z\",\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_Bad_Request_response-1784543283\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:28:03 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000..953941fa6 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:19:57.708Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.json new file mode 100644 index 000000000..75e512ad7 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"env_ids\":[],\"labels\":[],\"template\":[{\"content\":\"Hello v2\",\"role\":\"user\"}]},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt/versions" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt template not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:19:57 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.frozen new file mode 100644 index 000000000..c82fbc75d --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-21T12:32:24.134Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.json new file mode 100644 index 000000000..094a97ca3 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-a-new-LLM-Observability-prompt-version-returns-OK-response.json @@ -0,0 +1,129 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c0077820-d57d-54d6-be0c-b62e4e827e67\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-21T12:32:24.497241896Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-21T12:32:24.497241896Z\",\"num_versions\":1,\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:32:24 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"template\":[{\"content\":\"You are a concise customer support assistant for {{company_name}}.\",\"role\":\"system\"},{\"content\":\"Answer {{customer_name}}'s question: {{question}}\",\"role\":\"user\"}]},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144/versions" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"a002055b-7e0f-501d-ba5b-45df41fbca73\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-21T12:32:25.272760959Z\",\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144\",\"prompt_uuid\":\"c0077820-d57d-54d6-be0c-b62e4e827e67\",\"template\":[{\"content\":\"You are a concise customer support assistant for {{company_name}}.\",\"role\":\"system\"},{\"content\":\"Answer {{customer_name}}'s question: {{question}}\",\"role\":\"user\"}],\"version\":2,\"version_created_at\":\"2026-07-21T12:32:25.272760959Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:32:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c0077820-d57d-54d6-be0c-b62e4e827e67\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-21T12:32:25.768356Z\",\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:32:24 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c0077820-d57d-54d6-be0c-b62e4e827e67\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-21T12:32:26.168974Z\",\"prompt_id\":\"Test-Create_a_new_LLM_Observability_prompt_version_returns_OK_response-1784637144\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:32:24 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..3cfa6ea02 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2026-07-20T10:28:19.611Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.json new file mode 100644 index 000000000..028b07f0c --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Bad-Request-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_Bad_Request_response-1784543299\",\"template\":\" \"},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"invalid prompt template\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:28:19 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.frozen new file mode 100644 index 000000000..869e5fe28 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:19:59.888Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.json new file mode 100644 index 000000000..797a9a950 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-Conflict-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_Conflict_response-1784539199\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"2fedf714-8445-571b-bad9-f7d4bb131524\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:00.140121332Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:20:00.140121332Z\",\"num_versions\":1,\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_Conflict_response-1784539199\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:19:59 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"env_ids\":[],\"labels\":[],\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_Conflict_response-1784539199\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt template already exists\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 409, + "message": "Conflict" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:19:59 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_an_LLM_Observability_prompt_returns_Conflict_response-1784539199" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"2fedf714-8445-571b-bad9-f7d4bb131524\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:01.051306Z\",\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_Conflict_response-1784539199\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:19:59 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.frozen new file mode 100644 index 000000000..51c734e1f --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-21T12:31:53.516Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.json new file mode 100644 index 000000000..8ea15aae2 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Create-an-LLM-Observability-prompt-returns-OK-response.json @@ -0,0 +1,67 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_OK_response-1784637113\",\"template\":[{\"content\":\"You are a helpful customer support assistant for {{company_name}}.\",\"role\":\"system\"},{\"content\":\"Help {{customer_name}} with this question: {{question}}\",\"role\":\"user\"}],\"title\":\"Customer Support Assistant\"},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7d3137ab-7d6a-5358-b791-26ead4540e09\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-21T12:31:53.812929348Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-21T12:31:53.812929348Z\",\"num_versions\":1,\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_OK_response-1784637113\",\"source\":\"registry\",\"title\":\"Customer Support Assistant\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:31:53 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Create_an_LLM_Observability_prompt_returns_OK_response-1784637113" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"7d3137ab-7d6a-5358-b791-26ead4540e09\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-21T12:31:55.799078Z\",\"prompt_id\":\"Test-Create_an_LLM_Observability_prompt_returns_OK_response-1784637113\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Tue, 21 Jul 2026 12:31:53 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.frozen new file mode 100644 index 000000000..aa624718a --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:02.116Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.json new file mode 100644 index 000000000..a9b661b15 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt template not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:02 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.frozen new file mode 100644 index 000000000..710a0192e --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:02.406Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.json new file mode 100644 index 000000000..59e7b8c99 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Delete-an-LLM-Observability-prompt-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d5df9e4e-acd0-5d9f-b0d5-c09a643c33e2\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:02.660067768Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:20:02.660067768Z\",\"num_versions\":1,\"prompt_id\":\"Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:02 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d5df9e4e-acd0-5d9f-b0d5-c09a643c33e2\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:03.299559Z\",\"prompt_id\":\"Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:02 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d5df9e4e-acd0-5d9f-b0d5-c09a643c33e2\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:03.637257Z\",\"prompt_id\":\"Test-Delete_an_LLM_Observability_prompt_returns_OK_response-1784539202\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:02 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000..4ccdfe430 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T10:29:01.052Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json new file mode 100644 index 000000000..784907f7e --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt/versions/1" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"status\":\"404\",\"title\":\"Not Found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:29:01 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen new file mode 100644 index 000000000..51fcc5fc0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T12:24:45.688Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.json new file mode 100644 index 000000000..40dc98dd4 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-a-specific-LLM-Observability-prompt-version-returns-OK-response.json @@ -0,0 +1,157 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"599ee1f4-9680-5ff8-92c9-ca31130057f3\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T12:24:46.021742711Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T12:24:46.021742711Z\",\"num_versions\":1,\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 12:24:45 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"template\":[{\"content\":\"Hello v2\",\"role\":\"user\"}]},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285/versions" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d80790f5-cd99-5d57-b6e0-4d4bbbc21514\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T12:24:46.796641541Z\",\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\",\"prompt_uuid\":\"599ee1f4-9680-5ff8-92c9-ca31130057f3\",\"template\":[{\"content\":\"Hello v2\",\"role\":\"user\"}],\"version\":2,\"version_created_at\":\"2026-07-20T12:24:46.796641541Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 12:24:45 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285/versions/2" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"d80790f5-cd99-5d57-b6e0-4d4bbbc21514\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T12:24:46.796641Z\",\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\",\"prompt_uuid\":\"599ee1f4-9680-5ff8-92c9-ca31130057f3\",\"template\":[{\"role\":\"user\",\"content\":\"Hello v2\"}],\"version\":2,\"version_created_at\":\"2026-07-20T12:24:46.796641Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 12:24:45 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"599ee1f4-9680-5ff8-92c9-ca31130057f3\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T12:24:48.753279Z\",\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 12:24:45 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"599ee1f4-9680-5ff8-92c9-ca31130057f3\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T12:24:49.086069Z\",\"prompt_id\":\"Test-Get_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784550285\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 12:24:45 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.frozen new file mode 100644 index 000000000..3c46437a8 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:08.586Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.json new file mode 100644 index 000000000..219d3e09c --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-Not-Found-response.json @@ -0,0 +1,33 @@ +{ + "http_interactions": [ + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt with id 'nonexistent-prompt' not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:08 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.frozen new file mode 100644 index 000000000..cbbdf8910 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:08.880Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.json new file mode 100644 index 000000000..d4aa8dc8d --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Get-an-LLM-Observability-prompt-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"95e93a91-1020-5a23-9cb7-c8ca6e3b1785\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:09.112910708Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:20:09.112910708Z\",\"num_versions\":1,\"prompt_id\":\"Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:08 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"95e93a91-1020-5a23-9cb7-c8ca6e3b1785\",\"type\":\"prompt-templates\",\"attributes\":{\"chat_template\":[{\"role\":\"user\",\"content\":\"Hello\"}],\"prompt_id\":\"Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208\",\"prompt_version_uuid\":\"9cd92cc7-2f51-5867-8148-eaf41efee79d\",\"version\":\"1\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:08 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"95e93a91-1020-5a23-9cb7-c8ca6e3b1785\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:10.172623Z\",\"prompt_id\":\"Test-Get_an_LLM_Observability_prompt_returns_OK_response-1784539208\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:08 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.frozen new file mode 100644 index 000000000..9a473ba71 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:30:04.586Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.json new file mode 100644 index 000000000..b98b88df0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/List-LLM-Observability-prompts-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-List_LLM_Observability_prompts_returns_OK_response-1784539804\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b04a1ded-d2da-578c-a520-1c1dd2046d1c\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:30:04.928462935Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:30:04.928462935Z\",\"num_versions\":1,\"prompt_id\":\"Test-List_LLM_Observability_prompts_returns_OK_response-1784539804\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:30:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts?filter%5Bprompt_id%5D=Test-List_LLM_Observability_prompts_returns_OK_response-1784539804" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"b04a1ded-d2da-578c-a520-1c1dd2046d1c\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:30:04.928462Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:30:04.928462Z\",\"num_versions\":1,\"prompt_id\":\"Test-List_LLM_Observability_prompts_returns_OK_response-1784539804\",\"source\":\"registry\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:30:04 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-List_LLM_Observability_prompts_returns_OK_response-1784539804" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b04a1ded-d2da-578c-a520-1c1dd2046d1c\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:30:06.787619Z\",\"prompt_id\":\"Test-List_LLM_Observability_prompts_returns_OK_response-1784539804\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:30:04 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.frozen new file mode 100644 index 000000000..5cbb96b98 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:12.882Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.json new file mode 100644 index 000000000..604a78815 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/List-versions-of-an-LLM-Observability-prompt-returns-OK-response.json @@ -0,0 +1,95 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"31fdf246-89b8-5a48-9544-ff84c4504939\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:13.145132213Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:20:13.145132213Z\",\"num_versions\":1,\"prompt_id\":\"Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "get", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212/versions" + }, + "response": { + "body": { + "string": "{\"data\":[{\"id\":\"e0cc7c1d-cbb6-589c-bcd9-d9c1b35aec60\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:13.145132Z\",\"prompt_id\":\"Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212\",\"prompt_uuid\":\"31fdf246-89b8-5a48-9544-ff84c4504939\",\"version\":1,\"version_created_at\":\"2026-07-20T09:20:13.145132Z\"}}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:12 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"31fdf246-89b8-5a48-9544-ff84c4504939\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:15.144489Z\",\"prompt_id\":\"Test-List_versions_of_an_LLM_Observability_prompt_returns_OK_response-1784539212\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:12 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen new file mode 100644 index 000000000..43f402180 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T10:29:38.039Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json new file mode 100644 index 000000000..27dd06124 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"env_ids\":[],\"labels\":[]},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt/versions/1" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt template version not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 10:29:38 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen new file mode 100644 index 000000000..c0ae65a3e --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T15:43:10.740Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.json new file mode 100644 index 000000000..901408e98 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-a-specific-LLM-Observability-prompt-version-returns-OK-response.json @@ -0,0 +1,163 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"3c7ea2ea-52df-5324-8e77-0f01cf441ef9\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T15:43:11.158625133Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T15:43:11.158625133Z\",\"num_versions\":1,\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:10 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"template\":[{\"content\":\"Hello v2\",\"role\":\"user\"}]},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190/versions" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c5593d94-81b0-522b-8cae-7fa643ea7ec9\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T15:43:12.623730838Z\",\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\",\"prompt_uuid\":\"3c7ea2ea-52df-5324-8e77-0f01cf441ef9\",\"template\":[{\"content\":\"Hello v2\",\"role\":\"user\"}],\"version\":2,\"version_created_at\":\"2026-07-20T15:43:12.623730838Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:10 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"description\":\"Give concise answers and cite relevant help-center articles.\"},\"type\":\"prompt-template-versions\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190/versions/2" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"c5593d94-81b0-522b-8cae-7fa643ea7ec9\",\"type\":\"prompt-template-versions\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T15:43:12.62373Z\",\"description\":\"Give concise answers and cite relevant help-center articles.\",\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\",\"prompt_uuid\":\"3c7ea2ea-52df-5324-8e77-0f01cf441ef9\",\"template\":[{\"role\":\"user\",\"content\":\"Hello v2\"}],\"version\":2,\"version_created_at\":\"2026-07-20T15:43:12.62373Z\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"3c7ea2ea-52df-5324-8e77-0f01cf441ef9\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T15:43:13.804223Z\",\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:10 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"3c7ea2ea-52df-5324-8e77-0f01cf441ef9\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T15:43:14.36251Z\",\"prompt_id\":\"Test-Update_a_specific_LLM_Observability_prompt_version_returns_OK_response-1784562190\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:10 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen new file mode 100644 index 000000000..30ae36893 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:18.946Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.json b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.json new file mode 100644 index 000000000..085401d56 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Bad-Request-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_Bad_Request_response-1784539218\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b28f22d5-eec8-57f0-be7f-5042b6bb4ae1\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T09:20:19.301545921Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T09:20:19.301545921Z\",\"num_versions\":1,\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_Bad_Request_response-1784539218\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:18 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_an_LLM_Observability_prompt_returns_Bad_Request_response-1784539218" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"at least one of title or description must be provided\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 400, + "message": "Bad Request" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:18 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_an_LLM_Observability_prompt_returns_Bad_Request_response-1784539218" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"b28f22d5-eec8-57f0-be7f-5042b6bb4ae1\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T09:20:20.235152Z\",\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_Bad_Request_response-1784539218\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:18 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.frozen new file mode 100644 index 000000000..989a21d45 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2026-07-20T09:20:20.319Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.json b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.json new file mode 100644 index 000000000..4b7970629 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-Not-Found-response.json @@ -0,0 +1,39 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"title\":\"New title\"},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/nonexistent-prompt" + }, + "response": { + "body": { + "string": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"prompt template not found\"}]}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 404, + "message": "Not Found" + } + }, + "recorded_at": "Mon, 20 Jul 2026 09:20:20 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.frozen b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.frozen new file mode 100644 index 000000000..9eed997d0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-07-20T15:43:14.374Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.json b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.json new file mode 100644 index 000000000..eff7315c0 --- /dev/null +++ b/tests/scenarios/cassettes/v2/llm_observability/Update-an-LLM-Observability-prompt-returns-OK-response.json @@ -0,0 +1,101 @@ +{ + "http_interactions": [ + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194\",\"template\":[{\"content\":\"Hello\",\"role\":\"user\"}]},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "post", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"a36505e7-3c2f-5482-b8ac-ac51250a0116\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T15:43:14.698626703Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"last_version_created_at\":\"2026-07-20T15:43:14.698626703Z\",\"num_versions\":1,\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194\",\"source\":\"registry\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:14 GMT" + }, + { + "request": { + "body": { + "string": "{\"data\":{\"attributes\":{\"title\":\"Customer Support Assistant\"},\"type\":\"prompt-templates\"}}", + "encoding": null + }, + "headers": { + "Accept": [ + "application/json" + ], + "Content-Type": [ + "application/json" + ] + }, + "method": "patch", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"a36505e7-3c2f-5482-b8ac-ac51250a0116\",\"type\":\"prompt-templates\",\"attributes\":{\"author\":\"c5e19e5a-ad6b-11ed-ab4f-927130d31ef9\",\"created_at\":\"2026-07-20T15:43:14.698626Z\",\"created_from\":\"sdk-registry\",\"in_registry\":true,\"num_versions\":0,\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194\",\"source\":\"registry\",\"title\":\"Customer Support Assistant\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:14 GMT" + }, + { + "request": { + "body": "", + "headers": { + "Accept": [ + "application/json" + ] + }, + "method": "delete", + "uri": "https://api.datadoghq.com/api/v2/llm-obs/v1/prompts/Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194" + }, + "response": { + "body": { + "string": "{\"data\":{\"id\":\"a36505e7-3c2f-5482-b8ac-ac51250a0116\",\"type\":\"prompt-templates\",\"attributes\":{\"deleted_at\":\"2026-07-20T15:43:16.39072Z\",\"prompt_id\":\"Test-Update_an_LLM_Observability_prompt_returns_OK_response-1784562194\"}}}", + "encoding": null + }, + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "status": { + "code": 200, + "message": "OK" + } + }, + "recorded_at": "Mon, 20 Jul 2026 15:43:14 GMT" + } + ], + "recorded_with": "VCR 6.0.0" +} \ No newline at end of file diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 75fa924ff..6f57cbefd 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -858,6 +858,34 @@ "tag": "IP Allowlist", "operationId": "UpdateIPAllowlist" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"prompt-templates\",\n \"attributes\": {\n \"prompt_id\": \"{{ unique }}\",\n \"template\": [{\"role\": \"user\", \"content\": \"Hello\"}]\n }\n }\n}" + } + ], + "step": "there is a valid \"prompt\" in the system", + "key": "prompt", + "tag": "LLM Observability", + "operationId": "CreateLLMObsPrompt" + }, + { + "parameters": [ + { + "name": "prompt_id", + "source": "prompt.data.attributes.prompt_id" + }, + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"prompt-template-versions\",\n \"attributes\": {\n \"template\": [{\"role\": \"user\", \"content\": \"Hello v2\"}]\n }\n }\n}" + } + ], + "step": "there is a valid \"prompt_version\" in the system", + "key": "prompt_version", + "tag": "LLM Observability", + "operationId": "CreateLLMObsPromptVersion" + }, { "parameters": [ { diff --git a/tests/scenarios/features/v2/llm_observability.feature b/tests/scenarios/features/v2/llm_observability.feature index 35e9592fa..2c23f9f6d 100644 --- a/tests/scenarios/features/v2/llm_observability.feature +++ b/tests/scenarios/features/v2/llm_observability.feature @@ -1,12 +1,12 @@ @endpoint(llm-observability) @endpoint(llm-observability-v2) Feature: LLM Observability Manage LLM Observability spans, data, projects, datasets, dataset records, - experiments, and annotations. + experiments, prompts, and annotations. Background: Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system And an instance of "LLMObservability" API + And a valid "appKeyAuth" key in the system @skip @team:DataDog/ml-observability Scenario: Add a display_block interaction returns "Created" response @@ -179,6 +179,35 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @team:DataDog/ml-observability + Scenario: Create a new LLM Observability prompt version returns "Bad Request" response + Given there is a valid "prompt" in the system + And operation "CreateLLMObsPromptVersion" enabled + And new "CreateLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And body with value {"data": {"attributes": {"template": " "}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ml-observability + Scenario: Create a new LLM Observability prompt version returns "Not Found" response + Given operation "CreateLLMObsPromptVersion" enabled + And new "CreateLLMObsPromptVersion" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + And body with value {"data": {"attributes": {"env_ids": [], "labels": [], "template": [{"content": "Hello v2", "role": "user"}]}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Create a new LLM Observability prompt version returns "OK" response + Given there is a valid "prompt" in the system + And operation "CreateLLMObsPromptVersion" enabled + And new "CreateLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And body with value {"data": {"attributes": {"template": [{"content": "You are a concise customer support assistant for {{ '{{company_name}}' }}.", "role": "system"}, {"content": "Answer {{ '{{customer_name}}' }}'s question: {{ '{{question}}' }}", "role": "user"}]}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Create an LLM Observability annotation queue returns "Bad Request" response Given operation "CreateLLMObsAnnotationQueue" enabled @@ -279,6 +308,31 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @team:DataDog/ml-observability + Scenario: Create an LLM Observability prompt returns "Bad Request" response + Given operation "CreateLLMObsPrompt" enabled + And new "CreateLLMObsPrompt" request + And body with value {"data": {"attributes": {"prompt_id": "{{ unique }}", "template": " "}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ml-observability + Scenario: Create an LLM Observability prompt returns "Conflict" response + Given there is a valid "prompt" in the system + And operation "CreateLLMObsPrompt" enabled + And new "CreateLLMObsPrompt" request + And body with value {"data": {"attributes": {"env_ids": [], "labels": [], "prompt_id": "{{ prompt.data.attributes.prompt_id }}", "template": [{"content": "Hello", "role": "user"}]}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/ml-observability + Scenario: Create an LLM Observability prompt returns "OK" response + Given operation "CreateLLMObsPrompt" enabled + And new "CreateLLMObsPrompt" request + And body with value {"data": {"attributes": {"prompt_id": "{{ unique }}", "title": "Customer Support Assistant", "template": [{"content": "You are a helpful customer support assistant for {{ '{{company_name}}' }}.", "role": "system"}, {"content": "Help {{ '{{customer_name}}' }} with this question: {{ '{{question}}' }}", "role": "user"}]}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Create or update a custom evaluator configuration returns "Bad Request" response Given operation "UpdateLLMObsCustomEvalConfig" enabled @@ -535,6 +589,23 @@ Feature: LLM Observability When the request is sent Then the response status is 404 Not Found + @team:DataDog/ml-observability + Scenario: Delete an LLM Observability prompt returns "Not Found" response + Given operation "DeleteLLMObsPrompt" enabled + And new "DeleteLLMObsPrompt" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Delete an LLM Observability prompt returns "OK" response + Given there is a valid "prompt" in the system + And operation "DeleteLLMObsPrompt" enabled + And new "DeleteLLMObsPrompt" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Delete annotation queue interactions returns "Bad Request" response Given operation "DeleteLLMObsAnnotationQueueInteractions" enabled @@ -688,6 +759,52 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: Get a specific LLM Observability prompt version returns "Bad Request" response + Given operation "GetLLMObsPromptVersion" enabled + And new "GetLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ml-observability + Scenario: Get a specific LLM Observability prompt version returns "Not Found" response + Given operation "GetLLMObsPromptVersion" enabled + And new "GetLLMObsPromptVersion" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + And request contains "version" parameter with value 1 + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Get a specific LLM Observability prompt version returns "OK" response + Given there is a valid "prompt" in the system + And there is a valid "prompt_version" in the system + And operation "GetLLMObsPromptVersion" enabled + And new "GetLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And request contains "version" parameter from "prompt_version.data.attributes.version" + When the request is sent + Then the response status is 200 OK + + @team:DataDog/ml-observability + Scenario: Get an LLM Observability prompt returns "Not Found" response + Given operation "GetLLMObsPrompt" enabled + And new "GetLLMObsPrompt" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Get an LLM Observability prompt returns "OK" response + Given there is a valid "prompt" in the system + And operation "GetLLMObsPrompt" enabled + And new "GetLLMObsPrompt" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Get annotated interactions by content IDs returns "Bad Request" response Given operation "GetLLMObsAnnotatedInteractionsByTraceIDs" enabled @@ -936,6 +1053,15 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @team:DataDog/ml-observability + Scenario: List LLM Observability prompts returns "OK" response + Given there is a valid "prompt" in the system + And operation "ListLLMObsPrompts" enabled + And new "ListLLMObsPrompts" request + And request contains "filter[prompt_id]" parameter from "prompt.data.attributes.prompt_id" + 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 @@ -1118,6 +1244,15 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @team:DataDog/ml-observability + Scenario: List versions of an LLM Observability prompt returns "OK" response + Given there is a valid "prompt" in the system + And operation "ListLLMObsPromptVersions" enabled + And new "ListLLMObsPromptVersions" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Lock LLM Observability dataset draft state returns "Bad Request" response Given operation "LockLLMObsDatasetDraftState" enabled @@ -1359,6 +1494,38 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability + Scenario: Update a specific LLM Observability prompt version returns "Bad Request" response + Given operation "UpdateLLMObsPromptVersion" enabled + And new "UpdateLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "REPLACE.ME" + And request contains "version" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"env_ids": [], "labels": ["production"]}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ml-observability + Scenario: Update a specific LLM Observability prompt version returns "Not Found" response + Given operation "UpdateLLMObsPromptVersion" enabled + And new "UpdateLLMObsPromptVersion" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + And request contains "version" parameter with value 1 + And body with value {"data": {"attributes": {"env_ids": [], "labels": []}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Update a specific LLM Observability prompt version returns "OK" response + Given there is a valid "prompt" in the system + And there is a valid "prompt_version" in the system + And operation "UpdateLLMObsPromptVersion" enabled + And new "UpdateLLMObsPromptVersion" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And request contains "version" parameter from "prompt_version.data.attributes.version" + And body with value {"data": {"attributes": {"description": "Give concise answers and cite relevant help-center articles."}, "type": "prompt-template-versions"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Update an LLM Observability annotation queue returns "Bad Request" response Given operation "UpdateLLMObsAnnotationQueue" enabled @@ -1470,6 +1637,35 @@ Feature: LLM Observability When the request is sent Then the response status is 200 OK + @team:DataDog/ml-observability + Scenario: Update an LLM Observability prompt returns "Bad Request" response + Given there is a valid "prompt" in the system + And operation "UpdateLLMObsPrompt" enabled + And new "UpdateLLMObsPrompt" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And body with value {"data": {"attributes": {}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/ml-observability + Scenario: Update an LLM Observability prompt returns "Not Found" response + Given operation "UpdateLLMObsPrompt" enabled + And new "UpdateLLMObsPrompt" request + And request contains "prompt_id" parameter with value "nonexistent-prompt" + And body with value {"data": {"attributes": {"title": "New title"}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/ml-observability + Scenario: Update an LLM Observability prompt returns "OK" response + Given there is a valid "prompt" in the system + And operation "UpdateLLMObsPrompt" enabled + And new "UpdateLLMObsPrompt" request + And request contains "prompt_id" parameter from "prompt.data.attributes.prompt_id" + And body with value {"data": {"attributes": {"title": "Customer Support Assistant"}, "type": "prompt-templates"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Update annotation queue label schema returns "Bad Request" response Given operation "UpdateLLMObsAnnotationQueueLabelSchema" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index f7316aecd..e72767d8e 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4555,6 +4555,74 @@ "type": "idempotent" } }, + "ListLLMObsPrompts": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "CreateLLMObsPrompt": { + "tag": "LLM Observability", + "undo": { + "operationId": "DeleteLLMObsPrompt", + "parameters": [ + { + "name": "prompt_id", + "source": "data.attributes.prompt_id" + } + ], + "type": "unsafe" + } + }, + "DeleteLLMObsPrompt": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, + "GetLLMObsPrompt": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "UpdateLLMObsPrompt": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, + "ListLLMObsPromptVersions": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "CreateLLMObsPromptVersion": { + "tag": "LLM Observability", + "undo": { + "operationId": "DeleteLLMObsPrompt", + "parameters": [ + { + "name": "prompt_id", + "source": "data.attributes.prompt_id" + } + ], + "type": "unsafe" + } + }, + "GetLLMObsPromptVersion": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "UpdateLLMObsPromptVersion": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, "ListLLMObsSpans": { "tag": "LLM Observability", "undo": { diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index 1b0593b3c..3f5c3795a 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -2497,6 +2497,40 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.UpdateLLMObsProject".into(), test_v2_update_llm_obs_project, ); + world + .function_mappings + .insert("v2.ListLLMObsPrompts".into(), test_v2_list_llm_obs_prompts); + world.function_mappings.insert( + "v2.CreateLLMObsPrompt".into(), + test_v2_create_llm_obs_prompt, + ); + world.function_mappings.insert( + "v2.DeleteLLMObsPrompt".into(), + test_v2_delete_llm_obs_prompt, + ); + world + .function_mappings + .insert("v2.GetLLMObsPrompt".into(), test_v2_get_llm_obs_prompt); + world.function_mappings.insert( + "v2.UpdateLLMObsPrompt".into(), + test_v2_update_llm_obs_prompt, + ); + world.function_mappings.insert( + "v2.ListLLMObsPromptVersions".into(), + test_v2_list_llm_obs_prompt_versions, + ); + world.function_mappings.insert( + "v2.CreateLLMObsPromptVersion".into(), + test_v2_create_llm_obs_prompt_version, + ); + world.function_mappings.insert( + "v2.GetLLMObsPromptVersion".into(), + test_v2_get_llm_obs_prompt_version, + ); + world.function_mappings.insert( + "v2.UpdateLLMObsPromptVersion".into(), + test_v2_update_llm_obs_prompt_version, + ); world .function_mappings .insert("v2.ListLLMObsSpans".into(), test_v2_list_llm_obs_spans); @@ -16532,6 +16566,261 @@ fn test_v2_update_llm_obs_project(world: &mut DatadogWorld, _parameters: &HashMa world.response.code = response.status.as_u16(); } +fn test_v2_list_llm_obs_prompts(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let filter_prompt_id = _parameters + .get("filter[prompt_id]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_llm_observability::ListLLMObsPromptsOptionalParams::default(); + params.filter_prompt_id = filter_prompt_id; + let response = match block_on(api.list_llm_obs_prompts_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_llm_obs_prompt(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_llm_obs_prompt_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_delete_llm_obs_prompt(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_llm_obs_prompt_with_http_info(prompt_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_llm_obs_prompt(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let label = _parameters + .get("label") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_llm_observability::GetLLMObsPromptOptionalParams::default(); + params.label = label; + let response = match block_on(api.get_llm_obs_prompt_with_http_info(prompt_id, params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_llm_obs_prompt(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.update_llm_obs_prompt_with_http_info(prompt_id, body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_llm_obs_prompt_versions( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let response = match block_on(api.list_llm_obs_prompt_versions_with_http_info(prompt_id)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_create_llm_obs_prompt_version( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_llm_obs_prompt_version_with_http_info(prompt_id, body)) + { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_get_llm_obs_prompt_version( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let version = serde_json::from_value(_parameters.get("version").unwrap().clone()).unwrap(); + let response = match block_on(api.get_llm_obs_prompt_version_with_http_info(prompt_id, version)) + { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_update_llm_obs_prompt_version( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_llm_observability + .as_ref() + .expect("api instance not found"); + let prompt_id = serde_json::from_value(_parameters.get("prompt_id").unwrap().clone()).unwrap(); + let version = serde_json::from_value(_parameters.get("version").unwrap().clone()).unwrap(); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on( + api.update_llm_obs_prompt_version_with_http_info(prompt_id, version, body), + ) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_list_llm_obs_spans(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances