diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0263793da4e..dd229dc55f7 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -796,6 +796,14 @@ components: required: true schema: type: string + LLMObsEvalNamePathParameter: + description: The name of the custom LLM Observability evaluator configuration. + example: "my-custom-evaluator" + in: path + name: eval_name + required: true + schema: + type: string LLMObsExperimentIDPathParameter: description: The ID of the LLM Observability experiment. example: "3fd6b5e0-8910-4b1c-a7d0-5b84de329012" @@ -38224,6 +38232,418 @@ components: nullable: true type: string type: object + LLMObsCustomEvalConfigAssessmentCriteria: + description: Criteria used to assess the pass/fail result of a custom evaluator. + properties: + max_threshold: + description: Maximum numeric threshold for a passing result. + example: 1.0 + format: double + nullable: true + type: number + min_threshold: + description: Minimum numeric threshold for a passing result. + example: 0.7 + format: double + nullable: true + type: number + pass_values: + description: Specific output values considered as a passing result. + example: + - "pass" + - "yes" + items: + description: A value considered as a passing result. + type: string + nullable: true + type: array + pass_when: + description: When true, a boolean output of true is treated as passing. + example: true + nullable: true + type: boolean + type: object + LLMObsCustomEvalConfigAttributes: + description: Attributes of a custom LLM Observability evaluator configuration. + properties: + category: + description: Category of the evaluator. + example: "Custom" + type: string + created_at: + description: Timestamp when the evaluator configuration was created. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + created_by: + $ref: "#/components/schemas/LLMObsCustomEvalConfigUser" + eval_name: + description: Name of the custom evaluator. + example: "my-custom-evaluator" + type: string + last_updated_by: + $ref: "#/components/schemas/LLMObsCustomEvalConfigUser" + llm_judge_config: + $ref: "#/components/schemas/LLMObsCustomEvalConfigLLMJudgeConfig" + llm_provider: + $ref: "#/components/schemas/LLMObsCustomEvalConfigLLMProvider" + target: + $ref: "#/components/schemas/LLMObsCustomEvalConfigTarget" + updated_at: + description: Timestamp when the evaluator configuration was last updated. + example: "2024-01-15T10:30:00Z" + format: date-time + type: string + required: + - eval_name + - created_at + - updated_at + type: object + LLMObsCustomEvalConfigBedrockOptions: + description: AWS Bedrock-specific options for LLM provider configuration. + properties: + region: + description: AWS region for Bedrock. + example: "us-east-1" + type: string + type: object + LLMObsCustomEvalConfigData: + description: Data object for a custom LLM Observability evaluator configuration. + properties: + attributes: + $ref: "#/components/schemas/LLMObsCustomEvalConfigAttributes" + id: + description: Unique name identifier of the evaluator configuration. + example: "my-custom-evaluator" + type: string + type: + $ref: "#/components/schemas/LLMObsCustomEvalConfigType" + required: + - id + - type + - attributes + type: object + LLMObsCustomEvalConfigEvalScope: + description: Scope at which to evaluate spans. + enum: + - span + - trace + - session + example: "span" + type: string + x-enum-varnames: + - SPAN + - TRACE + - SESSION + LLMObsCustomEvalConfigInferenceParams: + description: LLM inference parameters for a custom evaluator. + properties: + frequency_penalty: + description: Frequency penalty to reduce repetition. + example: 0.0 + format: double + type: number + max_tokens: + description: Maximum number of tokens to generate. + example: 1024 + format: int64 + type: integer + presence_penalty: + description: Presence penalty to reduce repetition. + example: 0.0 + format: double + type: number + temperature: + description: Sampling temperature for the LLM. + example: 0.7 + format: double + type: number + top_k: + description: Top-k sampling parameter. + example: 50 + format: int64 + type: integer + top_p: + description: Top-p (nucleus) sampling parameter. + example: 1.0 + format: double + type: number + type: object + LLMObsCustomEvalConfigIntegrationProvider: + description: Name of the LLM integration provider. + enum: + - openai + - amazon-bedrock + - anthropic + - azure-openai + - vertex-ai + - llm-proxy + example: "openai" + type: string + x-enum-varnames: + - OPENAI + - AMAZON_BEDROCK + - ANTHROPIC + - AZURE_OPENAI + - VERTEX_AI + - LLM_PROXY + LLMObsCustomEvalConfigLLMJudgeConfig: + description: LLM judge configuration for a custom evaluator. + properties: + assessment_criteria: + $ref: "#/components/schemas/LLMObsCustomEvalConfigAssessmentCriteria" + inference_params: + $ref: "#/components/schemas/LLMObsCustomEvalConfigInferenceParams" + last_used_library_prompt_template_name: + description: Name of the last library prompt template used. + example: "sentiment-analysis-v1" + nullable: true + type: string + modified_library_prompt_template: + description: Whether the library prompt template was modified. + example: false + nullable: true + type: boolean + output_schema: + additionalProperties: {} + description: JSON schema describing the expected output format of the LLM judge. + nullable: true + type: object + parsing_type: + $ref: "#/components/schemas/LLMObsCustomEvalConfigParsingType" + prompt_template: + description: List of messages forming the LLM judge prompt template. + items: + $ref: "#/components/schemas/LLMObsCustomEvalConfigPromptMessage" + type: array + required: + - inference_params + type: object + LLMObsCustomEvalConfigLLMProvider: + description: LLM provider configuration for a custom evaluator. + properties: + bedrock: + $ref: "#/components/schemas/LLMObsCustomEvalConfigBedrockOptions" + integration_account_id: + description: Integration account identifier. + example: "my-account-id" + type: string + integration_provider: + $ref: "#/components/schemas/LLMObsCustomEvalConfigIntegrationProvider" + model_name: + description: Name of the LLM model. + example: "gpt-4o" + type: string + vertex_ai: + $ref: "#/components/schemas/LLMObsCustomEvalConfigVertexAIOptions" + type: object + LLMObsCustomEvalConfigParsingType: + description: Output parsing type for a custom LLM judge evaluator. + enum: + - structured_output + - json + example: "structured_output" + type: string + x-enum-varnames: + - STRUCTURED_OUTPUT + - JSON + LLMObsCustomEvalConfigPromptContent: + description: A content block within a prompt message. + properties: + type: + description: Content block type. + example: "text" + type: string + value: + $ref: "#/components/schemas/LLMObsCustomEvalConfigPromptContentValue" + required: + - type + - value + type: object + LLMObsCustomEvalConfigPromptContentValue: + description: Value of a prompt message content block. + properties: + text: + description: Text content of the message block. + example: "What is the sentiment of this review?" + type: string + tool_call: + $ref: "#/components/schemas/LLMObsCustomEvalConfigPromptToolCall" + tool_call_result: + $ref: "#/components/schemas/LLMObsCustomEvalConfigPromptToolResult" + type: object + LLMObsCustomEvalConfigPromptMessage: + description: A message in the prompt template for a custom LLM judge evaluator. + properties: + content: + description: Text content of the message. + example: "Rate the quality of the following response:" + type: string + contents: + description: Multi-part content blocks for the message. + items: + $ref: "#/components/schemas/LLMObsCustomEvalConfigPromptContent" + type: array + role: + description: Role of the message author. + example: "user" + type: string + required: + - role + type: object + LLMObsCustomEvalConfigPromptToolCall: + description: A tool call within a prompt message. + properties: + arguments: + description: JSON-encoded arguments for the tool call. + example: '{"location": "San Francisco"}' + type: string + id: + description: Unique identifier of the tool call. + example: "call_abc123" + type: string + name: + description: Name of the tool being called. + example: "get_weather" + type: string + type: + description: Type of the tool call. + example: "function" + type: string + type: object + LLMObsCustomEvalConfigPromptToolResult: + description: A tool call result within a prompt message. + properties: + name: + description: Name of the tool that produced this result. + example: "get_weather" + type: string + result: + description: The result returned by the tool. + example: "sunny, 72F" + type: string + tool_id: + description: Identifier of the tool call this result corresponds to. + example: "call_abc123" + type: string + type: + description: Type of the tool result. + example: "function" + type: string + type: object + LLMObsCustomEvalConfigResponse: + description: Response containing a custom LLM Observability evaluator configuration. + properties: + data: + $ref: "#/components/schemas/LLMObsCustomEvalConfigData" + required: + - data + type: object + LLMObsCustomEvalConfigTarget: + description: Target application configuration for a custom evaluator. + properties: + application_name: + description: Name of the ML application this evaluator targets. + example: "my-llm-app" + type: string + enabled: + description: Whether the evaluator is active for the target application. + example: true + type: boolean + eval_scope: + $ref: "#/components/schemas/LLMObsCustomEvalConfigEvalScope" + nullable: true + filter: + description: Filter expression to select which spans to evaluate. + example: "@service:my-service" + nullable: true + type: string + root_spans_only: + description: When true, only root spans are evaluated. + example: true + nullable: true + type: boolean + sampling_percentage: + description: Percentage of traces to evaluate. Must be greater than 0 and at most 100. + example: 50.0 + format: double + nullable: true + type: number + required: + - application_name + - enabled + type: object + LLMObsCustomEvalConfigType: + description: Type of the custom LLM Observability evaluator configuration resource. + enum: + - evaluator_config + example: "evaluator_config" + type: string + x-enum-varnames: + - EVALUATOR_CONFIG + LLMObsCustomEvalConfigUpdateAttributes: + description: Attributes for creating or updating a custom LLM Observability evaluator configuration. + properties: + category: + description: Category of the evaluator. + example: "Custom" + type: string + eval_name: + description: Name of the custom evaluator. If provided, must match the eval_name path parameter. + example: "my-custom-evaluator" + type: string + llm_judge_config: + $ref: "#/components/schemas/LLMObsCustomEvalConfigLLMJudgeConfig" + llm_provider: + $ref: "#/components/schemas/LLMObsCustomEvalConfigLLMProvider" + target: + $ref: "#/components/schemas/LLMObsCustomEvalConfigTarget" + required: + - target + type: object + LLMObsCustomEvalConfigUpdateData: + description: Data object for creating or updating a custom LLM Observability evaluator configuration. + properties: + attributes: + $ref: "#/components/schemas/LLMObsCustomEvalConfigUpdateAttributes" + id: + description: Name of the evaluator. If provided, must match the eval_name path parameter. + example: "my-custom-evaluator" + type: string + type: + $ref: "#/components/schemas/LLMObsCustomEvalConfigType" + required: + - type + - attributes + type: object + LLMObsCustomEvalConfigUpdateRequest: + description: Request to create or update a custom LLM Observability evaluator configuration. + properties: + data: + $ref: "#/components/schemas/LLMObsCustomEvalConfigUpdateData" + required: + - data + type: object + LLMObsCustomEvalConfigUser: + description: A Datadog user associated with a custom evaluator configuration. + properties: + email: + description: Email address of the user. + example: "user@example.com" + type: string + type: object + LLMObsCustomEvalConfigVertexAIOptions: + description: Google Vertex AI-specific options for LLM provider configuration. + properties: + location: + description: Google Cloud region. + example: "us-central1" + type: string + project: + description: Google Cloud project ID. + example: "my-gcp-project" + type: string + type: object LLMObsDatasetDataAttributesRequest: description: Attributes for creating an LLM Observability dataset. properties: @@ -64154,6 +64574,38 @@ components: type: string x-enum-varnames: - SIGNAL + SecurityMonitoringSignalUpdateAttributes: + description: Attributes for updating the triage state or assignee of a security signal. + properties: + archive_comment: + $ref: "#/components/schemas/SecurityMonitoringSignalArchiveComment" + archive_reason: + $ref: "#/components/schemas/SecurityMonitoringSignalArchiveReason" + assignee: + $ref: "#/components/schemas/SecurityMonitoringTriageUser" + state: + $ref: "#/components/schemas/SecurityMonitoringSignalState" + version: + $ref: "#/components/schemas/SecurityMonitoringSignalVersion" + type: object + SecurityMonitoringSignalUpdateData: + description: Data containing the triage state or assignee update for a security signal. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringSignalUpdateAttributes" + type: + $ref: "#/components/schemas/SecurityMonitoringSignalMetadataType" + required: + - attributes + type: object + SecurityMonitoringSignalUpdateRequest: + description: Request body for updating the triage state or assignee of a security signal. + properties: + data: + $ref: "#/components/schemas/SecurityMonitoringSignalUpdateData" + required: + - data + type: object SecurityMonitoringSignalVersion: description: Version of the updated signal. If server side version is higher, update will be rejected. format: int64 @@ -64307,6 +64759,33 @@ components: - count - events type: object + SecurityMonitoringSignalsBulkUpdateData: + description: Data for updating a single security signal in a bulk update operation. + properties: + attributes: + $ref: "#/components/schemas/SecurityMonitoringSignalUpdateAttributes" + id: + description: The unique ID of the security signal. + example: AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA + type: string + type: + $ref: "#/components/schemas/SecurityMonitoringSignalType" + required: + - id + - attributes + type: object + SecurityMonitoringSignalsBulkUpdateRequest: + description: Request body for updating multiple attributes of multiple security signals. + properties: + data: + description: An array of signal updates. + items: + $ref: "#/components/schemas/SecurityMonitoringSignalsBulkUpdateData" + maxItems: 199 + type: array + required: + - data + type: object SecurityMonitoringSignalsListResponse: description: "The response object with all security signals matching the request\nand pagination information." properties: @@ -80902,6 +81381,237 @@ paths: x-unstable: |- This endpoint is in Preview and may introduce breaking changes. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/unstable/llm-obs/config/evaluators/custom/{eval_name}: + delete: + description: Delete a custom LLM Observability evaluator configuration by its name. + operationId: DeleteLLMObsCustomEvalConfig + parameters: + - $ref: "#/components/parameters/LLMObsEvalNamePathParameter" + 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 + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Delete a custom evaluator configuration + 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/). + get: + description: Retrieve a custom LLM Observability evaluator configuration by its name. + operationId: GetLLMObsCustomEvalConfig + parameters: + - $ref: "#/components/parameters/LLMObsEvalNamePathParameter" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + category: "Custom" + created_at: "2024-01-15T10:30:00Z" + created_by: + email: "user@example.com" + eval_name: "my-custom-evaluator" + last_updated_by: + email: "user@example.com" + llm_judge_config: + inference_params: + max_tokens: 1024 + temperature: 0.7 + parsing_type: "structured_output" + llm_provider: + integration_provider: "openai" + model_name: "gpt-4o" + target: + application_name: "my-llm-app" + enabled: true + sampling_percentage: 50.0 + updated_at: "2024-01-15T10:30:00Z" + id: "my-custom-evaluator" + type: "evaluator_config" + schema: + $ref: "#/components/schemas/LLMObsCustomEvalConfigResponse" + 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: Get a custom evaluator configuration + 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/). + put: + description: Create or update a custom LLM Observability evaluator configuration by its name. + operationId: UpdateLLMObsCustomEvalConfig + parameters: + - $ref: "#/components/parameters/LLMObsEvalNamePathParameter" + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + llm_judge_config: + inference_params: + max_tokens: 1024 + temperature: 0.7 + parsing_type: "structured_output" + llm_provider: + integration_provider: "openai" + model_name: "gpt-4o" + target: + application_name: "my-llm-app" + enabled: true + sampling_percentage: 50.0 + id: "my-custom-evaluator" + type: "evaluator_config" + full: + summary: Full example with prompt template, output schema, and assessment criteria + value: + data: + attributes: + category: "Custom" + eval_name: "my-custom-evaluator" + llm_judge_config: + assessment_criteria: + pass_when: false + inference_params: + frequency_penalty: 0 + max_tokens: 4096 + presence_penalty: 0 + temperature: 1 + top_p: 1 + output_schema: + name: "boolean_eval" + strict: true + parsing_type: "structured_output" + prompt_template: + - content: "You are a judge LLM." + role: "system" + - content: "{{span_output}}" + role: "user" + llm_provider: + integration_account_id: "your-account-uuid" + integration_provider: "openai" + model_name: "gpt-4o" + target: + application_name: "my-llm-app" + enabled: true + eval_scope: "span" + filter: "@meta.span.kind:llm" + root_spans_only: false + sampling_percentage: 100 + id: "my-custom-evaluator" + type: "evaluator_config" + schema: + $ref: "#/components/schemas/LLMObsCustomEvalConfigUpdateRequest" + description: Custom evaluator configuration payload. + required: true + responses: + "200": + 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 + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create or update a custom evaluator configuration + 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/actions-datastores: get: description: Lists all datastores for the organization. @@ -118882,6 +119592,51 @@ paths: operator: OR permissions: - security_monitoring_signals_write + /api/v2/security_monitoring/signals/bulk/update: + patch: + description: |- + Update the triage state or assignee of multiple security signals at once. + The maximum number of signals that can be updated in a single request is 199. + operationId: BulkEditSecurityMonitoringSignals + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SecurityMonitoringSignalsBulkUpdateRequest" + description: Attributes describing the signal updates. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SecurityMonitoringSignalsBulkTriageUpdateResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: [] + summary: Bulk update security signals + tags: ["Security Monitoring"] + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_signals_write /api/v2/security_monitoring/signals/search: post: description: |- @@ -119204,6 +119959,58 @@ paths: permissions: - security_monitoring_rules_read - security_monitoring_signals_read + /api/v2/security_monitoring/signals/{signal_id}/update: + patch: + description: |- + Update the triage state or assignee of a security signal. + operationId: EditSecurityMonitoringSignal + parameters: + - $ref: "#/components/parameters/SignalID" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/SecurityMonitoringSignalUpdateRequest" + description: Attributes describing the signal triage state or assignee update. + required: true + responses: + "200": + content: + application/json: + schema: + $ref: "#/components/schemas/SecurityMonitoringSignalTriageUpdateResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "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: [] + - AuthZ: [] + summary: Update security signal triage state or assignee + tags: ["Security Monitoring"] + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_signals_write /api/v2/security_monitoring/terraform/{resource_type}/bulk: post: description: |- diff --git a/.github/workflows/reusable-examples.yml b/.github/workflows/reusable-examples.yml index e88a426fb7f..09a69fcc1df 100644 --- a/.github/workflows/reusable-examples.yml +++ b/.github/workflows/reusable-examples.yml @@ -10,8 +10,26 @@ on: default: '' jobs: - examples: + prepare: runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.split.outputs.matrix }} + steps: + - uses: actions/checkout@v3 + with: + repository: DataDog/datadog-api-client-go + ref: ${{ inputs.target-branch || github.ref }} + - name: Compute example groups + id: split + run: ./scripts/prepare-examples.sh + shell: bash + + build: + needs: prepare + runs-on: ubuntu-latest + strategy: + matrix: + group: ${{ fromJson(needs.prepare.outputs.matrix) }} steps: - uses: actions/checkout@v3 with: @@ -23,6 +41,6 @@ jobs: go-version: 1.22.x cache: true cache-dependency-path: tests/go.sum - - name: Check examples - run: ./check-examples.sh - shell: bash \ No newline at end of file + - name: Build examples (group ${{ matrix.group }}) + run: ./scripts/build-examples-group.sh ${{ matrix.group }} + shell: bash diff --git a/.github/workflows/reusable-go-test.yml b/.github/workflows/reusable-go-test.yml index fb992d01b7e..3b6734ceb3f 100644 --- a/.github/workflows/reusable-go-test.yml +++ b/.github/workflows/reusable-go-test.yml @@ -21,6 +21,37 @@ on: required: false jobs: + staticcheck: + strategy: + matrix: + go-version: ["1.22.x", "1.23.x"] + go-build-tags: ["--tags=goccy_gojson", ""] + platform: ["ubuntu-latest"] + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + repository: DataDog/datadog-api-client-go + ref: ${{ inputs.target-branch || github.ref }} + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + cache: true + cache-dependency-path: tests/go.sum + - name: Staticcheck (api module) + uses: dominikh/staticcheck-action@v1 + with: + checks: "-SA1009" + working-directory: api + cache-key: ${{ matrix.go }} + - name: Staticcheck (tests module) + uses: dominikh/staticcheck-action@v1 + with: + checks: "inherit,-SA1019" + cache-key: ${{ matrix.go }} + working-directory: tests test: strategy: matrix: @@ -41,7 +72,7 @@ jobs: cache: true cache-dependency-path: tests/go.sum - name: Test - run: ./run-tests.sh + run: ./scripts/run-tests.sh env: TESTARGS: ${{ matrix.go-build-tags }} diff --git a/.github/workflows/reusable-integration-test.yml b/.github/workflows/reusable-integration-test.yml index 761868c3422..8bc11c785b8 100644 --- a/.github/workflows/reusable-integration-test.yml +++ b/.github/workflows/reusable-integration-test.yml @@ -111,7 +111,7 @@ jobs: cache-dependency-path: tests/go.sum - name: Run integration tests shell: bash - run: ./run-tests.sh + run: ./scripts/run-tests.sh env: CI: "true" DD_AGENT_HOST: localhost diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 5539aed4873..31a81e73467 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -667,6 +667,33 @@ func NewConfiguration() *Configuration { "v2.ListFleetTracers": false, "v2.TriggerFleetSchedule": false, "v2.UpdateFleetSchedule": false, + "v2.CreateLLMObsAnnotationQueue": false, + "v2.CreateLLMObsAnnotationQueueInteractions": false, + "v2.CreateLLMObsDataset": false, + "v2.CreateLLMObsDatasetRecords": false, + "v2.CreateLLMObsExperiment": false, + "v2.CreateLLMObsExperimentEvents": false, + "v2.CreateLLMObsProject": false, + "v2.DeleteLLMObsAnnotationQueue": false, + "v2.DeleteLLMObsAnnotationQueueInteractions": false, + "v2.DeleteLLMObsCustomEvalConfig": false, + "v2.DeleteLLMObsDatasetRecords": false, + "v2.DeleteLLMObsDatasets": false, + "v2.DeleteLLMObsExperiments": false, + "v2.DeleteLLMObsProjects": false, + "v2.GetLLMObsAnnotatedInteractions": false, + "v2.GetLLMObsCustomEvalConfig": false, + "v2.ListLLMObsAnnotationQueues": false, + "v2.ListLLMObsDatasetRecords": false, + "v2.ListLLMObsDatasets": false, + "v2.ListLLMObsExperiments": false, + "v2.ListLLMObsProjects": false, + "v2.UpdateLLMObsAnnotationQueue": false, + "v2.UpdateLLMObsCustomEvalConfig": false, + "v2.UpdateLLMObsDataset": false, + "v2.UpdateLLMObsDatasetRecords": false, + "v2.UpdateLLMObsExperiment": false, + "v2.UpdateLLMObsProject": false, "v2.CreateOpenAPI": false, "v2.DeleteOpenAPI": false, "v2.GetOpenAPI": false, @@ -820,30 +847,6 @@ func NewConfiguration() *Configuration { "v2.UpdateJiraIssueTemplate": false, "v2.CreateTenancyConfig": false, "v2.GetTenancyConfigs": false, - "v2.CreateLLMObsAnnotationQueue": false, - "v2.CreateLLMObsAnnotationQueueInteractions": false, - "v2.CreateLLMObsDataset": false, - "v2.CreateLLMObsDatasetRecords": false, - "v2.CreateLLMObsExperiment": false, - "v2.CreateLLMObsExperimentEvents": false, - "v2.CreateLLMObsProject": false, - "v2.DeleteLLMObsAnnotationQueue": false, - "v2.DeleteLLMObsAnnotationQueueInteractions": false, - "v2.DeleteLLMObsDatasetRecords": false, - "v2.DeleteLLMObsDatasets": false, - "v2.DeleteLLMObsExperiments": false, - "v2.DeleteLLMObsProjects": false, - "v2.GetLLMObsAnnotatedInteractions": false, - "v2.ListLLMObsAnnotationQueues": false, - "v2.ListLLMObsDatasetRecords": false, - "v2.ListLLMObsDatasets": false, - "v2.ListLLMObsExperiments": false, - "v2.ListLLMObsProjects": false, - "v2.UpdateLLMObsAnnotationQueue": false, - "v2.UpdateLLMObsDataset": false, - "v2.UpdateLLMObsDatasetRecords": false, - "v2.UpdateLLMObsExperiment": false, - "v2.UpdateLLMObsProject": false, "v2.AddRoleToRestrictionQuery": false, "v2.CreateRestrictionQuery": false, "v2.DeleteRestrictionQuery": false, diff --git a/api/datadogV2/api_llm_observability.go b/api/datadogV2/api_llm_observability.go index e7660f31580..65d826d4f5c 100644 --- a/api/datadogV2/api_llm_observability.go +++ b/api/datadogV2/api_llm_observability.go @@ -876,6 +876,92 @@ func (a *LLMObservabilityApi) DeleteLLMObsAnnotationQueueInteractions(ctx _conte return localVarHTTPResponse, nil } +// DeleteLLMObsCustomEvalConfig Delete a custom evaluator configuration. +// Delete a custom LLM Observability evaluator configuration by its name. +func (a *LLMObservabilityApi) DeleteLLMObsCustomEvalConfig(ctx _context.Context, evalName string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteLLMObsCustomEvalConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LLMObservabilityApi.DeleteLLMObsCustomEvalConfig") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/llm-obs/config/evaluators/custom/{eval_name}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{eval_name}", _neturl.PathEscape(datadog.ParameterToString(evalName, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // DeleteLLMObsDatasetRecords Delete LLM Observability dataset records. // Delete one or more records from an LLM Observability dataset. func (a *LLMObservabilityApi) DeleteLLMObsDatasetRecords(ctx _context.Context, projectId string, datasetId string, body LLMObsDeleteDatasetRecordsRequest) (*_nethttp.Response, error) { @@ -1327,6 +1413,102 @@ func (a *LLMObservabilityApi) GetLLMObsAnnotatedInteractions(ctx _context.Contex return localVarReturnValue, localVarHTTPResponse, nil } +// GetLLMObsCustomEvalConfig Get a custom evaluator configuration. +// Retrieve a custom LLM Observability evaluator configuration by its name. +func (a *LLMObservabilityApi) GetLLMObsCustomEvalConfig(ctx _context.Context, evalName string) (LLMObsCustomEvalConfigResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue LLMObsCustomEvalConfigResponse + ) + + operationId := "v2.GetLLMObsCustomEvalConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LLMObservabilityApi.GetLLMObsCustomEvalConfig") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/llm-obs/config/evaluators/custom/{eval_name}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{eval_name}", _neturl.PathEscape(datadog.ParameterToString(evalName, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // ListLLMObsAnnotationQueuesOptionalParameters holds optional parameters for ListLLMObsAnnotationQueues. type ListLLMObsAnnotationQueuesOptionalParameters struct { ProjectId *string @@ -2183,6 +2365,95 @@ func (a *LLMObservabilityApi) UpdateLLMObsAnnotationQueue(ctx _context.Context, return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateLLMObsCustomEvalConfig Create or update a custom evaluator configuration. +// Create or update a custom LLM Observability evaluator configuration by its name. +func (a *LLMObservabilityApi) UpdateLLMObsCustomEvalConfig(ctx _context.Context, evalName string, body LLMObsCustomEvalConfigUpdateRequest) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + ) + + operationId := "v2.UpdateLLMObsCustomEvalConfig" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LLMObservabilityApi.UpdateLLMObsCustomEvalConfig") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/unstable/llm-obs/config/evaluators/custom/{eval_name}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{eval_name}", _neturl.PathEscape(datadog.ParameterToString(evalName, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 401 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 422 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // UpdateLLMObsDataset Update an LLM Observability dataset. // Partially update an existing LLM Observability dataset within the specified project. func (a *LLMObservabilityApi) UpdateLLMObsDataset(ctx _context.Context, projectId string, datasetId string, body LLMObsDatasetUpdateRequest) (LLMObsDatasetResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/api_security_monitoring.go b/api/datadogV2/api_security_monitoring.go index 8f24b304a5d..1955be167ba 100644 --- a/api/datadogV2/api_security_monitoring.go +++ b/api/datadogV2/api_security_monitoring.go @@ -271,6 +271,96 @@ func (a *SecurityMonitoringApi) AttachJiraIssue(ctx _context.Context, body Attac return localVarReturnValue, localVarHTTPResponse, nil } +// BulkEditSecurityMonitoringSignals Bulk update security signals. +// Update the triage state or assignee of multiple security signals at once. +// The maximum number of signals that can be updated in a single request is 199. +func (a *SecurityMonitoringApi) BulkEditSecurityMonitoringSignals(ctx _context.Context, body SecurityMonitoringSignalsBulkUpdateRequest) (SecurityMonitoringSignalsBulkTriageUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalsBulkTriageUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.BulkEditSecurityMonitoringSignals") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/bulk/update" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // BulkEditSecurityMonitoringSignalsAssignee Bulk update triage assignee of security signals. // Change the triage assignees of multiple security signals at once. // The maximum number of signals that can be updated in a single request is 199. @@ -2475,6 +2565,96 @@ func (a *SecurityMonitoringApi) DetachCase(ctx _context.Context, body DetachCase return localVarHTTPResponse, nil } +// EditSecurityMonitoringSignal Update security signal triage state or assignee. +// Update the triage state or assignee of a security signal. +func (a *SecurityMonitoringApi) EditSecurityMonitoringSignal(ctx _context.Context, signalId string, body SecurityMonitoringSignalUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue SecurityMonitoringSignalTriageUpdateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.EditSecurityMonitoringSignal") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/security_monitoring/signals/{signal_id}/update" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{signal_id}", _neturl.PathEscape(datadog.ParameterToString(signalId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 { + var v JSONAPIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // EditSecurityMonitoringSignalAssignee Modify the triage assignee of a security signal. // Modify the triage assignee of a security signal. func (a *SecurityMonitoringApi) EditSecurityMonitoringSignalAssignee(ctx _context.Context, signalId string, body SecurityMonitoringSignalAssigneeUpdateRequest) (SecurityMonitoringSignalTriageUpdateResponse, *_nethttp.Response, error) { diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index fa222586b42..fc087c10d58 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -455,17 +455,20 @@ // - [LLMObservabilityApi.CreateLLMObsProject] // - [LLMObservabilityApi.DeleteLLMObsAnnotationQueue] // - [LLMObservabilityApi.DeleteLLMObsAnnotationQueueInteractions] +// - [LLMObservabilityApi.DeleteLLMObsCustomEvalConfig] // - [LLMObservabilityApi.DeleteLLMObsDatasetRecords] // - [LLMObservabilityApi.DeleteLLMObsDatasets] // - [LLMObservabilityApi.DeleteLLMObsExperiments] // - [LLMObservabilityApi.DeleteLLMObsProjects] // - [LLMObservabilityApi.GetLLMObsAnnotatedInteractions] +// - [LLMObservabilityApi.GetLLMObsCustomEvalConfig] // - [LLMObservabilityApi.ListLLMObsAnnotationQueues] // - [LLMObservabilityApi.ListLLMObsDatasetRecords] // - [LLMObservabilityApi.ListLLMObsDatasets] // - [LLMObservabilityApi.ListLLMObsExperiments] // - [LLMObservabilityApi.ListLLMObsProjects] // - [LLMObservabilityApi.UpdateLLMObsAnnotationQueue] +// - [LLMObservabilityApi.UpdateLLMObsCustomEvalConfig] // - [LLMObservabilityApi.UpdateLLMObsDataset] // - [LLMObservabilityApi.UpdateLLMObsDatasetRecords] // - [LLMObservabilityApi.UpdateLLMObsExperiment] @@ -731,6 +734,7 @@ // - [SecurityMonitoringApi.ActivateContentPack] // - [SecurityMonitoringApi.AttachCase] // - [SecurityMonitoringApi.AttachJiraIssue] +// - [SecurityMonitoringApi.BulkEditSecurityMonitoringSignals] // - [SecurityMonitoringApi.BulkEditSecurityMonitoringSignalsAssignee] // - [SecurityMonitoringApi.BulkEditSecurityMonitoringSignalsState] // - [SecurityMonitoringApi.BulkExportSecurityMonitoringRules] @@ -759,6 +763,7 @@ // - [SecurityMonitoringApi.DeleteSignalNotificationRule] // - [SecurityMonitoringApi.DeleteVulnerabilityNotificationRule] // - [SecurityMonitoringApi.DetachCase] +// - [SecurityMonitoringApi.EditSecurityMonitoringSignal] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalAssignee] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalIncidents] // - [SecurityMonitoringApi.EditSecurityMonitoringSignalState] diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_assessment_criteria.go b/api/datadogV2/model_llm_obs_custom_eval_config_assessment_criteria.go new file mode 100644 index 00000000000..649271d3562 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_assessment_criteria.go @@ -0,0 +1,251 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigAssessmentCriteria Criteria used to assess the pass/fail result of a custom evaluator. +type LLMObsCustomEvalConfigAssessmentCriteria struct { + // Maximum numeric threshold for a passing result. + MaxThreshold datadog.NullableFloat64 `json:"max_threshold,omitempty"` + // Minimum numeric threshold for a passing result. + MinThreshold datadog.NullableFloat64 `json:"min_threshold,omitempty"` + // Specific output values considered as a passing result. + PassValues datadog.NullableList[string] `json:"pass_values,omitempty"` + // When true, a boolean output of true is treated as passing. + PassWhen datadog.NullableBool `json:"pass_when,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigAssessmentCriteria instantiates a new LLMObsCustomEvalConfigAssessmentCriteria object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigAssessmentCriteria() *LLMObsCustomEvalConfigAssessmentCriteria { + this := LLMObsCustomEvalConfigAssessmentCriteria{} + return &this +} + +// NewLLMObsCustomEvalConfigAssessmentCriteriaWithDefaults instantiates a new LLMObsCustomEvalConfigAssessmentCriteria object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigAssessmentCriteriaWithDefaults() *LLMObsCustomEvalConfigAssessmentCriteria { + this := LLMObsCustomEvalConfigAssessmentCriteria{} + return &this +} + +// GetMaxThreshold returns the MaxThreshold field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetMaxThreshold() float64 { + if o == nil || o.MaxThreshold.Get() == nil { + var ret float64 + return ret + } + return *o.MaxThreshold.Get() +} + +// GetMaxThresholdOk returns a tuple with the MaxThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetMaxThresholdOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.MaxThreshold.Get(), o.MaxThreshold.IsSet() +} + +// HasMaxThreshold returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) HasMaxThreshold() bool { + return o != nil && o.MaxThreshold.IsSet() +} + +// SetMaxThreshold gets a reference to the given datadog.NullableFloat64 and assigns it to the MaxThreshold field. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetMaxThreshold(v float64) { + o.MaxThreshold.Set(&v) +} + +// SetMaxThresholdNil sets the value for MaxThreshold to be an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetMaxThresholdNil() { + o.MaxThreshold.Set(nil) +} + +// UnsetMaxThreshold ensures that no value is present for MaxThreshold, not even an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) UnsetMaxThreshold() { + o.MaxThreshold.Unset() +} + +// GetMinThreshold returns the MinThreshold field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetMinThreshold() float64 { + if o == nil || o.MinThreshold.Get() == nil { + var ret float64 + return ret + } + return *o.MinThreshold.Get() +} + +// GetMinThresholdOk returns a tuple with the MinThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetMinThresholdOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.MinThreshold.Get(), o.MinThreshold.IsSet() +} + +// HasMinThreshold returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) HasMinThreshold() bool { + return o != nil && o.MinThreshold.IsSet() +} + +// SetMinThreshold gets a reference to the given datadog.NullableFloat64 and assigns it to the MinThreshold field. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetMinThreshold(v float64) { + o.MinThreshold.Set(&v) +} + +// SetMinThresholdNil sets the value for MinThreshold to be an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetMinThresholdNil() { + o.MinThreshold.Set(nil) +} + +// UnsetMinThreshold ensures that no value is present for MinThreshold, not even an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) UnsetMinThreshold() { + o.MinThreshold.Unset() +} + +// GetPassValues returns the PassValues field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetPassValues() []string { + if o == nil || o.PassValues.Get() == nil { + var ret []string + return ret + } + return *o.PassValues.Get() +} + +// GetPassValuesOk returns a tuple with the PassValues field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetPassValuesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + return o.PassValues.Get(), o.PassValues.IsSet() +} + +// HasPassValues returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) HasPassValues() bool { + return o != nil && o.PassValues.IsSet() +} + +// SetPassValues gets a reference to the given datadog.NullableList[string] and assigns it to the PassValues field. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetPassValues(v []string) { + o.PassValues.Set(&v) +} + +// SetPassValuesNil sets the value for PassValues to be an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetPassValuesNil() { + o.PassValues.Set(nil) +} + +// UnsetPassValues ensures that no value is present for PassValues, not even an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) UnsetPassValues() { + o.PassValues.Unset() +} + +// GetPassWhen returns the PassWhen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetPassWhen() bool { + if o == nil || o.PassWhen.Get() == nil { + var ret bool + return ret + } + return *o.PassWhen.Get() +} + +// GetPassWhenOk returns a tuple with the PassWhen field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) GetPassWhenOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.PassWhen.Get(), o.PassWhen.IsSet() +} + +// HasPassWhen returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) HasPassWhen() bool { + return o != nil && o.PassWhen.IsSet() +} + +// SetPassWhen gets a reference to the given datadog.NullableBool and assigns it to the PassWhen field. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetPassWhen(v bool) { + o.PassWhen.Set(&v) +} + +// SetPassWhenNil sets the value for PassWhen to be an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) SetPassWhenNil() { + o.PassWhen.Set(nil) +} + +// UnsetPassWhen ensures that no value is present for PassWhen, not even an explicit nil. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) UnsetPassWhen() { + o.PassWhen.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigAssessmentCriteria) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.MaxThreshold.IsSet() { + toSerialize["max_threshold"] = o.MaxThreshold.Get() + } + if o.MinThreshold.IsSet() { + toSerialize["min_threshold"] = o.MinThreshold.Get() + } + if o.PassValues.IsSet() { + toSerialize["pass_values"] = o.PassValues.Get() + } + if o.PassWhen.IsSet() { + toSerialize["pass_when"] = o.PassWhen.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigAssessmentCriteria) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + MaxThreshold datadog.NullableFloat64 `json:"max_threshold,omitempty"` + MinThreshold datadog.NullableFloat64 `json:"min_threshold,omitempty"` + PassValues datadog.NullableList[string] `json:"pass_values,omitempty"` + PassWhen datadog.NullableBool `json:"pass_when,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"max_threshold", "min_threshold", "pass_values", "pass_when"}) + } else { + return err + } + o.MaxThreshold = all.MaxThreshold + o.MinThreshold = all.MinThreshold + o.PassValues = all.PassValues + o.PassWhen = all.PassWhen + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_attributes.go b/api/datadogV2/model_llm_obs_custom_eval_config_attributes.go new file mode 100644 index 00000000000..c0e7881a2de --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_attributes.go @@ -0,0 +1,405 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigAttributes Attributes of a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigAttributes struct { + // Category of the evaluator. + Category *string `json:"category,omitempty"` + // Timestamp when the evaluator configuration was created. + CreatedAt time.Time `json:"created_at"` + // A Datadog user associated with a custom evaluator configuration. + CreatedBy *LLMObsCustomEvalConfigUser `json:"created_by,omitempty"` + // Name of the custom evaluator. + EvalName string `json:"eval_name"` + // A Datadog user associated with a custom evaluator configuration. + LastUpdatedBy *LLMObsCustomEvalConfigUser `json:"last_updated_by,omitempty"` + // LLM judge configuration for a custom evaluator. + LlmJudgeConfig *LLMObsCustomEvalConfigLLMJudgeConfig `json:"llm_judge_config,omitempty"` + // LLM provider configuration for a custom evaluator. + LlmProvider *LLMObsCustomEvalConfigLLMProvider `json:"llm_provider,omitempty"` + // Target application configuration for a custom evaluator. + Target *LLMObsCustomEvalConfigTarget `json:"target,omitempty"` + // Timestamp when the evaluator configuration was last updated. + UpdatedAt time.Time `json:"updated_at"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigAttributes instantiates a new LLMObsCustomEvalConfigAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigAttributes(createdAt time.Time, evalName string, updatedAt time.Time) *LLMObsCustomEvalConfigAttributes { + this := LLMObsCustomEvalConfigAttributes{} + this.CreatedAt = createdAt + this.EvalName = evalName + this.UpdatedAt = updatedAt + return &this +} + +// NewLLMObsCustomEvalConfigAttributesWithDefaults instantiates a new LLMObsCustomEvalConfigAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigAttributesWithDefaults() *LLMObsCustomEvalConfigAttributes { + this := LLMObsCustomEvalConfigAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetCategory() string { + if o == nil || o.Category == nil { + var ret string + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetCategoryOk() (*string, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasCategory() bool { + return o != nil && o.Category != nil +} + +// SetCategory gets a reference to the given string and assigns it to the Category field. +func (o *LLMObsCustomEvalConfigAttributes) SetCategory(v string) { + o.Category = &v +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *LLMObsCustomEvalConfigAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *LLMObsCustomEvalConfigAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetCreatedBy() LLMObsCustomEvalConfigUser { + if o == nil || o.CreatedBy == nil { + var ret LLMObsCustomEvalConfigUser + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetCreatedByOk() (*LLMObsCustomEvalConfigUser, bool) { + if o == nil || o.CreatedBy == nil { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasCreatedBy() bool { + return o != nil && o.CreatedBy != nil +} + +// SetCreatedBy gets a reference to the given LLMObsCustomEvalConfigUser and assigns it to the CreatedBy field. +func (o *LLMObsCustomEvalConfigAttributes) SetCreatedBy(v LLMObsCustomEvalConfigUser) { + o.CreatedBy = &v +} + +// GetEvalName returns the EvalName field value. +func (o *LLMObsCustomEvalConfigAttributes) GetEvalName() string { + if o == nil { + var ret string + return ret + } + return o.EvalName +} + +// GetEvalNameOk returns a tuple with the EvalName field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetEvalNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EvalName, true +} + +// SetEvalName sets field value. +func (o *LLMObsCustomEvalConfigAttributes) SetEvalName(v string) { + o.EvalName = v +} + +// GetLastUpdatedBy returns the LastUpdatedBy field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetLastUpdatedBy() LLMObsCustomEvalConfigUser { + if o == nil || o.LastUpdatedBy == nil { + var ret LLMObsCustomEvalConfigUser + return ret + } + return *o.LastUpdatedBy +} + +// GetLastUpdatedByOk returns a tuple with the LastUpdatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetLastUpdatedByOk() (*LLMObsCustomEvalConfigUser, bool) { + if o == nil || o.LastUpdatedBy == nil { + return nil, false + } + return o.LastUpdatedBy, true +} + +// HasLastUpdatedBy returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasLastUpdatedBy() bool { + return o != nil && o.LastUpdatedBy != nil +} + +// SetLastUpdatedBy gets a reference to the given LLMObsCustomEvalConfigUser and assigns it to the LastUpdatedBy field. +func (o *LLMObsCustomEvalConfigAttributes) SetLastUpdatedBy(v LLMObsCustomEvalConfigUser) { + o.LastUpdatedBy = &v +} + +// GetLlmJudgeConfig returns the LlmJudgeConfig field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetLlmJudgeConfig() LLMObsCustomEvalConfigLLMJudgeConfig { + if o == nil || o.LlmJudgeConfig == nil { + var ret LLMObsCustomEvalConfigLLMJudgeConfig + return ret + } + return *o.LlmJudgeConfig +} + +// GetLlmJudgeConfigOk returns a tuple with the LlmJudgeConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetLlmJudgeConfigOk() (*LLMObsCustomEvalConfigLLMJudgeConfig, bool) { + if o == nil || o.LlmJudgeConfig == nil { + return nil, false + } + return o.LlmJudgeConfig, true +} + +// HasLlmJudgeConfig returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasLlmJudgeConfig() bool { + return o != nil && o.LlmJudgeConfig != nil +} + +// SetLlmJudgeConfig gets a reference to the given LLMObsCustomEvalConfigLLMJudgeConfig and assigns it to the LlmJudgeConfig field. +func (o *LLMObsCustomEvalConfigAttributes) SetLlmJudgeConfig(v LLMObsCustomEvalConfigLLMJudgeConfig) { + o.LlmJudgeConfig = &v +} + +// GetLlmProvider returns the LlmProvider field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetLlmProvider() LLMObsCustomEvalConfigLLMProvider { + if o == nil || o.LlmProvider == nil { + var ret LLMObsCustomEvalConfigLLMProvider + return ret + } + return *o.LlmProvider +} + +// GetLlmProviderOk returns a tuple with the LlmProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetLlmProviderOk() (*LLMObsCustomEvalConfigLLMProvider, bool) { + if o == nil || o.LlmProvider == nil { + return nil, false + } + return o.LlmProvider, true +} + +// HasLlmProvider returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasLlmProvider() bool { + return o != nil && o.LlmProvider != nil +} + +// SetLlmProvider gets a reference to the given LLMObsCustomEvalConfigLLMProvider and assigns it to the LlmProvider field. +func (o *LLMObsCustomEvalConfigAttributes) SetLlmProvider(v LLMObsCustomEvalConfigLLMProvider) { + o.LlmProvider = &v +} + +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigAttributes) GetTarget() LLMObsCustomEvalConfigTarget { + if o == nil || o.Target == nil { + var ret LLMObsCustomEvalConfigTarget + return ret + } + return *o.Target +} + +// GetTargetOk returns a tuple with the Target field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetTargetOk() (*LLMObsCustomEvalConfigTarget, bool) { + if o == nil || o.Target == nil { + return nil, false + } + return o.Target, true +} + +// HasTarget returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigAttributes) HasTarget() bool { + return o != nil && o.Target != nil +} + +// SetTarget gets a reference to the given LLMObsCustomEvalConfigTarget and assigns it to the Target field. +func (o *LLMObsCustomEvalConfigAttributes) SetTarget(v LLMObsCustomEvalConfigTarget) { + o.Target = &v +} + +// GetUpdatedAt returns the UpdatedAt field value. +func (o *LLMObsCustomEvalConfigAttributes) GetUpdatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigAttributes) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value. +func (o *LLMObsCustomEvalConfigAttributes) SetUpdatedAt(v time.Time) { + o.UpdatedAt = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + if o.CreatedBy != nil { + toSerialize["created_by"] = o.CreatedBy + } + toSerialize["eval_name"] = o.EvalName + if o.LastUpdatedBy != nil { + toSerialize["last_updated_by"] = o.LastUpdatedBy + } + if o.LlmJudgeConfig != nil { + toSerialize["llm_judge_config"] = o.LlmJudgeConfig + } + if o.LlmProvider != nil { + toSerialize["llm_provider"] = o.LlmProvider + } + if o.Target != nil { + toSerialize["target"] = o.Target + } + if o.UpdatedAt.Nanosecond() == 0 { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["updated_at"] = o.UpdatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Category *string `json:"category,omitempty"` + CreatedAt *time.Time `json:"created_at"` + CreatedBy *LLMObsCustomEvalConfigUser `json:"created_by,omitempty"` + EvalName *string `json:"eval_name"` + LastUpdatedBy *LLMObsCustomEvalConfigUser `json:"last_updated_by,omitempty"` + LlmJudgeConfig *LLMObsCustomEvalConfigLLMJudgeConfig `json:"llm_judge_config,omitempty"` + LlmProvider *LLMObsCustomEvalConfigLLMProvider `json:"llm_provider,omitempty"` + Target *LLMObsCustomEvalConfigTarget `json:"target,omitempty"` + UpdatedAt *time.Time `json:"updated_at"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.EvalName == nil { + return fmt.Errorf("required field eval_name missing") + } + if all.UpdatedAt == nil { + return fmt.Errorf("required field updated_at missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"category", "created_at", "created_by", "eval_name", "last_updated_by", "llm_judge_config", "llm_provider", "target", "updated_at"}) + } else { + return err + } + + hasInvalidField := false + o.Category = all.Category + o.CreatedAt = *all.CreatedAt + if all.CreatedBy != nil && all.CreatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.CreatedBy = all.CreatedBy + o.EvalName = *all.EvalName + if all.LastUpdatedBy != nil && all.LastUpdatedBy.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LastUpdatedBy = all.LastUpdatedBy + if all.LlmJudgeConfig != nil && all.LlmJudgeConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LlmJudgeConfig = all.LlmJudgeConfig + if all.LlmProvider != nil && all.LlmProvider.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LlmProvider = all.LlmProvider + if all.Target != nil && all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Target = all.Target + o.UpdatedAt = *all.UpdatedAt + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_bedrock_options.go b/api/datadogV2/model_llm_obs_custom_eval_config_bedrock_options.go new file mode 100644 index 00000000000..0453632a496 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_bedrock_options.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigBedrockOptions AWS Bedrock-specific options for LLM provider configuration. +type LLMObsCustomEvalConfigBedrockOptions struct { + // AWS region for Bedrock. + Region *string `json:"region,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigBedrockOptions instantiates a new LLMObsCustomEvalConfigBedrockOptions object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigBedrockOptions() *LLMObsCustomEvalConfigBedrockOptions { + this := LLMObsCustomEvalConfigBedrockOptions{} + return &this +} + +// NewLLMObsCustomEvalConfigBedrockOptionsWithDefaults instantiates a new LLMObsCustomEvalConfigBedrockOptions object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigBedrockOptionsWithDefaults() *LLMObsCustomEvalConfigBedrockOptions { + this := LLMObsCustomEvalConfigBedrockOptions{} + return &this +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigBedrockOptions) GetRegion() string { + if o == nil || o.Region == nil { + var ret string + return ret + } + return *o.Region +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigBedrockOptions) GetRegionOk() (*string, bool) { + if o == nil || o.Region == nil { + return nil, false + } + return o.Region, true +} + +// HasRegion returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigBedrockOptions) HasRegion() bool { + return o != nil && o.Region != nil +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *LLMObsCustomEvalConfigBedrockOptions) SetRegion(v string) { + o.Region = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigBedrockOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Region != nil { + toSerialize["region"] = o.Region + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigBedrockOptions) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Region *string `json:"region,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"region"}) + } else { + return err + } + o.Region = all.Region + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_data.go b/api/datadogV2/model_llm_obs_custom_eval_config_data.go new file mode 100644 index 00000000000..6a1db2eec34 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_data.go @@ -0,0 +1,178 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigData Data object for a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigData struct { + // Attributes of a custom LLM Observability evaluator configuration. + Attributes LLMObsCustomEvalConfigAttributes `json:"attributes"` + // Unique name identifier of the evaluator configuration. + Id string `json:"id"` + // Type of the custom LLM Observability evaluator configuration resource. + Type LLMObsCustomEvalConfigType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigData instantiates a new LLMObsCustomEvalConfigData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigData(attributes LLMObsCustomEvalConfigAttributes, id string, typeVar LLMObsCustomEvalConfigType) *LLMObsCustomEvalConfigData { + this := LLMObsCustomEvalConfigData{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewLLMObsCustomEvalConfigDataWithDefaults instantiates a new LLMObsCustomEvalConfigData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigDataWithDefaults() *LLMObsCustomEvalConfigData { + this := LLMObsCustomEvalConfigData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *LLMObsCustomEvalConfigData) GetAttributes() LLMObsCustomEvalConfigAttributes { + if o == nil { + var ret LLMObsCustomEvalConfigAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigData) GetAttributesOk() (*LLMObsCustomEvalConfigAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *LLMObsCustomEvalConfigData) SetAttributes(v LLMObsCustomEvalConfigAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *LLMObsCustomEvalConfigData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *LLMObsCustomEvalConfigData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *LLMObsCustomEvalConfigData) GetType() LLMObsCustomEvalConfigType { + if o == nil { + var ret LLMObsCustomEvalConfigType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigData) GetTypeOk() (*LLMObsCustomEvalConfigType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LLMObsCustomEvalConfigData) SetType(v LLMObsCustomEvalConfigType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *LLMObsCustomEvalConfigAttributes `json:"attributes"` + Id *string `json:"id"` + Type *LLMObsCustomEvalConfigType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_eval_scope.go b/api/datadogV2/model_llm_obs_custom_eval_config_eval_scope.go new file mode 100644 index 00000000000..cb701fcb9b9 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_eval_scope.go @@ -0,0 +1,68 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigEvalScope Scope at which to evaluate spans. +type LLMObsCustomEvalConfigEvalScope string + +// List of LLMObsCustomEvalConfigEvalScope. +const ( + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_SPAN LLMObsCustomEvalConfigEvalScope = "span" + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_TRACE LLMObsCustomEvalConfigEvalScope = "trace" + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_SESSION LLMObsCustomEvalConfigEvalScope = "session" +) + +var allowedLLMObsCustomEvalConfigEvalScopeEnumValues = []LLMObsCustomEvalConfigEvalScope{ + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_SPAN, + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_TRACE, + LLMOBSCUSTOMEVALCONFIGEVALSCOPE_SESSION, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LLMObsCustomEvalConfigEvalScope) GetAllowedValues() []LLMObsCustomEvalConfigEvalScope { + return allowedLLMObsCustomEvalConfigEvalScopeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LLMObsCustomEvalConfigEvalScope) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LLMObsCustomEvalConfigEvalScope(value) + return nil +} + +// NewLLMObsCustomEvalConfigEvalScopeFromValue returns a pointer to a valid LLMObsCustomEvalConfigEvalScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLLMObsCustomEvalConfigEvalScopeFromValue(v string) (*LLMObsCustomEvalConfigEvalScope, error) { + ev := LLMObsCustomEvalConfigEvalScope(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LLMObsCustomEvalConfigEvalScope: valid values are %v", v, allowedLLMObsCustomEvalConfigEvalScopeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LLMObsCustomEvalConfigEvalScope) IsValid() bool { + for _, existing := range allowedLLMObsCustomEvalConfigEvalScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LLMObsCustomEvalConfigEvalScope value. +func (v LLMObsCustomEvalConfigEvalScope) Ptr() *LLMObsCustomEvalConfigEvalScope { + return &v +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_inference_params.go b/api/datadogV2/model_llm_obs_custom_eval_config_inference_params.go new file mode 100644 index 00000000000..23611f39325 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_inference_params.go @@ -0,0 +1,277 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigInferenceParams LLM inference parameters for a custom evaluator. +type LLMObsCustomEvalConfigInferenceParams struct { + // Frequency penalty to reduce repetition. + FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"` + // Maximum number of tokens to generate. + MaxTokens *int64 `json:"max_tokens,omitempty"` + // Presence penalty to reduce repetition. + PresencePenalty *float64 `json:"presence_penalty,omitempty"` + // Sampling temperature for the LLM. + Temperature *float64 `json:"temperature,omitempty"` + // Top-k sampling parameter. + TopK *int64 `json:"top_k,omitempty"` + // Top-p (nucleus) sampling parameter. + TopP *float64 `json:"top_p,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigInferenceParams instantiates a new LLMObsCustomEvalConfigInferenceParams object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigInferenceParams() *LLMObsCustomEvalConfigInferenceParams { + this := LLMObsCustomEvalConfigInferenceParams{} + return &this +} + +// NewLLMObsCustomEvalConfigInferenceParamsWithDefaults instantiates a new LLMObsCustomEvalConfigInferenceParams object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigInferenceParamsWithDefaults() *LLMObsCustomEvalConfigInferenceParams { + this := LLMObsCustomEvalConfigInferenceParams{} + return &this +} + +// GetFrequencyPenalty returns the FrequencyPenalty field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetFrequencyPenalty() float64 { + if o == nil || o.FrequencyPenalty == nil { + var ret float64 + return ret + } + return *o.FrequencyPenalty +} + +// GetFrequencyPenaltyOk returns a tuple with the FrequencyPenalty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetFrequencyPenaltyOk() (*float64, bool) { + if o == nil || o.FrequencyPenalty == nil { + return nil, false + } + return o.FrequencyPenalty, true +} + +// HasFrequencyPenalty returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasFrequencyPenalty() bool { + return o != nil && o.FrequencyPenalty != nil +} + +// SetFrequencyPenalty gets a reference to the given float64 and assigns it to the FrequencyPenalty field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetFrequencyPenalty(v float64) { + o.FrequencyPenalty = &v +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetMaxTokens() int64 { + if o == nil || o.MaxTokens == nil { + var ret int64 + return ret + } + return *o.MaxTokens +} + +// GetMaxTokensOk returns a tuple with the MaxTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetMaxTokensOk() (*int64, bool) { + if o == nil || o.MaxTokens == nil { + return nil, false + } + return o.MaxTokens, true +} + +// HasMaxTokens returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasMaxTokens() bool { + return o != nil && o.MaxTokens != nil +} + +// SetMaxTokens gets a reference to the given int64 and assigns it to the MaxTokens field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetMaxTokens(v int64) { + o.MaxTokens = &v +} + +// GetPresencePenalty returns the PresencePenalty field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetPresencePenalty() float64 { + if o == nil || o.PresencePenalty == nil { + var ret float64 + return ret + } + return *o.PresencePenalty +} + +// GetPresencePenaltyOk returns a tuple with the PresencePenalty field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetPresencePenaltyOk() (*float64, bool) { + if o == nil || o.PresencePenalty == nil { + return nil, false + } + return o.PresencePenalty, true +} + +// HasPresencePenalty returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasPresencePenalty() bool { + return o != nil && o.PresencePenalty != nil +} + +// SetPresencePenalty gets a reference to the given float64 and assigns it to the PresencePenalty field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetPresencePenalty(v float64) { + o.PresencePenalty = &v +} + +// GetTemperature returns the Temperature field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTemperature() float64 { + if o == nil || o.Temperature == nil { + var ret float64 + return ret + } + return *o.Temperature +} + +// GetTemperatureOk returns a tuple with the Temperature field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTemperatureOk() (*float64, bool) { + if o == nil || o.Temperature == nil { + return nil, false + } + return o.Temperature, true +} + +// HasTemperature returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasTemperature() bool { + return o != nil && o.Temperature != nil +} + +// SetTemperature gets a reference to the given float64 and assigns it to the Temperature field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetTemperature(v float64) { + o.Temperature = &v +} + +// GetTopK returns the TopK field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTopK() int64 { + if o == nil || o.TopK == nil { + var ret int64 + return ret + } + return *o.TopK +} + +// GetTopKOk returns a tuple with the TopK field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTopKOk() (*int64, bool) { + if o == nil || o.TopK == nil { + return nil, false + } + return o.TopK, true +} + +// HasTopK returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasTopK() bool { + return o != nil && o.TopK != nil +} + +// SetTopK gets a reference to the given int64 and assigns it to the TopK field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetTopK(v int64) { + o.TopK = &v +} + +// GetTopP returns the TopP field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTopP() float64 { + if o == nil || o.TopP == nil { + var ret float64 + return ret + } + return *o.TopP +} + +// GetTopPOk returns a tuple with the TopP field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) GetTopPOk() (*float64, bool) { + if o == nil || o.TopP == nil { + return nil, false + } + return o.TopP, true +} + +// HasTopP returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigInferenceParams) HasTopP() bool { + return o != nil && o.TopP != nil +} + +// SetTopP gets a reference to the given float64 and assigns it to the TopP field. +func (o *LLMObsCustomEvalConfigInferenceParams) SetTopP(v float64) { + o.TopP = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigInferenceParams) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.FrequencyPenalty != nil { + toSerialize["frequency_penalty"] = o.FrequencyPenalty + } + if o.MaxTokens != nil { + toSerialize["max_tokens"] = o.MaxTokens + } + if o.PresencePenalty != nil { + toSerialize["presence_penalty"] = o.PresencePenalty + } + if o.Temperature != nil { + toSerialize["temperature"] = o.Temperature + } + if o.TopK != nil { + toSerialize["top_k"] = o.TopK + } + if o.TopP != nil { + toSerialize["top_p"] = o.TopP + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigInferenceParams) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FrequencyPenalty *float64 `json:"frequency_penalty,omitempty"` + MaxTokens *int64 `json:"max_tokens,omitempty"` + PresencePenalty *float64 `json:"presence_penalty,omitempty"` + Temperature *float64 `json:"temperature,omitempty"` + TopK *int64 `json:"top_k,omitempty"` + TopP *float64 `json:"top_p,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"frequency_penalty", "max_tokens", "presence_penalty", "temperature", "top_k", "top_p"}) + } else { + return err + } + o.FrequencyPenalty = all.FrequencyPenalty + o.MaxTokens = all.MaxTokens + o.PresencePenalty = all.PresencePenalty + o.Temperature = all.Temperature + o.TopK = all.TopK + o.TopP = all.TopP + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_integration_provider.go b/api/datadogV2/model_llm_obs_custom_eval_config_integration_provider.go new file mode 100644 index 00000000000..b27090ea5d2 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_integration_provider.go @@ -0,0 +1,74 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigIntegrationProvider Name of the LLM integration provider. +type LLMObsCustomEvalConfigIntegrationProvider string + +// List of LLMObsCustomEvalConfigIntegrationProvider. +const ( + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_OPENAI LLMObsCustomEvalConfigIntegrationProvider = "openai" + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_AMAZON_BEDROCK LLMObsCustomEvalConfigIntegrationProvider = "amazon-bedrock" + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_ANTHROPIC LLMObsCustomEvalConfigIntegrationProvider = "anthropic" + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_AZURE_OPENAI LLMObsCustomEvalConfigIntegrationProvider = "azure-openai" + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_VERTEX_AI LLMObsCustomEvalConfigIntegrationProvider = "vertex-ai" + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_LLM_PROXY LLMObsCustomEvalConfigIntegrationProvider = "llm-proxy" +) + +var allowedLLMObsCustomEvalConfigIntegrationProviderEnumValues = []LLMObsCustomEvalConfigIntegrationProvider{ + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_OPENAI, + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_AMAZON_BEDROCK, + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_ANTHROPIC, + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_AZURE_OPENAI, + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_VERTEX_AI, + LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_LLM_PROXY, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LLMObsCustomEvalConfigIntegrationProvider) GetAllowedValues() []LLMObsCustomEvalConfigIntegrationProvider { + return allowedLLMObsCustomEvalConfigIntegrationProviderEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LLMObsCustomEvalConfigIntegrationProvider) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LLMObsCustomEvalConfigIntegrationProvider(value) + return nil +} + +// NewLLMObsCustomEvalConfigIntegrationProviderFromValue returns a pointer to a valid LLMObsCustomEvalConfigIntegrationProvider +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLLMObsCustomEvalConfigIntegrationProviderFromValue(v string) (*LLMObsCustomEvalConfigIntegrationProvider, error) { + ev := LLMObsCustomEvalConfigIntegrationProvider(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LLMObsCustomEvalConfigIntegrationProvider: valid values are %v", v, allowedLLMObsCustomEvalConfigIntegrationProviderEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LLMObsCustomEvalConfigIntegrationProvider) IsValid() bool { + for _, existing := range allowedLLMObsCustomEvalConfigIntegrationProviderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LLMObsCustomEvalConfigIntegrationProvider value. +func (v LLMObsCustomEvalConfigIntegrationProvider) Ptr() *LLMObsCustomEvalConfigIntegrationProvider { + return &v +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_llm_judge_config.go b/api/datadogV2/model_llm_obs_custom_eval_config_llm_judge_config.go new file mode 100644 index 00000000000..a0b1b01a579 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_llm_judge_config.go @@ -0,0 +1,350 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigLLMJudgeConfig LLM judge configuration for a custom evaluator. +type LLMObsCustomEvalConfigLLMJudgeConfig struct { + // Criteria used to assess the pass/fail result of a custom evaluator. + AssessmentCriteria *LLMObsCustomEvalConfigAssessmentCriteria `json:"assessment_criteria,omitempty"` + // LLM inference parameters for a custom evaluator. + InferenceParams LLMObsCustomEvalConfigInferenceParams `json:"inference_params"` + // Name of the last library prompt template used. + LastUsedLibraryPromptTemplateName datadog.NullableString `json:"last_used_library_prompt_template_name,omitempty"` + // Whether the library prompt template was modified. + ModifiedLibraryPromptTemplate datadog.NullableBool `json:"modified_library_prompt_template,omitempty"` + // JSON schema describing the expected output format of the LLM judge. + OutputSchema map[string]interface{} `json:"output_schema,omitempty"` + // Output parsing type for a custom LLM judge evaluator. + ParsingType *LLMObsCustomEvalConfigParsingType `json:"parsing_type,omitempty"` + // List of messages forming the LLM judge prompt template. + PromptTemplate []LLMObsCustomEvalConfigPromptMessage `json:"prompt_template,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigLLMJudgeConfig instantiates a new LLMObsCustomEvalConfigLLMJudgeConfig object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigLLMJudgeConfig(inferenceParams LLMObsCustomEvalConfigInferenceParams) *LLMObsCustomEvalConfigLLMJudgeConfig { + this := LLMObsCustomEvalConfigLLMJudgeConfig{} + this.InferenceParams = inferenceParams + return &this +} + +// NewLLMObsCustomEvalConfigLLMJudgeConfigWithDefaults instantiates a new LLMObsCustomEvalConfigLLMJudgeConfig object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigLLMJudgeConfigWithDefaults() *LLMObsCustomEvalConfigLLMJudgeConfig { + this := LLMObsCustomEvalConfigLLMJudgeConfig{} + return &this +} + +// GetAssessmentCriteria returns the AssessmentCriteria field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetAssessmentCriteria() LLMObsCustomEvalConfigAssessmentCriteria { + if o == nil || o.AssessmentCriteria == nil { + var ret LLMObsCustomEvalConfigAssessmentCriteria + return ret + } + return *o.AssessmentCriteria +} + +// GetAssessmentCriteriaOk returns a tuple with the AssessmentCriteria field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetAssessmentCriteriaOk() (*LLMObsCustomEvalConfigAssessmentCriteria, bool) { + if o == nil || o.AssessmentCriteria == nil { + return nil, false + } + return o.AssessmentCriteria, true +} + +// HasAssessmentCriteria returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasAssessmentCriteria() bool { + return o != nil && o.AssessmentCriteria != nil +} + +// SetAssessmentCriteria gets a reference to the given LLMObsCustomEvalConfigAssessmentCriteria and assigns it to the AssessmentCriteria field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetAssessmentCriteria(v LLMObsCustomEvalConfigAssessmentCriteria) { + o.AssessmentCriteria = &v +} + +// GetInferenceParams returns the InferenceParams field value. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetInferenceParams() LLMObsCustomEvalConfigInferenceParams { + if o == nil { + var ret LLMObsCustomEvalConfigInferenceParams + return ret + } + return o.InferenceParams +} + +// GetInferenceParamsOk returns a tuple with the InferenceParams field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetInferenceParamsOk() (*LLMObsCustomEvalConfigInferenceParams, bool) { + if o == nil { + return nil, false + } + return &o.InferenceParams, true +} + +// SetInferenceParams sets field value. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetInferenceParams(v LLMObsCustomEvalConfigInferenceParams) { + o.InferenceParams = v +} + +// GetLastUsedLibraryPromptTemplateName returns the LastUsedLibraryPromptTemplateName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetLastUsedLibraryPromptTemplateName() string { + if o == nil || o.LastUsedLibraryPromptTemplateName.Get() == nil { + var ret string + return ret + } + return *o.LastUsedLibraryPromptTemplateName.Get() +} + +// GetLastUsedLibraryPromptTemplateNameOk returns a tuple with the LastUsedLibraryPromptTemplateName field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetLastUsedLibraryPromptTemplateNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastUsedLibraryPromptTemplateName.Get(), o.LastUsedLibraryPromptTemplateName.IsSet() +} + +// HasLastUsedLibraryPromptTemplateName returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasLastUsedLibraryPromptTemplateName() bool { + return o != nil && o.LastUsedLibraryPromptTemplateName.IsSet() +} + +// SetLastUsedLibraryPromptTemplateName gets a reference to the given datadog.NullableString and assigns it to the LastUsedLibraryPromptTemplateName field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetLastUsedLibraryPromptTemplateName(v string) { + o.LastUsedLibraryPromptTemplateName.Set(&v) +} + +// SetLastUsedLibraryPromptTemplateNameNil sets the value for LastUsedLibraryPromptTemplateName to be an explicit nil. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetLastUsedLibraryPromptTemplateNameNil() { + o.LastUsedLibraryPromptTemplateName.Set(nil) +} + +// UnsetLastUsedLibraryPromptTemplateName ensures that no value is present for LastUsedLibraryPromptTemplateName, not even an explicit nil. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) UnsetLastUsedLibraryPromptTemplateName() { + o.LastUsedLibraryPromptTemplateName.Unset() +} + +// GetModifiedLibraryPromptTemplate returns the ModifiedLibraryPromptTemplate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetModifiedLibraryPromptTemplate() bool { + if o == nil || o.ModifiedLibraryPromptTemplate.Get() == nil { + var ret bool + return ret + } + return *o.ModifiedLibraryPromptTemplate.Get() +} + +// GetModifiedLibraryPromptTemplateOk returns a tuple with the ModifiedLibraryPromptTemplate field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetModifiedLibraryPromptTemplateOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.ModifiedLibraryPromptTemplate.Get(), o.ModifiedLibraryPromptTemplate.IsSet() +} + +// HasModifiedLibraryPromptTemplate returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasModifiedLibraryPromptTemplate() bool { + return o != nil && o.ModifiedLibraryPromptTemplate.IsSet() +} + +// SetModifiedLibraryPromptTemplate gets a reference to the given datadog.NullableBool and assigns it to the ModifiedLibraryPromptTemplate field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetModifiedLibraryPromptTemplate(v bool) { + o.ModifiedLibraryPromptTemplate.Set(&v) +} + +// SetModifiedLibraryPromptTemplateNil sets the value for ModifiedLibraryPromptTemplate to be an explicit nil. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetModifiedLibraryPromptTemplateNil() { + o.ModifiedLibraryPromptTemplate.Set(nil) +} + +// UnsetModifiedLibraryPromptTemplate ensures that no value is present for ModifiedLibraryPromptTemplate, not even an explicit nil. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) UnsetModifiedLibraryPromptTemplate() { + o.ModifiedLibraryPromptTemplate.Unset() +} + +// GetOutputSchema returns the OutputSchema field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetOutputSchema() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.OutputSchema +} + +// GetOutputSchemaOk returns a tuple with the OutputSchema field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetOutputSchemaOk() (*map[string]interface{}, bool) { + if o == nil || o.OutputSchema == nil { + return nil, false + } + return &o.OutputSchema, true +} + +// HasOutputSchema returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasOutputSchema() bool { + return o != nil && o.OutputSchema != nil +} + +// SetOutputSchema gets a reference to the given map[string]interface{} and assigns it to the OutputSchema field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetOutputSchema(v map[string]interface{}) { + o.OutputSchema = v +} + +// GetParsingType returns the ParsingType field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetParsingType() LLMObsCustomEvalConfigParsingType { + if o == nil || o.ParsingType == nil { + var ret LLMObsCustomEvalConfigParsingType + return ret + } + return *o.ParsingType +} + +// GetParsingTypeOk returns a tuple with the ParsingType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetParsingTypeOk() (*LLMObsCustomEvalConfigParsingType, bool) { + if o == nil || o.ParsingType == nil { + return nil, false + } + return o.ParsingType, true +} + +// HasParsingType returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasParsingType() bool { + return o != nil && o.ParsingType != nil +} + +// SetParsingType gets a reference to the given LLMObsCustomEvalConfigParsingType and assigns it to the ParsingType field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetParsingType(v LLMObsCustomEvalConfigParsingType) { + o.ParsingType = &v +} + +// GetPromptTemplate returns the PromptTemplate field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetPromptTemplate() []LLMObsCustomEvalConfigPromptMessage { + if o == nil || o.PromptTemplate == nil { + var ret []LLMObsCustomEvalConfigPromptMessage + return ret + } + return o.PromptTemplate +} + +// GetPromptTemplateOk returns a tuple with the PromptTemplate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) GetPromptTemplateOk() (*[]LLMObsCustomEvalConfigPromptMessage, bool) { + if o == nil || o.PromptTemplate == nil { + return nil, false + } + return &o.PromptTemplate, true +} + +// HasPromptTemplate returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) HasPromptTemplate() bool { + return o != nil && o.PromptTemplate != nil +} + +// SetPromptTemplate gets a reference to the given []LLMObsCustomEvalConfigPromptMessage and assigns it to the PromptTemplate field. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) SetPromptTemplate(v []LLMObsCustomEvalConfigPromptMessage) { + o.PromptTemplate = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigLLMJudgeConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.AssessmentCriteria != nil { + toSerialize["assessment_criteria"] = o.AssessmentCriteria + } + toSerialize["inference_params"] = o.InferenceParams + if o.LastUsedLibraryPromptTemplateName.IsSet() { + toSerialize["last_used_library_prompt_template_name"] = o.LastUsedLibraryPromptTemplateName.Get() + } + if o.ModifiedLibraryPromptTemplate.IsSet() { + toSerialize["modified_library_prompt_template"] = o.ModifiedLibraryPromptTemplate.Get() + } + if o.OutputSchema != nil { + toSerialize["output_schema"] = o.OutputSchema + } + if o.ParsingType != nil { + toSerialize["parsing_type"] = o.ParsingType + } + if o.PromptTemplate != nil { + toSerialize["prompt_template"] = o.PromptTemplate + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigLLMJudgeConfig) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + AssessmentCriteria *LLMObsCustomEvalConfigAssessmentCriteria `json:"assessment_criteria,omitempty"` + InferenceParams *LLMObsCustomEvalConfigInferenceParams `json:"inference_params"` + LastUsedLibraryPromptTemplateName datadog.NullableString `json:"last_used_library_prompt_template_name,omitempty"` + ModifiedLibraryPromptTemplate datadog.NullableBool `json:"modified_library_prompt_template,omitempty"` + OutputSchema map[string]interface{} `json:"output_schema,omitempty"` + ParsingType *LLMObsCustomEvalConfigParsingType `json:"parsing_type,omitempty"` + PromptTemplate []LLMObsCustomEvalConfigPromptMessage `json:"prompt_template,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.InferenceParams == nil { + return fmt.Errorf("required field inference_params missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"assessment_criteria", "inference_params", "last_used_library_prompt_template_name", "modified_library_prompt_template", "output_schema", "parsing_type", "prompt_template"}) + } else { + return err + } + + hasInvalidField := false + if all.AssessmentCriteria != nil && all.AssessmentCriteria.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.AssessmentCriteria = all.AssessmentCriteria + if all.InferenceParams.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.InferenceParams = *all.InferenceParams + o.LastUsedLibraryPromptTemplateName = all.LastUsedLibraryPromptTemplateName + o.ModifiedLibraryPromptTemplate = all.ModifiedLibraryPromptTemplate + o.OutputSchema = all.OutputSchema + if all.ParsingType != nil && !all.ParsingType.IsValid() { + hasInvalidField = true + } else { + o.ParsingType = all.ParsingType + } + o.PromptTemplate = all.PromptTemplate + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_llm_provider.go b/api/datadogV2/model_llm_obs_custom_eval_config_llm_provider.go new file mode 100644 index 00000000000..676f626cdbd --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_llm_provider.go @@ -0,0 +1,258 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigLLMProvider LLM provider configuration for a custom evaluator. +type LLMObsCustomEvalConfigLLMProvider struct { + // AWS Bedrock-specific options for LLM provider configuration. + Bedrock *LLMObsCustomEvalConfigBedrockOptions `json:"bedrock,omitempty"` + // Integration account identifier. + IntegrationAccountId *string `json:"integration_account_id,omitempty"` + // Name of the LLM integration provider. + IntegrationProvider *LLMObsCustomEvalConfigIntegrationProvider `json:"integration_provider,omitempty"` + // Name of the LLM model. + ModelName *string `json:"model_name,omitempty"` + // Google Vertex AI-specific options for LLM provider configuration. + VertexAi *LLMObsCustomEvalConfigVertexAIOptions `json:"vertex_ai,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigLLMProvider instantiates a new LLMObsCustomEvalConfigLLMProvider object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigLLMProvider() *LLMObsCustomEvalConfigLLMProvider { + this := LLMObsCustomEvalConfigLLMProvider{} + return &this +} + +// NewLLMObsCustomEvalConfigLLMProviderWithDefaults instantiates a new LLMObsCustomEvalConfigLLMProvider object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigLLMProviderWithDefaults() *LLMObsCustomEvalConfigLLMProvider { + this := LLMObsCustomEvalConfigLLMProvider{} + return &this +} + +// GetBedrock returns the Bedrock field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMProvider) GetBedrock() LLMObsCustomEvalConfigBedrockOptions { + if o == nil || o.Bedrock == nil { + var ret LLMObsCustomEvalConfigBedrockOptions + return ret + } + return *o.Bedrock +} + +// GetBedrockOk returns a tuple with the Bedrock field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) GetBedrockOk() (*LLMObsCustomEvalConfigBedrockOptions, bool) { + if o == nil || o.Bedrock == nil { + return nil, false + } + return o.Bedrock, true +} + +// HasBedrock returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) HasBedrock() bool { + return o != nil && o.Bedrock != nil +} + +// SetBedrock gets a reference to the given LLMObsCustomEvalConfigBedrockOptions and assigns it to the Bedrock field. +func (o *LLMObsCustomEvalConfigLLMProvider) SetBedrock(v LLMObsCustomEvalConfigBedrockOptions) { + o.Bedrock = &v +} + +// GetIntegrationAccountId returns the IntegrationAccountId field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMProvider) GetIntegrationAccountId() string { + if o == nil || o.IntegrationAccountId == nil { + var ret string + return ret + } + return *o.IntegrationAccountId +} + +// GetIntegrationAccountIdOk returns a tuple with the IntegrationAccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) GetIntegrationAccountIdOk() (*string, bool) { + if o == nil || o.IntegrationAccountId == nil { + return nil, false + } + return o.IntegrationAccountId, true +} + +// HasIntegrationAccountId returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) HasIntegrationAccountId() bool { + return o != nil && o.IntegrationAccountId != nil +} + +// SetIntegrationAccountId gets a reference to the given string and assigns it to the IntegrationAccountId field. +func (o *LLMObsCustomEvalConfigLLMProvider) SetIntegrationAccountId(v string) { + o.IntegrationAccountId = &v +} + +// GetIntegrationProvider returns the IntegrationProvider field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMProvider) GetIntegrationProvider() LLMObsCustomEvalConfigIntegrationProvider { + if o == nil || o.IntegrationProvider == nil { + var ret LLMObsCustomEvalConfigIntegrationProvider + return ret + } + return *o.IntegrationProvider +} + +// GetIntegrationProviderOk returns a tuple with the IntegrationProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) GetIntegrationProviderOk() (*LLMObsCustomEvalConfigIntegrationProvider, bool) { + if o == nil || o.IntegrationProvider == nil { + return nil, false + } + return o.IntegrationProvider, true +} + +// HasIntegrationProvider returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) HasIntegrationProvider() bool { + return o != nil && o.IntegrationProvider != nil +} + +// SetIntegrationProvider gets a reference to the given LLMObsCustomEvalConfigIntegrationProvider and assigns it to the IntegrationProvider field. +func (o *LLMObsCustomEvalConfigLLMProvider) SetIntegrationProvider(v LLMObsCustomEvalConfigIntegrationProvider) { + o.IntegrationProvider = &v +} + +// GetModelName returns the ModelName field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMProvider) GetModelName() string { + if o == nil || o.ModelName == nil { + var ret string + return ret + } + return *o.ModelName +} + +// GetModelNameOk returns a tuple with the ModelName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) GetModelNameOk() (*string, bool) { + if o == nil || o.ModelName == nil { + return nil, false + } + return o.ModelName, true +} + +// HasModelName returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) HasModelName() bool { + return o != nil && o.ModelName != nil +} + +// SetModelName gets a reference to the given string and assigns it to the ModelName field. +func (o *LLMObsCustomEvalConfigLLMProvider) SetModelName(v string) { + o.ModelName = &v +} + +// GetVertexAi returns the VertexAi field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigLLMProvider) GetVertexAi() LLMObsCustomEvalConfigVertexAIOptions { + if o == nil || o.VertexAi == nil { + var ret LLMObsCustomEvalConfigVertexAIOptions + return ret + } + return *o.VertexAi +} + +// GetVertexAiOk returns a tuple with the VertexAi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) GetVertexAiOk() (*LLMObsCustomEvalConfigVertexAIOptions, bool) { + if o == nil || o.VertexAi == nil { + return nil, false + } + return o.VertexAi, true +} + +// HasVertexAi returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigLLMProvider) HasVertexAi() bool { + return o != nil && o.VertexAi != nil +} + +// SetVertexAi gets a reference to the given LLMObsCustomEvalConfigVertexAIOptions and assigns it to the VertexAi field. +func (o *LLMObsCustomEvalConfigLLMProvider) SetVertexAi(v LLMObsCustomEvalConfigVertexAIOptions) { + o.VertexAi = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigLLMProvider) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Bedrock != nil { + toSerialize["bedrock"] = o.Bedrock + } + if o.IntegrationAccountId != nil { + toSerialize["integration_account_id"] = o.IntegrationAccountId + } + if o.IntegrationProvider != nil { + toSerialize["integration_provider"] = o.IntegrationProvider + } + if o.ModelName != nil { + toSerialize["model_name"] = o.ModelName + } + if o.VertexAi != nil { + toSerialize["vertex_ai"] = o.VertexAi + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigLLMProvider) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Bedrock *LLMObsCustomEvalConfigBedrockOptions `json:"bedrock,omitempty"` + IntegrationAccountId *string `json:"integration_account_id,omitempty"` + IntegrationProvider *LLMObsCustomEvalConfigIntegrationProvider `json:"integration_provider,omitempty"` + ModelName *string `json:"model_name,omitempty"` + VertexAi *LLMObsCustomEvalConfigVertexAIOptions `json:"vertex_ai,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"bedrock", "integration_account_id", "integration_provider", "model_name", "vertex_ai"}) + } else { + return err + } + + hasInvalidField := false + if all.Bedrock != nil && all.Bedrock.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Bedrock = all.Bedrock + o.IntegrationAccountId = all.IntegrationAccountId + if all.IntegrationProvider != nil && !all.IntegrationProvider.IsValid() { + hasInvalidField = true + } else { + o.IntegrationProvider = all.IntegrationProvider + } + o.ModelName = all.ModelName + if all.VertexAi != nil && all.VertexAi.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.VertexAi = all.VertexAi + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_parsing_type.go b/api/datadogV2/model_llm_obs_custom_eval_config_parsing_type.go new file mode 100644 index 00000000000..2c38c44e903 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_parsing_type.go @@ -0,0 +1,66 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigParsingType Output parsing type for a custom LLM judge evaluator. +type LLMObsCustomEvalConfigParsingType string + +// List of LLMObsCustomEvalConfigParsingType. +const ( + LLMOBSCUSTOMEVALCONFIGPARSINGTYPE_STRUCTURED_OUTPUT LLMObsCustomEvalConfigParsingType = "structured_output" + LLMOBSCUSTOMEVALCONFIGPARSINGTYPE_JSON LLMObsCustomEvalConfigParsingType = "json" +) + +var allowedLLMObsCustomEvalConfigParsingTypeEnumValues = []LLMObsCustomEvalConfigParsingType{ + LLMOBSCUSTOMEVALCONFIGPARSINGTYPE_STRUCTURED_OUTPUT, + LLMOBSCUSTOMEVALCONFIGPARSINGTYPE_JSON, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LLMObsCustomEvalConfigParsingType) GetAllowedValues() []LLMObsCustomEvalConfigParsingType { + return allowedLLMObsCustomEvalConfigParsingTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LLMObsCustomEvalConfigParsingType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LLMObsCustomEvalConfigParsingType(value) + return nil +} + +// NewLLMObsCustomEvalConfigParsingTypeFromValue returns a pointer to a valid LLMObsCustomEvalConfigParsingType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLLMObsCustomEvalConfigParsingTypeFromValue(v string) (*LLMObsCustomEvalConfigParsingType, error) { + ev := LLMObsCustomEvalConfigParsingType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LLMObsCustomEvalConfigParsingType: valid values are %v", v, allowedLLMObsCustomEvalConfigParsingTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LLMObsCustomEvalConfigParsingType) IsValid() bool { + for _, existing := range allowedLLMObsCustomEvalConfigParsingTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LLMObsCustomEvalConfigParsingType value. +func (v LLMObsCustomEvalConfigParsingType) Ptr() *LLMObsCustomEvalConfigParsingType { + return &v +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content.go b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content.go new file mode 100644 index 00000000000..0abf1adfb71 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content.go @@ -0,0 +1,142 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigPromptContent A content block within a prompt message. +type LLMObsCustomEvalConfigPromptContent struct { + // Content block type. + Type string `json:"type"` + // Value of a prompt message content block. + Value LLMObsCustomEvalConfigPromptContentValue `json:"value"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigPromptContent instantiates a new LLMObsCustomEvalConfigPromptContent object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigPromptContent(typeVar string, value LLMObsCustomEvalConfigPromptContentValue) *LLMObsCustomEvalConfigPromptContent { + this := LLMObsCustomEvalConfigPromptContent{} + this.Type = typeVar + this.Value = value + return &this +} + +// NewLLMObsCustomEvalConfigPromptContentWithDefaults instantiates a new LLMObsCustomEvalConfigPromptContent object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigPromptContentWithDefaults() *LLMObsCustomEvalConfigPromptContent { + this := LLMObsCustomEvalConfigPromptContent{} + return &this +} + +// GetType returns the Type field value. +func (o *LLMObsCustomEvalConfigPromptContent) GetType() string { + if o == nil { + var ret string + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptContent) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LLMObsCustomEvalConfigPromptContent) SetType(v string) { + o.Type = v +} + +// GetValue returns the Value field value. +func (o *LLMObsCustomEvalConfigPromptContent) GetValue() LLMObsCustomEvalConfigPromptContentValue { + if o == nil { + var ret LLMObsCustomEvalConfigPromptContentValue + return ret + } + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptContent) GetValueOk() (*LLMObsCustomEvalConfigPromptContentValue, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value. +func (o *LLMObsCustomEvalConfigPromptContent) SetValue(v LLMObsCustomEvalConfigPromptContentValue) { + o.Value = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigPromptContent) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["type"] = o.Type + toSerialize["value"] = o.Value + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigPromptContent) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Type *string `json:"type"` + Value *LLMObsCustomEvalConfigPromptContentValue `json:"value"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + if all.Value == nil { + return fmt.Errorf("required field value missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"type", "value"}) + } else { + return err + } + + hasInvalidField := false + o.Type = *all.Type + if all.Value.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Value = *all.Value + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content_value.go b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content_value.go new file mode 100644 index 00000000000..f0b2ec704f1 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_content_value.go @@ -0,0 +1,184 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigPromptContentValue Value of a prompt message content block. +type LLMObsCustomEvalConfigPromptContentValue struct { + // Text content of the message block. + Text *string `json:"text,omitempty"` + // A tool call within a prompt message. + ToolCall *LLMObsCustomEvalConfigPromptToolCall `json:"tool_call,omitempty"` + // A tool call result within a prompt message. + ToolCallResult *LLMObsCustomEvalConfigPromptToolResult `json:"tool_call_result,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigPromptContentValue instantiates a new LLMObsCustomEvalConfigPromptContentValue object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigPromptContentValue() *LLMObsCustomEvalConfigPromptContentValue { + this := LLMObsCustomEvalConfigPromptContentValue{} + return &this +} + +// NewLLMObsCustomEvalConfigPromptContentValueWithDefaults instantiates a new LLMObsCustomEvalConfigPromptContentValue object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigPromptContentValueWithDefaults() *LLMObsCustomEvalConfigPromptContentValue { + this := LLMObsCustomEvalConfigPromptContentValue{} + return &this +} + +// GetText returns the Text field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetText() string { + if o == nil || o.Text == nil { + var ret string + return ret + } + return *o.Text +} + +// GetTextOk returns a tuple with the Text field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetTextOk() (*string, bool) { + if o == nil || o.Text == nil { + return nil, false + } + return o.Text, true +} + +// HasText returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) HasText() bool { + return o != nil && o.Text != nil +} + +// SetText gets a reference to the given string and assigns it to the Text field. +func (o *LLMObsCustomEvalConfigPromptContentValue) SetText(v string) { + o.Text = &v +} + +// GetToolCall returns the ToolCall field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetToolCall() LLMObsCustomEvalConfigPromptToolCall { + if o == nil || o.ToolCall == nil { + var ret LLMObsCustomEvalConfigPromptToolCall + return ret + } + return *o.ToolCall +} + +// GetToolCallOk returns a tuple with the ToolCall field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetToolCallOk() (*LLMObsCustomEvalConfigPromptToolCall, bool) { + if o == nil || o.ToolCall == nil { + return nil, false + } + return o.ToolCall, true +} + +// HasToolCall returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) HasToolCall() bool { + return o != nil && o.ToolCall != nil +} + +// SetToolCall gets a reference to the given LLMObsCustomEvalConfigPromptToolCall and assigns it to the ToolCall field. +func (o *LLMObsCustomEvalConfigPromptContentValue) SetToolCall(v LLMObsCustomEvalConfigPromptToolCall) { + o.ToolCall = &v +} + +// GetToolCallResult returns the ToolCallResult field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetToolCallResult() LLMObsCustomEvalConfigPromptToolResult { + if o == nil || o.ToolCallResult == nil { + var ret LLMObsCustomEvalConfigPromptToolResult + return ret + } + return *o.ToolCallResult +} + +// GetToolCallResultOk returns a tuple with the ToolCallResult field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) GetToolCallResultOk() (*LLMObsCustomEvalConfigPromptToolResult, bool) { + if o == nil || o.ToolCallResult == nil { + return nil, false + } + return o.ToolCallResult, true +} + +// HasToolCallResult returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptContentValue) HasToolCallResult() bool { + return o != nil && o.ToolCallResult != nil +} + +// SetToolCallResult gets a reference to the given LLMObsCustomEvalConfigPromptToolResult and assigns it to the ToolCallResult field. +func (o *LLMObsCustomEvalConfigPromptContentValue) SetToolCallResult(v LLMObsCustomEvalConfigPromptToolResult) { + o.ToolCallResult = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigPromptContentValue) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Text != nil { + toSerialize["text"] = o.Text + } + if o.ToolCall != nil { + toSerialize["tool_call"] = o.ToolCall + } + if o.ToolCallResult != nil { + toSerialize["tool_call_result"] = o.ToolCallResult + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigPromptContentValue) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Text *string `json:"text,omitempty"` + ToolCall *LLMObsCustomEvalConfigPromptToolCall `json:"tool_call,omitempty"` + ToolCallResult *LLMObsCustomEvalConfigPromptToolResult `json:"tool_call_result,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"text", "tool_call", "tool_call_result"}) + } else { + return err + } + + hasInvalidField := false + o.Text = all.Text + if all.ToolCall != nil && all.ToolCall.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ToolCall = all.ToolCall + if all.ToolCallResult != nil && all.ToolCallResult.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ToolCallResult = all.ToolCallResult + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_prompt_message.go b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_message.go new file mode 100644 index 00000000000..6ba4e3ec3c7 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_message.go @@ -0,0 +1,171 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigPromptMessage A message in the prompt template for a custom LLM judge evaluator. +type LLMObsCustomEvalConfigPromptMessage struct { + // Text content of the message. + Content *string `json:"content,omitempty"` + // Multi-part content blocks for the message. + Contents []LLMObsCustomEvalConfigPromptContent `json:"contents,omitempty"` + // Role of the message author. + Role string `json:"role"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigPromptMessage instantiates a new LLMObsCustomEvalConfigPromptMessage object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigPromptMessage(role string) *LLMObsCustomEvalConfigPromptMessage { + this := LLMObsCustomEvalConfigPromptMessage{} + this.Role = role + return &this +} + +// NewLLMObsCustomEvalConfigPromptMessageWithDefaults instantiates a new LLMObsCustomEvalConfigPromptMessage object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigPromptMessageWithDefaults() *LLMObsCustomEvalConfigPromptMessage { + this := LLMObsCustomEvalConfigPromptMessage{} + return &this +} + +// GetContent returns the Content field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptMessage) GetContent() string { + if o == nil || o.Content == nil { + var ret string + return ret + } + return *o.Content +} + +// GetContentOk returns a tuple with the Content field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptMessage) GetContentOk() (*string, bool) { + if o == nil || o.Content == nil { + return nil, false + } + return o.Content, true +} + +// HasContent returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptMessage) HasContent() bool { + return o != nil && o.Content != nil +} + +// SetContent gets a reference to the given string and assigns it to the Content field. +func (o *LLMObsCustomEvalConfigPromptMessage) SetContent(v string) { + o.Content = &v +} + +// GetContents returns the Contents field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptMessage) GetContents() []LLMObsCustomEvalConfigPromptContent { + if o == nil || o.Contents == nil { + var ret []LLMObsCustomEvalConfigPromptContent + return ret + } + return o.Contents +} + +// GetContentsOk returns a tuple with the Contents field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptMessage) GetContentsOk() (*[]LLMObsCustomEvalConfigPromptContent, bool) { + if o == nil || o.Contents == nil { + return nil, false + } + return &o.Contents, true +} + +// HasContents returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptMessage) HasContents() bool { + return o != nil && o.Contents != nil +} + +// SetContents gets a reference to the given []LLMObsCustomEvalConfigPromptContent and assigns it to the Contents field. +func (o *LLMObsCustomEvalConfigPromptMessage) SetContents(v []LLMObsCustomEvalConfigPromptContent) { + o.Contents = v +} + +// GetRole returns the Role field value. +func (o *LLMObsCustomEvalConfigPromptMessage) GetRole() string { + if o == nil { + var ret string + return ret + } + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptMessage) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value. +func (o *LLMObsCustomEvalConfigPromptMessage) SetRole(v string) { + o.Role = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigPromptMessage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Content != nil { + toSerialize["content"] = o.Content + } + if o.Contents != nil { + toSerialize["contents"] = o.Contents + } + toSerialize["role"] = o.Role + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigPromptMessage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Content *string `json:"content,omitempty"` + Contents []LLMObsCustomEvalConfigPromptContent `json:"contents,omitempty"` + Role *string `json:"role"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Role == nil { + return fmt.Errorf("required field role missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"content", "contents", "role"}) + } else { + return err + } + o.Content = all.Content + o.Contents = all.Contents + o.Role = *all.Role + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_call.go b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_call.go new file mode 100644 index 00000000000..4483646c867 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_call.go @@ -0,0 +1,207 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigPromptToolCall A tool call within a prompt message. +type LLMObsCustomEvalConfigPromptToolCall struct { + // JSON-encoded arguments for the tool call. + Arguments *string `json:"arguments,omitempty"` + // Unique identifier of the tool call. + Id *string `json:"id,omitempty"` + // Name of the tool being called. + Name *string `json:"name,omitempty"` + // Type of the tool call. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigPromptToolCall instantiates a new LLMObsCustomEvalConfigPromptToolCall object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigPromptToolCall() *LLMObsCustomEvalConfigPromptToolCall { + this := LLMObsCustomEvalConfigPromptToolCall{} + return &this +} + +// NewLLMObsCustomEvalConfigPromptToolCallWithDefaults instantiates a new LLMObsCustomEvalConfigPromptToolCall object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigPromptToolCallWithDefaults() *LLMObsCustomEvalConfigPromptToolCall { + this := LLMObsCustomEvalConfigPromptToolCall{} + return &this +} + +// GetArguments returns the Arguments field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetArguments() string { + if o == nil || o.Arguments == nil { + var ret string + return ret + } + return *o.Arguments +} + +// GetArgumentsOk returns a tuple with the Arguments field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetArgumentsOk() (*string, bool) { + if o == nil || o.Arguments == nil { + return nil, false + } + return o.Arguments, true +} + +// HasArguments returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) HasArguments() bool { + return o != nil && o.Arguments != nil +} + +// SetArguments gets a reference to the given string and assigns it to the Arguments field. +func (o *LLMObsCustomEvalConfigPromptToolCall) SetArguments(v string) { + o.Arguments = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LLMObsCustomEvalConfigPromptToolCall) SetId(v string) { + o.Id = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LLMObsCustomEvalConfigPromptToolCall) SetName(v string) { + o.Name = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolCall) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LLMObsCustomEvalConfigPromptToolCall) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigPromptToolCall) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Arguments != nil { + toSerialize["arguments"] = o.Arguments + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigPromptToolCall) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Arguments *string `json:"arguments,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"arguments", "id", "name", "type"}) + } else { + return err + } + o.Arguments = all.Arguments + o.Id = all.Id + o.Name = all.Name + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_result.go b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_result.go new file mode 100644 index 00000000000..b13d0a8fd2f --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_prompt_tool_result.go @@ -0,0 +1,207 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigPromptToolResult A tool call result within a prompt message. +type LLMObsCustomEvalConfigPromptToolResult struct { + // Name of the tool that produced this result. + Name *string `json:"name,omitempty"` + // The result returned by the tool. + Result *string `json:"result,omitempty"` + // Identifier of the tool call this result corresponds to. + ToolId *string `json:"tool_id,omitempty"` + // Type of the tool result. + Type *string `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigPromptToolResult instantiates a new LLMObsCustomEvalConfigPromptToolResult object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigPromptToolResult() *LLMObsCustomEvalConfigPromptToolResult { + this := LLMObsCustomEvalConfigPromptToolResult{} + return &this +} + +// NewLLMObsCustomEvalConfigPromptToolResultWithDefaults instantiates a new LLMObsCustomEvalConfigPromptToolResult object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigPromptToolResultWithDefaults() *LLMObsCustomEvalConfigPromptToolResult { + this := LLMObsCustomEvalConfigPromptToolResult{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LLMObsCustomEvalConfigPromptToolResult) SetName(v string) { + o.Name = &v +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetResult() string { + if o == nil || o.Result == nil { + var ret string + return ret + } + return *o.Result +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetResultOk() (*string, bool) { + if o == nil || o.Result == nil { + return nil, false + } + return o.Result, true +} + +// HasResult returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) HasResult() bool { + return o != nil && o.Result != nil +} + +// SetResult gets a reference to the given string and assigns it to the Result field. +func (o *LLMObsCustomEvalConfigPromptToolResult) SetResult(v string) { + o.Result = &v +} + +// GetToolId returns the ToolId field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetToolId() string { + if o == nil || o.ToolId == nil { + var ret string + return ret + } + return *o.ToolId +} + +// GetToolIdOk returns a tuple with the ToolId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetToolIdOk() (*string, bool) { + if o == nil || o.ToolId == nil { + return nil, false + } + return o.ToolId, true +} + +// HasToolId returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) HasToolId() bool { + return o != nil && o.ToolId != nil +} + +// SetToolId gets a reference to the given string and assigns it to the ToolId field. +func (o *LLMObsCustomEvalConfigPromptToolResult) SetToolId(v string) { + o.ToolId = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigPromptToolResult) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LLMObsCustomEvalConfigPromptToolResult) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigPromptToolResult) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + if o.Result != nil { + toSerialize["result"] = o.Result + } + if o.ToolId != nil { + toSerialize["tool_id"] = o.ToolId + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigPromptToolResult) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,omitempty"` + Result *string `json:"result,omitempty"` + ToolId *string `json:"tool_id,omitempty"` + Type *string `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"name", "result", "tool_id", "type"}) + } else { + return err + } + o.Name = all.Name + o.Result = all.Result + o.ToolId = all.ToolId + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_response.go b/api/datadogV2/model_llm_obs_custom_eval_config_response.go new file mode 100644 index 00000000000..2f5144756dc --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_response.go @@ -0,0 +1,110 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigResponse Response containing a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigResponse struct { + // Data object for a custom LLM Observability evaluator configuration. + Data LLMObsCustomEvalConfigData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigResponse instantiates a new LLMObsCustomEvalConfigResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigResponse(data LLMObsCustomEvalConfigData) *LLMObsCustomEvalConfigResponse { + this := LLMObsCustomEvalConfigResponse{} + this.Data = data + return &this +} + +// NewLLMObsCustomEvalConfigResponseWithDefaults instantiates a new LLMObsCustomEvalConfigResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigResponseWithDefaults() *LLMObsCustomEvalConfigResponse { + this := LLMObsCustomEvalConfigResponse{} + return &this +} + +// GetData returns the Data field value. +func (o *LLMObsCustomEvalConfigResponse) GetData() LLMObsCustomEvalConfigData { + if o == nil { + var ret LLMObsCustomEvalConfigData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigResponse) GetDataOk() (*LLMObsCustomEvalConfigData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *LLMObsCustomEvalConfigResponse) SetData(v LLMObsCustomEvalConfigData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *LLMObsCustomEvalConfigData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_target.go b/api/datadogV2/model_llm_obs_custom_eval_config_target.go new file mode 100644 index 00000000000..26c33eebeec --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_target.go @@ -0,0 +1,316 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigTarget Target application configuration for a custom evaluator. +type LLMObsCustomEvalConfigTarget struct { + // Name of the ML application this evaluator targets. + ApplicationName string `json:"application_name"` + // Whether the evaluator is active for the target application. + Enabled bool `json:"enabled"` + // Scope at which to evaluate spans. + EvalScope *LLMObsCustomEvalConfigEvalScope `json:"eval_scope,omitempty"` + // Filter expression to select which spans to evaluate. + Filter datadog.NullableString `json:"filter,omitempty"` + // When true, only root spans are evaluated. + RootSpansOnly datadog.NullableBool `json:"root_spans_only,omitempty"` + // Percentage of traces to evaluate. Must be greater than 0 and at most 100. + SamplingPercentage datadog.NullableFloat64 `json:"sampling_percentage,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigTarget instantiates a new LLMObsCustomEvalConfigTarget object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigTarget(applicationName string, enabled bool) *LLMObsCustomEvalConfigTarget { + this := LLMObsCustomEvalConfigTarget{} + this.ApplicationName = applicationName + this.Enabled = enabled + return &this +} + +// NewLLMObsCustomEvalConfigTargetWithDefaults instantiates a new LLMObsCustomEvalConfigTarget object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigTargetWithDefaults() *LLMObsCustomEvalConfigTarget { + this := LLMObsCustomEvalConfigTarget{} + return &this +} + +// GetApplicationName returns the ApplicationName field value. +func (o *LLMObsCustomEvalConfigTarget) GetApplicationName() string { + if o == nil { + var ret string + return ret + } + return o.ApplicationName +} + +// GetApplicationNameOk returns a tuple with the ApplicationName field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigTarget) GetApplicationNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApplicationName, true +} + +// SetApplicationName sets field value. +func (o *LLMObsCustomEvalConfigTarget) SetApplicationName(v string) { + o.ApplicationName = v +} + +// GetEnabled returns the Enabled field value. +func (o *LLMObsCustomEvalConfigTarget) GetEnabled() bool { + if o == nil { + var ret bool + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigTarget) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Enabled, true +} + +// SetEnabled sets field value. +func (o *LLMObsCustomEvalConfigTarget) SetEnabled(v bool) { + o.Enabled = v +} + +// GetEvalScope returns the EvalScope field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigTarget) GetEvalScope() LLMObsCustomEvalConfigEvalScope { + if o == nil || o.EvalScope == nil { + var ret LLMObsCustomEvalConfigEvalScope + return ret + } + return *o.EvalScope +} + +// GetEvalScopeOk returns a tuple with the EvalScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigTarget) GetEvalScopeOk() (*LLMObsCustomEvalConfigEvalScope, bool) { + if o == nil || o.EvalScope == nil { + return nil, false + } + return o.EvalScope, true +} + +// HasEvalScope returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigTarget) HasEvalScope() bool { + return o != nil && o.EvalScope != nil +} + +// SetEvalScope gets a reference to the given LLMObsCustomEvalConfigEvalScope and assigns it to the EvalScope field. +func (o *LLMObsCustomEvalConfigTarget) SetEvalScope(v LLMObsCustomEvalConfigEvalScope) { + o.EvalScope = &v +} + +// GetFilter returns the Filter field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigTarget) GetFilter() string { + if o == nil || o.Filter.Get() == nil { + var ret string + return ret + } + return *o.Filter.Get() +} + +// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigTarget) GetFilterOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Filter.Get(), o.Filter.IsSet() +} + +// HasFilter returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigTarget) HasFilter() bool { + return o != nil && o.Filter.IsSet() +} + +// SetFilter gets a reference to the given datadog.NullableString and assigns it to the Filter field. +func (o *LLMObsCustomEvalConfigTarget) SetFilter(v string) { + o.Filter.Set(&v) +} + +// SetFilterNil sets the value for Filter to be an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) SetFilterNil() { + o.Filter.Set(nil) +} + +// UnsetFilter ensures that no value is present for Filter, not even an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) UnsetFilter() { + o.Filter.Unset() +} + +// GetRootSpansOnly returns the RootSpansOnly field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigTarget) GetRootSpansOnly() bool { + if o == nil || o.RootSpansOnly.Get() == nil { + var ret bool + return ret + } + return *o.RootSpansOnly.Get() +} + +// GetRootSpansOnlyOk returns a tuple with the RootSpansOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigTarget) GetRootSpansOnlyOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.RootSpansOnly.Get(), o.RootSpansOnly.IsSet() +} + +// HasRootSpansOnly returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigTarget) HasRootSpansOnly() bool { + return o != nil && o.RootSpansOnly.IsSet() +} + +// SetRootSpansOnly gets a reference to the given datadog.NullableBool and assigns it to the RootSpansOnly field. +func (o *LLMObsCustomEvalConfigTarget) SetRootSpansOnly(v bool) { + o.RootSpansOnly.Set(&v) +} + +// SetRootSpansOnlyNil sets the value for RootSpansOnly to be an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) SetRootSpansOnlyNil() { + o.RootSpansOnly.Set(nil) +} + +// UnsetRootSpansOnly ensures that no value is present for RootSpansOnly, not even an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) UnsetRootSpansOnly() { + o.RootSpansOnly.Unset() +} + +// GetSamplingPercentage returns the SamplingPercentage field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LLMObsCustomEvalConfigTarget) GetSamplingPercentage() float64 { + if o == nil || o.SamplingPercentage.Get() == nil { + var ret float64 + return ret + } + return *o.SamplingPercentage.Get() +} + +// GetSamplingPercentageOk returns a tuple with the SamplingPercentage field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *LLMObsCustomEvalConfigTarget) GetSamplingPercentageOk() (*float64, bool) { + if o == nil { + return nil, false + } + return o.SamplingPercentage.Get(), o.SamplingPercentage.IsSet() +} + +// HasSamplingPercentage returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigTarget) HasSamplingPercentage() bool { + return o != nil && o.SamplingPercentage.IsSet() +} + +// SetSamplingPercentage gets a reference to the given datadog.NullableFloat64 and assigns it to the SamplingPercentage field. +func (o *LLMObsCustomEvalConfigTarget) SetSamplingPercentage(v float64) { + o.SamplingPercentage.Set(&v) +} + +// SetSamplingPercentageNil sets the value for SamplingPercentage to be an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) SetSamplingPercentageNil() { + o.SamplingPercentage.Set(nil) +} + +// UnsetSamplingPercentage ensures that no value is present for SamplingPercentage, not even an explicit nil. +func (o *LLMObsCustomEvalConfigTarget) UnsetSamplingPercentage() { + o.SamplingPercentage.Unset() +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigTarget) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["application_name"] = o.ApplicationName + toSerialize["enabled"] = o.Enabled + if o.EvalScope != nil { + toSerialize["eval_scope"] = o.EvalScope + } + if o.Filter.IsSet() { + toSerialize["filter"] = o.Filter.Get() + } + if o.RootSpansOnly.IsSet() { + toSerialize["root_spans_only"] = o.RootSpansOnly.Get() + } + if o.SamplingPercentage.IsSet() { + toSerialize["sampling_percentage"] = o.SamplingPercentage.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigTarget) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ApplicationName *string `json:"application_name"` + Enabled *bool `json:"enabled"` + EvalScope *LLMObsCustomEvalConfigEvalScope `json:"eval_scope,omitempty"` + Filter datadog.NullableString `json:"filter,omitempty"` + RootSpansOnly datadog.NullableBool `json:"root_spans_only,omitempty"` + SamplingPercentage datadog.NullableFloat64 `json:"sampling_percentage,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ApplicationName == nil { + return fmt.Errorf("required field application_name missing") + } + if all.Enabled == nil { + return fmt.Errorf("required field enabled missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"application_name", "enabled", "eval_scope", "filter", "root_spans_only", "sampling_percentage"}) + } else { + return err + } + + hasInvalidField := false + o.ApplicationName = *all.ApplicationName + o.Enabled = *all.Enabled + if all.EvalScope != nil && !all.EvalScope.IsValid() { + hasInvalidField = true + } else { + o.EvalScope = all.EvalScope + } + o.Filter = all.Filter + o.RootSpansOnly = all.RootSpansOnly + o.SamplingPercentage = all.SamplingPercentage + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_type.go b/api/datadogV2/model_llm_obs_custom_eval_config_type.go new file mode 100644 index 00000000000..a5b3803b910 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigType Type of the custom LLM Observability evaluator configuration resource. +type LLMObsCustomEvalConfigType string + +// List of LLMObsCustomEvalConfigType. +const ( + LLMOBSCUSTOMEVALCONFIGTYPE_EVALUATOR_CONFIG LLMObsCustomEvalConfigType = "evaluator_config" +) + +var allowedLLMObsCustomEvalConfigTypeEnumValues = []LLMObsCustomEvalConfigType{ + LLMOBSCUSTOMEVALCONFIGTYPE_EVALUATOR_CONFIG, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LLMObsCustomEvalConfigType) GetAllowedValues() []LLMObsCustomEvalConfigType { + return allowedLLMObsCustomEvalConfigTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LLMObsCustomEvalConfigType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LLMObsCustomEvalConfigType(value) + return nil +} + +// NewLLMObsCustomEvalConfigTypeFromValue returns a pointer to a valid LLMObsCustomEvalConfigType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLLMObsCustomEvalConfigTypeFromValue(v string) (*LLMObsCustomEvalConfigType, error) { + ev := LLMObsCustomEvalConfigType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LLMObsCustomEvalConfigType: valid values are %v", v, allowedLLMObsCustomEvalConfigTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LLMObsCustomEvalConfigType) IsValid() bool { + for _, existing := range allowedLLMObsCustomEvalConfigTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LLMObsCustomEvalConfigType value. +func (v LLMObsCustomEvalConfigType) Ptr() *LLMObsCustomEvalConfigType { + return &v +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_update_attributes.go b/api/datadogV2/model_llm_obs_custom_eval_config_update_attributes.go new file mode 100644 index 00000000000..964bb7c389c --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_update_attributes.go @@ -0,0 +1,256 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigUpdateAttributes Attributes for creating or updating a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigUpdateAttributes struct { + // Category of the evaluator. + Category *string `json:"category,omitempty"` + // Name of the custom evaluator. If provided, must match the eval_name path parameter. + EvalName *string `json:"eval_name,omitempty"` + // LLM judge configuration for a custom evaluator. + LlmJudgeConfig *LLMObsCustomEvalConfigLLMJudgeConfig `json:"llm_judge_config,omitempty"` + // LLM provider configuration for a custom evaluator. + LlmProvider *LLMObsCustomEvalConfigLLMProvider `json:"llm_provider,omitempty"` + // Target application configuration for a custom evaluator. + Target LLMObsCustomEvalConfigTarget `json:"target"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigUpdateAttributes instantiates a new LLMObsCustomEvalConfigUpdateAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigUpdateAttributes(target LLMObsCustomEvalConfigTarget) *LLMObsCustomEvalConfigUpdateAttributes { + this := LLMObsCustomEvalConfigUpdateAttributes{} + this.Target = target + return &this +} + +// NewLLMObsCustomEvalConfigUpdateAttributesWithDefaults instantiates a new LLMObsCustomEvalConfigUpdateAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigUpdateAttributesWithDefaults() *LLMObsCustomEvalConfigUpdateAttributes { + this := LLMObsCustomEvalConfigUpdateAttributes{} + return &this +} + +// GetCategory returns the Category field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetCategory() string { + if o == nil || o.Category == nil { + var ret string + return ret + } + return *o.Category +} + +// GetCategoryOk returns a tuple with the Category field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetCategoryOk() (*string, bool) { + if o == nil || o.Category == nil { + return nil, false + } + return o.Category, true +} + +// HasCategory returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) HasCategory() bool { + return o != nil && o.Category != nil +} + +// SetCategory gets a reference to the given string and assigns it to the Category field. +func (o *LLMObsCustomEvalConfigUpdateAttributes) SetCategory(v string) { + o.Category = &v +} + +// GetEvalName returns the EvalName field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetEvalName() string { + if o == nil || o.EvalName == nil { + var ret string + return ret + } + return *o.EvalName +} + +// GetEvalNameOk returns a tuple with the EvalName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetEvalNameOk() (*string, bool) { + if o == nil || o.EvalName == nil { + return nil, false + } + return o.EvalName, true +} + +// HasEvalName returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) HasEvalName() bool { + return o != nil && o.EvalName != nil +} + +// SetEvalName gets a reference to the given string and assigns it to the EvalName field. +func (o *LLMObsCustomEvalConfigUpdateAttributes) SetEvalName(v string) { + o.EvalName = &v +} + +// GetLlmJudgeConfig returns the LlmJudgeConfig field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetLlmJudgeConfig() LLMObsCustomEvalConfigLLMJudgeConfig { + if o == nil || o.LlmJudgeConfig == nil { + var ret LLMObsCustomEvalConfigLLMJudgeConfig + return ret + } + return *o.LlmJudgeConfig +} + +// GetLlmJudgeConfigOk returns a tuple with the LlmJudgeConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetLlmJudgeConfigOk() (*LLMObsCustomEvalConfigLLMJudgeConfig, bool) { + if o == nil || o.LlmJudgeConfig == nil { + return nil, false + } + return o.LlmJudgeConfig, true +} + +// HasLlmJudgeConfig returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) HasLlmJudgeConfig() bool { + return o != nil && o.LlmJudgeConfig != nil +} + +// SetLlmJudgeConfig gets a reference to the given LLMObsCustomEvalConfigLLMJudgeConfig and assigns it to the LlmJudgeConfig field. +func (o *LLMObsCustomEvalConfigUpdateAttributes) SetLlmJudgeConfig(v LLMObsCustomEvalConfigLLMJudgeConfig) { + o.LlmJudgeConfig = &v +} + +// GetLlmProvider returns the LlmProvider field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetLlmProvider() LLMObsCustomEvalConfigLLMProvider { + if o == nil || o.LlmProvider == nil { + var ret LLMObsCustomEvalConfigLLMProvider + return ret + } + return *o.LlmProvider +} + +// GetLlmProviderOk returns a tuple with the LlmProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetLlmProviderOk() (*LLMObsCustomEvalConfigLLMProvider, bool) { + if o == nil || o.LlmProvider == nil { + return nil, false + } + return o.LlmProvider, true +} + +// HasLlmProvider returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) HasLlmProvider() bool { + return o != nil && o.LlmProvider != nil +} + +// SetLlmProvider gets a reference to the given LLMObsCustomEvalConfigLLMProvider and assigns it to the LlmProvider field. +func (o *LLMObsCustomEvalConfigUpdateAttributes) SetLlmProvider(v LLMObsCustomEvalConfigLLMProvider) { + o.LlmProvider = &v +} + +// GetTarget returns the Target field value. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetTarget() LLMObsCustomEvalConfigTarget { + if o == nil { + var ret LLMObsCustomEvalConfigTarget + return ret + } + return o.Target +} + +// GetTargetOk returns a tuple with the Target field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateAttributes) GetTargetOk() (*LLMObsCustomEvalConfigTarget, bool) { + if o == nil { + return nil, false + } + return &o.Target, true +} + +// SetTarget sets field value. +func (o *LLMObsCustomEvalConfigUpdateAttributes) SetTarget(v LLMObsCustomEvalConfigTarget) { + o.Target = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Category != nil { + toSerialize["category"] = o.Category + } + if o.EvalName != nil { + toSerialize["eval_name"] = o.EvalName + } + if o.LlmJudgeConfig != nil { + toSerialize["llm_judge_config"] = o.LlmJudgeConfig + } + if o.LlmProvider != nil { + toSerialize["llm_provider"] = o.LlmProvider + } + toSerialize["target"] = o.Target + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Category *string `json:"category,omitempty"` + EvalName *string `json:"eval_name,omitempty"` + LlmJudgeConfig *LLMObsCustomEvalConfigLLMJudgeConfig `json:"llm_judge_config,omitempty"` + LlmProvider *LLMObsCustomEvalConfigLLMProvider `json:"llm_provider,omitempty"` + Target *LLMObsCustomEvalConfigTarget `json:"target"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Target == nil { + return fmt.Errorf("required field target missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"category", "eval_name", "llm_judge_config", "llm_provider", "target"}) + } else { + return err + } + + hasInvalidField := false + o.Category = all.Category + o.EvalName = all.EvalName + if all.LlmJudgeConfig != nil && all.LlmJudgeConfig.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LlmJudgeConfig = all.LlmJudgeConfig + if all.LlmProvider != nil && all.LlmProvider.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.LlmProvider = all.LlmProvider + if all.Target.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Target = *all.Target + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_update_data.go b/api/datadogV2/model_llm_obs_custom_eval_config_update_data.go new file mode 100644 index 00000000000..5f822df98d5 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_update_data.go @@ -0,0 +1,181 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigUpdateData Data object for creating or updating a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigUpdateData struct { + // Attributes for creating or updating a custom LLM Observability evaluator configuration. + Attributes LLMObsCustomEvalConfigUpdateAttributes `json:"attributes"` + // Name of the evaluator. If provided, must match the eval_name path parameter. + Id *string `json:"id,omitempty"` + // Type of the custom LLM Observability evaluator configuration resource. + Type LLMObsCustomEvalConfigType `json:"type"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigUpdateData instantiates a new LLMObsCustomEvalConfigUpdateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigUpdateData(attributes LLMObsCustomEvalConfigUpdateAttributes, typeVar LLMObsCustomEvalConfigType) *LLMObsCustomEvalConfigUpdateData { + this := LLMObsCustomEvalConfigUpdateData{} + this.Attributes = attributes + this.Type = typeVar + return &this +} + +// NewLLMObsCustomEvalConfigUpdateDataWithDefaults instantiates a new LLMObsCustomEvalConfigUpdateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigUpdateDataWithDefaults() *LLMObsCustomEvalConfigUpdateData { + this := LLMObsCustomEvalConfigUpdateData{} + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *LLMObsCustomEvalConfigUpdateData) GetAttributes() LLMObsCustomEvalConfigUpdateAttributes { + if o == nil { + var ret LLMObsCustomEvalConfigUpdateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateData) GetAttributesOk() (*LLMObsCustomEvalConfigUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *LLMObsCustomEvalConfigUpdateData) SetAttributes(v LLMObsCustomEvalConfigUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUpdateData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUpdateData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LLMObsCustomEvalConfigUpdateData) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value. +func (o *LLMObsCustomEvalConfigUpdateData) GetType() LLMObsCustomEvalConfigType { + if o == nil { + var ret LLMObsCustomEvalConfigType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateData) GetTypeOk() (*LLMObsCustomEvalConfigType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *LLMObsCustomEvalConfigUpdateData) SetType(v LLMObsCustomEvalConfigType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Id != nil { + toSerialize["id"] = o.Id + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *LLMObsCustomEvalConfigUpdateAttributes `json:"attributes"` + Id *string `json:"id,omitempty"` + Type *LLMObsCustomEvalConfigType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_update_request.go b/api/datadogV2/model_llm_obs_custom_eval_config_update_request.go new file mode 100644 index 00000000000..9fa4d3a4f8b --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_update_request.go @@ -0,0 +1,110 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigUpdateRequest Request to create or update a custom LLM Observability evaluator configuration. +type LLMObsCustomEvalConfigUpdateRequest struct { + // Data object for creating or updating a custom LLM Observability evaluator configuration. + Data LLMObsCustomEvalConfigUpdateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigUpdateRequest instantiates a new LLMObsCustomEvalConfigUpdateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigUpdateRequest(data LLMObsCustomEvalConfigUpdateData) *LLMObsCustomEvalConfigUpdateRequest { + this := LLMObsCustomEvalConfigUpdateRequest{} + this.Data = data + return &this +} + +// NewLLMObsCustomEvalConfigUpdateRequestWithDefaults instantiates a new LLMObsCustomEvalConfigUpdateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigUpdateRequestWithDefaults() *LLMObsCustomEvalConfigUpdateRequest { + this := LLMObsCustomEvalConfigUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *LLMObsCustomEvalConfigUpdateRequest) GetData() LLMObsCustomEvalConfigUpdateData { + if o == nil { + var ret LLMObsCustomEvalConfigUpdateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUpdateRequest) GetDataOk() (*LLMObsCustomEvalConfigUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *LLMObsCustomEvalConfigUpdateRequest) SetData(v LLMObsCustomEvalConfigUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *LLMObsCustomEvalConfigUpdateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_user.go b/api/datadogV2/model_llm_obs_custom_eval_config_user.go new file mode 100644 index 00000000000..04d4bfed40d --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_user.go @@ -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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigUser A Datadog user associated with a custom evaluator configuration. +type LLMObsCustomEvalConfigUser struct { + // Email address of the user. + Email *string `json:"email,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigUser instantiates a new LLMObsCustomEvalConfigUser object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigUser() *LLMObsCustomEvalConfigUser { + this := LLMObsCustomEvalConfigUser{} + return &this +} + +// NewLLMObsCustomEvalConfigUserWithDefaults instantiates a new LLMObsCustomEvalConfigUser object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigUserWithDefaults() *LLMObsCustomEvalConfigUser { + this := LLMObsCustomEvalConfigUser{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigUser) GetEmail() string { + if o == nil || o.Email == nil { + var ret string + return ret + } + return *o.Email +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigUser) GetEmailOk() (*string, bool) { + if o == nil || o.Email == nil { + return nil, false + } + return o.Email, true +} + +// HasEmail returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigUser) HasEmail() bool { + return o != nil && o.Email != nil +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *LLMObsCustomEvalConfigUser) SetEmail(v string) { + o.Email = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigUser) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Email != nil { + toSerialize["email"] = o.Email + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigUser) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Email *string `json:"email,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"email"}) + } else { + return err + } + o.Email = all.Email + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_llm_obs_custom_eval_config_vertex_ai_options.go b/api/datadogV2/model_llm_obs_custom_eval_config_vertex_ai_options.go new file mode 100644 index 00000000000..65ed5e14c74 --- /dev/null +++ b/api/datadogV2/model_llm_obs_custom_eval_config_vertex_ai_options.go @@ -0,0 +1,137 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LLMObsCustomEvalConfigVertexAIOptions Google Vertex AI-specific options for LLM provider configuration. +type LLMObsCustomEvalConfigVertexAIOptions struct { + // Google Cloud region. + Location *string `json:"location,omitempty"` + // Google Cloud project ID. + Project *string `json:"project,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewLLMObsCustomEvalConfigVertexAIOptions instantiates a new LLMObsCustomEvalConfigVertexAIOptions object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewLLMObsCustomEvalConfigVertexAIOptions() *LLMObsCustomEvalConfigVertexAIOptions { + this := LLMObsCustomEvalConfigVertexAIOptions{} + return &this +} + +// NewLLMObsCustomEvalConfigVertexAIOptionsWithDefaults instantiates a new LLMObsCustomEvalConfigVertexAIOptions object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewLLMObsCustomEvalConfigVertexAIOptionsWithDefaults() *LLMObsCustomEvalConfigVertexAIOptions { + this := LLMObsCustomEvalConfigVertexAIOptions{} + return &this +} + +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigVertexAIOptions) GetLocation() string { + if o == nil || o.Location == nil { + var ret string + return ret + } + return *o.Location +} + +// GetLocationOk returns a tuple with the Location field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigVertexAIOptions) GetLocationOk() (*string, bool) { + if o == nil || o.Location == nil { + return nil, false + } + return o.Location, true +} + +// HasLocation returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigVertexAIOptions) HasLocation() bool { + return o != nil && o.Location != nil +} + +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *LLMObsCustomEvalConfigVertexAIOptions) SetLocation(v string) { + o.Location = &v +} + +// GetProject returns the Project field value if set, zero value otherwise. +func (o *LLMObsCustomEvalConfigVertexAIOptions) GetProject() string { + if o == nil || o.Project == nil { + var ret string + return ret + } + return *o.Project +} + +// GetProjectOk returns a tuple with the Project field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LLMObsCustomEvalConfigVertexAIOptions) GetProjectOk() (*string, bool) { + if o == nil || o.Project == nil { + return nil, false + } + return o.Project, true +} + +// HasProject returns a boolean if a field has been set. +func (o *LLMObsCustomEvalConfigVertexAIOptions) HasProject() bool { + return o != nil && o.Project != nil +} + +// SetProject gets a reference to the given string and assigns it to the Project field. +func (o *LLMObsCustomEvalConfigVertexAIOptions) SetProject(v string) { + o.Project = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o LLMObsCustomEvalConfigVertexAIOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Location != nil { + toSerialize["location"] = o.Location + } + if o.Project != nil { + toSerialize["project"] = o.Project + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *LLMObsCustomEvalConfigVertexAIOptions) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Location *string `json:"location,omitempty"` + Project *string `json:"project,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"location", "project"}) + } else { + return err + } + o.Location = all.Location + o.Project = all.Project + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_signal_update_attributes.go b/api/datadogV2/model_security_monitoring_signal_update_attributes.go new file mode 100644 index 00000000000..c84fb493c74 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_signal_update_attributes.go @@ -0,0 +1,259 @@ +// 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. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalUpdateAttributes Attributes for updating the triage state or assignee of a security signal. +type SecurityMonitoringSignalUpdateAttributes struct { + // Optional comment to display on archived signals. + ArchiveComment *string `json:"archive_comment,omitempty"` + // Reason a signal is archived. + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + // Object representing a given user entity. + Assignee *SecurityMonitoringTriageUser `json:"assignee,omitempty"` + // The new triage state of the signal. + State *SecurityMonitoringSignalState `json:"state,omitempty"` + // Version of the updated signal. If server side version is higher, update will be rejected. + Version *int64 `json:"version,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringSignalUpdateAttributes instantiates a new SecurityMonitoringSignalUpdateAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringSignalUpdateAttributes() *SecurityMonitoringSignalUpdateAttributes { + this := SecurityMonitoringSignalUpdateAttributes{} + return &this +} + +// NewSecurityMonitoringSignalUpdateAttributesWithDefaults instantiates a new SecurityMonitoringSignalUpdateAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringSignalUpdateAttributesWithDefaults() *SecurityMonitoringSignalUpdateAttributes { + this := SecurityMonitoringSignalUpdateAttributes{} + return &this +} + +// GetArchiveComment returns the ArchiveComment field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateAttributes) GetArchiveComment() string { + if o == nil || o.ArchiveComment == nil { + var ret string + return ret + } + return *o.ArchiveComment +} + +// GetArchiveCommentOk returns a tuple with the ArchiveComment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) GetArchiveCommentOk() (*string, bool) { + if o == nil || o.ArchiveComment == nil { + return nil, false + } + return o.ArchiveComment, true +} + +// HasArchiveComment returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) HasArchiveComment() bool { + return o != nil && o.ArchiveComment != nil +} + +// SetArchiveComment gets a reference to the given string and assigns it to the ArchiveComment field. +func (o *SecurityMonitoringSignalUpdateAttributes) SetArchiveComment(v string) { + o.ArchiveComment = &v +} + +// GetArchiveReason returns the ArchiveReason field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateAttributes) GetArchiveReason() SecurityMonitoringSignalArchiveReason { + if o == nil || o.ArchiveReason == nil { + var ret SecurityMonitoringSignalArchiveReason + return ret + } + return *o.ArchiveReason +} + +// GetArchiveReasonOk returns a tuple with the ArchiveReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) GetArchiveReasonOk() (*SecurityMonitoringSignalArchiveReason, bool) { + if o == nil || o.ArchiveReason == nil { + return nil, false + } + return o.ArchiveReason, true +} + +// HasArchiveReason returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) HasArchiveReason() bool { + return o != nil && o.ArchiveReason != nil +} + +// SetArchiveReason gets a reference to the given SecurityMonitoringSignalArchiveReason and assigns it to the ArchiveReason field. +func (o *SecurityMonitoringSignalUpdateAttributes) SetArchiveReason(v SecurityMonitoringSignalArchiveReason) { + o.ArchiveReason = &v +} + +// GetAssignee returns the Assignee field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateAttributes) GetAssignee() SecurityMonitoringTriageUser { + if o == nil || o.Assignee == nil { + var ret SecurityMonitoringTriageUser + return ret + } + return *o.Assignee +} + +// GetAssigneeOk returns a tuple with the Assignee field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) GetAssigneeOk() (*SecurityMonitoringTriageUser, bool) { + if o == nil || o.Assignee == nil { + return nil, false + } + return o.Assignee, true +} + +// HasAssignee returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) HasAssignee() bool { + return o != nil && o.Assignee != nil +} + +// SetAssignee gets a reference to the given SecurityMonitoringTriageUser and assigns it to the Assignee field. +func (o *SecurityMonitoringSignalUpdateAttributes) SetAssignee(v SecurityMonitoringTriageUser) { + o.Assignee = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateAttributes) GetState() SecurityMonitoringSignalState { + if o == nil || o.State == nil { + var ret SecurityMonitoringSignalState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) GetStateOk() (*SecurityMonitoringSignalState, bool) { + if o == nil || o.State == nil { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) HasState() bool { + return o != nil && o.State != nil +} + +// SetState gets a reference to the given SecurityMonitoringSignalState and assigns it to the State field. +func (o *SecurityMonitoringSignalUpdateAttributes) SetState(v SecurityMonitoringSignalState) { + o.State = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateAttributes) GetVersion() int64 { + if o == nil || o.Version == nil { + var ret int64 + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) GetVersionOk() (*int64, bool) { + if o == nil || o.Version == nil { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateAttributes) HasVersion() bool { + return o != nil && o.Version != nil +} + +// SetVersion gets a reference to the given int64 and assigns it to the Version field. +func (o *SecurityMonitoringSignalUpdateAttributes) SetVersion(v int64) { + o.Version = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.ArchiveComment != nil { + toSerialize["archive_comment"] = o.ArchiveComment + } + if o.ArchiveReason != nil { + toSerialize["archive_reason"] = o.ArchiveReason + } + if o.Assignee != nil { + toSerialize["assignee"] = o.Assignee + } + if o.State != nil { + toSerialize["state"] = o.State + } + if o.Version != nil { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ArchiveComment *string `json:"archive_comment,omitempty"` + ArchiveReason *SecurityMonitoringSignalArchiveReason `json:"archive_reason,omitempty"` + Assignee *SecurityMonitoringTriageUser `json:"assignee,omitempty"` + State *SecurityMonitoringSignalState `json:"state,omitempty"` + Version *int64 `json:"version,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"archive_comment", "archive_reason", "assignee", "state", "version"}) + } else { + return err + } + + hasInvalidField := false + o.ArchiveComment = all.ArchiveComment + if all.ArchiveReason != nil && !all.ArchiveReason.IsValid() { + hasInvalidField = true + } else { + o.ArchiveReason = all.ArchiveReason + } + if all.Assignee != nil && all.Assignee.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Assignee = all.Assignee + if all.State != nil && !all.State.IsValid() { + hasInvalidField = true + } else { + o.State = all.State + } + o.Version = all.Version + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_signal_update_data.go b/api/datadogV2/model_security_monitoring_signal_update_data.go new file mode 100644 index 00000000000..a7c9b6d635b --- /dev/null +++ b/api/datadogV2/model_security_monitoring_signal_update_data.go @@ -0,0 +1,153 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalUpdateData Data containing the triage state or assignee update for a security signal. +type SecurityMonitoringSignalUpdateData struct { + // Attributes for updating the triage state or assignee of a security signal. + Attributes SecurityMonitoringSignalUpdateAttributes `json:"attributes"` + // The type of event. + Type *SecurityMonitoringSignalMetadataType `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringSignalUpdateData instantiates a new SecurityMonitoringSignalUpdateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringSignalUpdateData(attributes SecurityMonitoringSignalUpdateAttributes) *SecurityMonitoringSignalUpdateData { + this := SecurityMonitoringSignalUpdateData{} + this.Attributes = attributes + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar + return &this +} + +// NewSecurityMonitoringSignalUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalUpdateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringSignalUpdateDataWithDefaults() *SecurityMonitoringSignalUpdateData { + this := SecurityMonitoringSignalUpdateData{} + var typeVar SecurityMonitoringSignalMetadataType = SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringSignalUpdateData) GetAttributes() SecurityMonitoringSignalUpdateAttributes { + if o == nil { + var ret SecurityMonitoringSignalUpdateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateData) GetAttributesOk() (*SecurityMonitoringSignalUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringSignalUpdateData) SetAttributes(v SecurityMonitoringSignalUpdateAttributes) { + o.Attributes = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalUpdateData) GetType() SecurityMonitoringSignalMetadataType { + if o == nil || o.Type == nil { + var ret SecurityMonitoringSignalMetadataType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateData) GetTypeOk() (*SecurityMonitoringSignalMetadataType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalUpdateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SecurityMonitoringSignalMetadataType and assigns it to the Type field. +func (o *SecurityMonitoringSignalUpdateData) SetType(v SecurityMonitoringSignalMetadataType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SecurityMonitoringSignalUpdateAttributes `json:"attributes"` + Type *SecurityMonitoringSignalMetadataType `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_signal_update_request.go b/api/datadogV2/model_security_monitoring_signal_update_request.go new file mode 100644 index 00000000000..56bb6fb9283 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_signal_update_request.go @@ -0,0 +1,110 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalUpdateRequest Request body for updating the triage state or assignee of a security signal. +type SecurityMonitoringSignalUpdateRequest struct { + // Data containing the triage state or assignee update for a security signal. + Data SecurityMonitoringSignalUpdateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringSignalUpdateRequest instantiates a new SecurityMonitoringSignalUpdateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringSignalUpdateRequest(data SecurityMonitoringSignalUpdateData) *SecurityMonitoringSignalUpdateRequest { + this := SecurityMonitoringSignalUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalUpdateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringSignalUpdateRequestWithDefaults() *SecurityMonitoringSignalUpdateRequest { + this := SecurityMonitoringSignalUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalUpdateRequest) GetData() SecurityMonitoringSignalUpdateData { + if o == nil { + var ret SecurityMonitoringSignalUpdateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalUpdateRequest) GetDataOk() (*SecurityMonitoringSignalUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalUpdateRequest) SetData(v SecurityMonitoringSignalUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *SecurityMonitoringSignalUpdateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_signals_bulk_update_data.go b/api/datadogV2/model_security_monitoring_signals_bulk_update_data.go new file mode 100644 index 00000000000..3b16c22014f --- /dev/null +++ b/api/datadogV2/model_security_monitoring_signals_bulk_update_data.go @@ -0,0 +1,185 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalsBulkUpdateData Data for updating a single security signal in a bulk update operation. +type SecurityMonitoringSignalsBulkUpdateData struct { + // Attributes for updating the triage state or assignee of a security signal. + Attributes SecurityMonitoringSignalUpdateAttributes `json:"attributes"` + // The unique ID of the security signal. + Id string `json:"id"` + // The type of event. + Type *SecurityMonitoringSignalType `json:"type,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringSignalsBulkUpdateData instantiates a new SecurityMonitoringSignalsBulkUpdateData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringSignalsBulkUpdateData(attributes SecurityMonitoringSignalUpdateAttributes, id string) *SecurityMonitoringSignalsBulkUpdateData { + this := SecurityMonitoringSignalsBulkUpdateData{} + this.Attributes = attributes + this.Id = id + var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL + this.Type = &typeVar + return &this +} + +// NewSecurityMonitoringSignalsBulkUpdateDataWithDefaults instantiates a new SecurityMonitoringSignalsBulkUpdateData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringSignalsBulkUpdateDataWithDefaults() *SecurityMonitoringSignalsBulkUpdateData { + this := SecurityMonitoringSignalsBulkUpdateData{} + var typeVar SecurityMonitoringSignalType = SECURITYMONITORINGSIGNALTYPE_SIGNAL + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetAttributes() SecurityMonitoringSignalUpdateAttributes { + if o == nil { + var ret SecurityMonitoringSignalUpdateAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetAttributesOk() (*SecurityMonitoringSignalUpdateAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *SecurityMonitoringSignalsBulkUpdateData) SetAttributes(v SecurityMonitoringSignalUpdateAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *SecurityMonitoringSignalsBulkUpdateData) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetType() SecurityMonitoringSignalType { + if o == nil || o.Type == nil { + var ret SecurityMonitoringSignalType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsBulkUpdateData) GetTypeOk() (*SecurityMonitoringSignalType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *SecurityMonitoringSignalsBulkUpdateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given SecurityMonitoringSignalType and assigns it to the Type field. +func (o *SecurityMonitoringSignalsBulkUpdateData) SetType(v SecurityMonitoringSignalType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsBulkUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsBulkUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *SecurityMonitoringSignalUpdateAttributes `json:"attributes"` + Id *string `json:"id"` + Type *SecurityMonitoringSignalType `json:"type,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_security_monitoring_signals_bulk_update_request.go b/api/datadogV2/model_security_monitoring_signals_bulk_update_request.go new file mode 100644 index 00000000000..0063ebf1bd0 --- /dev/null +++ b/api/datadogV2/model_security_monitoring_signals_bulk_update_request.go @@ -0,0 +1,101 @@ +// 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. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// SecurityMonitoringSignalsBulkUpdateRequest Request body for updating multiple attributes of multiple security signals. +type SecurityMonitoringSignalsBulkUpdateRequest struct { + // An array of signal updates. + Data []SecurityMonitoringSignalsBulkUpdateData `json:"data"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} `json:"-"` +} + +// NewSecurityMonitoringSignalsBulkUpdateRequest instantiates a new SecurityMonitoringSignalsBulkUpdateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewSecurityMonitoringSignalsBulkUpdateRequest(data []SecurityMonitoringSignalsBulkUpdateData) *SecurityMonitoringSignalsBulkUpdateRequest { + this := SecurityMonitoringSignalsBulkUpdateRequest{} + this.Data = data + return &this +} + +// NewSecurityMonitoringSignalsBulkUpdateRequestWithDefaults instantiates a new SecurityMonitoringSignalsBulkUpdateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewSecurityMonitoringSignalsBulkUpdateRequestWithDefaults() *SecurityMonitoringSignalsBulkUpdateRequest { + this := SecurityMonitoringSignalsBulkUpdateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *SecurityMonitoringSignalsBulkUpdateRequest) GetData() []SecurityMonitoringSignalsBulkUpdateData { + if o == nil { + var ret []SecurityMonitoringSignalsBulkUpdateData + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SecurityMonitoringSignalsBulkUpdateRequest) GetDataOk() (*[]SecurityMonitoringSignalsBulkUpdateData, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *SecurityMonitoringSignalsBulkUpdateRequest) SetData(v []SecurityMonitoringSignalsBulkUpdateData) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o SecurityMonitoringSignalsBulkUpdateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *SecurityMonitoringSignalsBulkUpdateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *[]SecurityMonitoringSignalsBulkUpdateData `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/check-examples.sh b/check-examples.sh deleted file mode 100755 index fcba52d981d..00000000000 --- a/check-examples.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# trap "rm -rf build" EXIT - -for f in examples/*/*/*.go ; do - df="build/$(dirname "$f")/$(basename "$f" .go)" - mkdir -p "$df" - cp "$f" "$df/main.go" -done - - -if (find ./build/examples/*/*/* -type d -print0 | xargs -0 go build -o /dev/null -ldflags "-s -w -linkmode internal"); then - echo -e "Examples are buildable" -else - echo -e "Failed to build examples" - exit 1 -fi diff --git a/examples/v2/llm-observability/DeleteLLMObsCustomEvalConfig.go b/examples/v2/llm-observability/DeleteLLMObsCustomEvalConfig.go new file mode 100644 index 00000000000..1a463c58e0b --- /dev/null +++ b/examples/v2/llm-observability/DeleteLLMObsCustomEvalConfig.go @@ -0,0 +1,26 @@ +// Delete a custom evaluator configuration returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteLLMObsCustomEvalConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLLMObservabilityApi(apiClient) + r, err := api.DeleteLLMObsCustomEvalConfig(ctx, "eval_name") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LLMObservabilityApi.DeleteLLMObsCustomEvalConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/llm-observability/GetLLMObsCustomEvalConfig.go b/examples/v2/llm-observability/GetLLMObsCustomEvalConfig.go new file mode 100644 index 00000000000..0e3ebabff1c --- /dev/null +++ b/examples/v2/llm-observability/GetLLMObsCustomEvalConfig.go @@ -0,0 +1,30 @@ +// Get a custom evaluator configuration returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetLLMObsCustomEvalConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLLMObservabilityApi(apiClient) + resp, r, err := api.GetLLMObsCustomEvalConfig(ctx, "eval_name") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LLMObservabilityApi.GetLLMObsCustomEvalConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LLMObservabilityApi.GetLLMObsCustomEvalConfig`:\n%s\n", responseContent) +} diff --git a/examples/v2/llm-observability/UpdateLLMObsCustomEvalConfig.go b/examples/v2/llm-observability/UpdateLLMObsCustomEvalConfig.go new file mode 100644 index 00000000000..5f64eb304f8 --- /dev/null +++ b/examples/v2/llm-observability/UpdateLLMObsCustomEvalConfig.go @@ -0,0 +1,105 @@ +// Create or update a custom evaluator configuration returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.LLMObsCustomEvalConfigUpdateRequest{ + Data: datadogV2.LLMObsCustomEvalConfigUpdateData{ + Attributes: datadogV2.LLMObsCustomEvalConfigUpdateAttributes{ + Category: datadog.PtrString("Custom"), + EvalName: datadog.PtrString("my-custom-evaluator"), + LlmJudgeConfig: &datadogV2.LLMObsCustomEvalConfigLLMJudgeConfig{ + AssessmentCriteria: &datadogV2.LLMObsCustomEvalConfigAssessmentCriteria{ + MaxThreshold: *datadog.NewNullableFloat64(datadog.PtrFloat64(1.0)), + MinThreshold: *datadog.NewNullableFloat64(datadog.PtrFloat64(0.7)), + PassValues: *datadog.NewNullableList(&[]string{ + "pass", + "yes", + }), + PassWhen: *datadog.NewNullableBool(datadog.PtrBool(true)), + }, + InferenceParams: datadogV2.LLMObsCustomEvalConfigInferenceParams{ + FrequencyPenalty: datadog.PtrFloat64(0.0), + MaxTokens: datadog.PtrInt64(1024), + PresencePenalty: datadog.PtrFloat64(0.0), + Temperature: datadog.PtrFloat64(0.7), + TopK: datadog.PtrInt64(50), + TopP: datadog.PtrFloat64(1.0), + }, + LastUsedLibraryPromptTemplateName: *datadog.NewNullableString(datadog.PtrString("sentiment-analysis-v1")), + ModifiedLibraryPromptTemplate: *datadog.NewNullableBool(datadog.PtrBool(false)), + OutputSchema: nil, + ParsingType: datadogV2.LLMOBSCUSTOMEVALCONFIGPARSINGTYPE_STRUCTURED_OUTPUT.Ptr(), + PromptTemplate: []datadogV2.LLMObsCustomEvalConfigPromptMessage{ + { + Content: datadog.PtrString("Rate the quality of the following response:"), + Contents: []datadogV2.LLMObsCustomEvalConfigPromptContent{ + { + Type: "text", + Value: datadogV2.LLMObsCustomEvalConfigPromptContentValue{ + Text: datadog.PtrString("What is the sentiment of this review?"), + ToolCall: &datadogV2.LLMObsCustomEvalConfigPromptToolCall{ + Arguments: datadog.PtrString(`{"location": "San Francisco"}`), + Id: datadog.PtrString("call_abc123"), + Name: datadog.PtrString("get_weather"), + Type: datadog.PtrString("function"), + }, + ToolCallResult: &datadogV2.LLMObsCustomEvalConfigPromptToolResult{ + Name: datadog.PtrString("get_weather"), + Result: datadog.PtrString("sunny, 72F"), + ToolId: datadog.PtrString("call_abc123"), + Type: datadog.PtrString("function"), + }, + }, + }, + }, + Role: "user", + }, + }, + }, + LlmProvider: &datadogV2.LLMObsCustomEvalConfigLLMProvider{ + Bedrock: &datadogV2.LLMObsCustomEvalConfigBedrockOptions{ + Region: datadog.PtrString("us-east-1"), + }, + IntegrationAccountId: datadog.PtrString("my-account-id"), + IntegrationProvider: datadogV2.LLMOBSCUSTOMEVALCONFIGINTEGRATIONPROVIDER_OPENAI.Ptr(), + ModelName: datadog.PtrString("gpt-4o"), + VertexAi: &datadogV2.LLMObsCustomEvalConfigVertexAIOptions{ + Location: datadog.PtrString("us-central1"), + Project: datadog.PtrString("my-gcp-project"), + }, + }, + Target: datadogV2.LLMObsCustomEvalConfigTarget{ + ApplicationName: "my-llm-app", + Enabled: true, + EvalScope: datadogV2.LLMOBSCUSTOMEVALCONFIGEVALSCOPE_SPAN.Ptr(), + Filter: *datadog.NewNullableString(datadog.PtrString("@service:my-service")), + RootSpansOnly: *datadog.NewNullableBool(datadog.PtrBool(true)), + SamplingPercentage: *datadog.NewNullableFloat64(datadog.PtrFloat64(50.0)), + }, + }, + Id: datadog.PtrString("my-custom-evaluator"), + Type: datadogV2.LLMOBSCUSTOMEVALCONFIGTYPE_EVALUATOR_CONFIG, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateLLMObsCustomEvalConfig", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLLMObservabilityApi(apiClient) + r, err := api.UpdateLLMObsCustomEvalConfig(ctx, "eval_name", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LLMObservabilityApi.UpdateLLMObsCustomEvalConfig`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/security-monitoring/BulkEditSecurityMonitoringSignals.go b/examples/v2/security-monitoring/BulkEditSecurityMonitoringSignals.go new file mode 100644 index 00000000000..eece79b95cd --- /dev/null +++ b/examples/v2/security-monitoring/BulkEditSecurityMonitoringSignals.go @@ -0,0 +1,44 @@ +// Bulk update security signals returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.SecurityMonitoringSignalsBulkUpdateRequest{ + Data: []datadogV2.SecurityMonitoringSignalsBulkUpdateData{ + { + Attributes: datadogV2.SecurityMonitoringSignalUpdateAttributes{ + ArchiveReason: datadogV2.SECURITYMONITORINGSIGNALARCHIVEREASON_NONE.Ptr(), + Assignee: &datadogV2.SecurityMonitoringTriageUser{ + Uuid: "773b045d-ccf8-4808-bd3b-955ef6a8c940", + }, + State: datadogV2.SECURITYMONITORINGSIGNALSTATE_OPEN.Ptr(), + }, + Id: "AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA", + Type: datadogV2.SECURITYMONITORINGSIGNALTYPE_SIGNAL.Ptr(), + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.BulkEditSecurityMonitoringSignals(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.BulkEditSecurityMonitoringSignals`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.BulkEditSecurityMonitoringSignals`:\n%s\n", responseContent) +} diff --git a/examples/v2/security-monitoring/EditSecurityMonitoringSignal.go b/examples/v2/security-monitoring/EditSecurityMonitoringSignal.go new file mode 100644 index 00000000000..882f45eb5e6 --- /dev/null +++ b/examples/v2/security-monitoring/EditSecurityMonitoringSignal.go @@ -0,0 +1,41 @@ +// Update security signal triage state or assignee returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.SecurityMonitoringSignalUpdateRequest{ + Data: datadogV2.SecurityMonitoringSignalUpdateData{ + Attributes: datadogV2.SecurityMonitoringSignalUpdateAttributes{ + ArchiveReason: datadogV2.SECURITYMONITORINGSIGNALARCHIVEREASON_NONE.Ptr(), + Assignee: &datadogV2.SecurityMonitoringTriageUser{ + Uuid: "773b045d-ccf8-4808-bd3b-955ef6a8c940", + }, + State: datadogV2.SECURITYMONITORINGSIGNALSTATE_OPEN.Ptr(), + }, + Type: datadogV2.SECURITYMONITORINGSIGNALMETADATATYPE_SIGNAL_METADATA.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewSecurityMonitoringApi(apiClient) + resp, r, err := api.EditSecurityMonitoringSignal(ctx, "signal_id", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.EditSecurityMonitoringSignal`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.EditSecurityMonitoringSignal`:\n%s\n", responseContent) +} diff --git a/scripts/build-examples-group.sh b/scripts/build-examples-group.sh new file mode 100755 index 00000000000..21491d5a6b5 --- /dev/null +++ b/scripts/build-examples-group.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -e + +GROUP=${1:?usage: build-examples-group.sh } +EXAMPLES_PER_GROUP=${EXAMPLES_PER_GROUP:-400} + +ALL_EXAMPLES=() +while IFS= read -r f; do ALL_EXAMPLES+=("$f"); done < <(find examples -mindepth 3 -maxdepth 3 -name "*.go" | sort) +TOTAL=${#ALL_EXAMPLES[@]} + +START=$(( (GROUP - 1) * EXAMPLES_PER_GROUP )) +SLICE=("${ALL_EXAMPLES[@]:$START:$EXAMPLES_PER_GROUP}") + +echo "Building group $GROUP: examples $((START + 1))-$((START + ${#SLICE[@]})) of $TOTAL" + +for f in "${SLICE[@]}"; do + df="build/$(dirname "$f")/$(basename "$f" .go)" + mkdir -p "$df" + cp "$f" "$df/main.go" +done + +if go build -o /dev/null -ldflags "-s -w -linkmode internal" ./build/examples/*/*/*; then + echo "Examples are buildable" +else + echo "Failed to build examples" + exit 1 +fi diff --git a/scripts/prepare-examples.sh b/scripts/prepare-examples.sh new file mode 100755 index 00000000000..7577ead1775 --- /dev/null +++ b/scripts/prepare-examples.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -e + +EXAMPLES_PER_GROUP=${EXAMPLES_PER_GROUP:-400} + +ALL_EXAMPLES=() +while IFS= read -r f; do ALL_EXAMPLES+=("$f"); done < <(find examples -mindepth 3 -maxdepth 3 -name "*.go" | sort) +TOTAL=${#ALL_EXAMPLES[@]} +NUM_GROUPS=$(( (TOTAL + EXAMPLES_PER_GROUP - 1) / EXAMPLES_PER_GROUP )) + +echo "Total examples: $TOTAL, groups: $NUM_GROUPS (max $EXAMPLES_PER_GROUP per group)" + +MATRIX_JSON="[" +for i in $(seq 1 "$NUM_GROUPS"); do + [ "$i" -gt 1 ] && MATRIX_JSON+="," + MATRIX_JSON+="$i" +done +MATRIX_JSON+="]" + +echo "matrix=$MATRIX_JSON" +if [ -n "${GITHUB_OUTPUT:-}" ]; then + echo "matrix=$MATRIX_JSON" >> "$GITHUB_OUTPUT" +fi diff --git a/run-tests.sh b/scripts/run-tests.sh similarity index 86% rename from run-tests.sh rename to scripts/run-tests.sh index bcf77acd79f..43313504a87 100755 --- a/run-tests.sh +++ b/scripts/run-tests.sh @@ -23,24 +23,26 @@ fi # make sure the below installed dependencies don't get added to go.mod/go.sum # unfortunately there's no better way to fix this than change directory # this might get solved in Go 1.14: https://github.com/golang/go/issues/30515 +echo "Installing gotestsum" cd "$(mktemp -d)" -GO111MODULE=on go install honnef.co/go/tools/cmd/staticcheck@latest GO111MODULE=on go install gotest.tools/gotestsum@latest cd - -staticcheck -checks -SA1009 ./api/... +echo "Running mod tidy and cleanup test cache" go mod tidy go clean -testcache # Run the same in tests submodule cd tests -staticcheck -checks inherit,-SA1019 ./... +echo "Running mod tidy and cleanup test cache in test module" go mod tidy go clean -testcache if [ "$RECORD" == "none" ]; then + echo "Running with no RECORD" gotestsum --rerun-fails=1 --format short-verbose --packages ./... -- -timeout=20m $TESTARGS else + echo "Running with RECORD" gotestsum --format short-verbose --packages ./... -- $TESTARGS fi diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 360b35d9759..d2656023ce4 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -45,6 +45,7 @@ var apiMappings = map[string]map[string]reflect.Value{ }, "v2": { "FleetAutomationApi": reflect.ValueOf(datadogV2.NewFleetAutomationApi), + "LLMObservabilityApi": reflect.ValueOf(datadogV2.NewLLMObservabilityApi), "ActionsDatastoresApi": reflect.ValueOf(datadogV2.NewActionsDatastoresApi), "ActionConnectionApi": reflect.ValueOf(datadogV2.NewActionConnectionApi), "AgentlessScanningApi": reflect.ValueOf(datadogV2.NewAgentlessScanningApi), @@ -102,7 +103,6 @@ var apiMappings = map[string]map[string]reflect.Value{ "FastlyIntegrationApi": reflect.ValueOf(datadogV2.NewFastlyIntegrationApi), "OktaIntegrationApi": reflect.ValueOf(datadogV2.NewOktaIntegrationApi), "IPAllowlistApi": reflect.ValueOf(datadogV2.NewIPAllowlistApi), - "LLMObservabilityApi": reflect.ValueOf(datadogV2.NewLLMObservabilityApi), "LogsApi": reflect.ValueOf(datadogV2.NewLogsApi), "LogsArchivesApi": reflect.ValueOf(datadogV2.NewLogsArchivesApi), "LogsCustomDestinationsApi": reflect.ValueOf(datadogV2.NewLogsCustomDestinationsApi), diff --git a/tests/scenarios/features/v2/llm_observability.feature b/tests/scenarios/features/v2/llm_observability.feature index a3906289988..dc0a15364b9 100644 --- a/tests/scenarios/features/v2/llm_observability.feature +++ b/tests/scenarios/features/v2/llm_observability.feature @@ -175,6 +175,42 @@ Feature: LLM Observability 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 + And new "UpdateLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "Custom", "eval_name": "my-custom-evaluator", "llm_judge_config": {"assessment_criteria": {"max_threshold": 1.0, "min_threshold": 0.7, "pass_values": ["pass", "yes"], "pass_when": true}, "inference_params": {"frequency_penalty": 0.0, "max_tokens": 1024, "presence_penalty": 0.0, "temperature": 0.7, "top_k": 50, "top_p": 1.0}, "last_used_library_prompt_template_name": "sentiment-analysis-v1", "modified_library_prompt_template": false, "output_schema": null, "parsing_type": "structured_output", "prompt_template": [{"content": "Rate the quality of the following response:", "contents": [{"type": "text", "value": {"text": "What is the sentiment of this review?", "tool_call": {"arguments": "{\"location\": \"San Francisco\"}", "id": "call_abc123", "name": "get_weather", "type": "function"}, "tool_call_result": {"name": "get_weather", "result": "sunny, 72F", "tool_id": "call_abc123", "type": "function"}}}], "role": "user"}]}, "llm_provider": {"bedrock": {"region": "us-east-1"}, "integration_account_id": "my-account-id", "integration_provider": "openai", "model_name": "gpt-4o", "vertex_ai": {"location": "us-central1", "project": "my-gcp-project"}}, "target": {"application_name": "my-llm-app", "enabled": true, "eval_scope": "span", "filter": "@service:my-service", "root_spans_only": true, "sampling_percentage": 50.0}}, "id": "my-custom-evaluator", "type": "evaluator_config"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Create or update a custom evaluator configuration returns "Not Found" response + Given operation "UpdateLLMObsCustomEvalConfig" enabled + And new "UpdateLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "Custom", "eval_name": "my-custom-evaluator", "llm_judge_config": {"assessment_criteria": {"max_threshold": 1.0, "min_threshold": 0.7, "pass_values": ["pass", "yes"], "pass_when": true}, "inference_params": {"frequency_penalty": 0.0, "max_tokens": 1024, "presence_penalty": 0.0, "temperature": 0.7, "top_k": 50, "top_p": 1.0}, "last_used_library_prompt_template_name": "sentiment-analysis-v1", "modified_library_prompt_template": false, "output_schema": null, "parsing_type": "structured_output", "prompt_template": [{"content": "Rate the quality of the following response:", "contents": [{"type": "text", "value": {"text": "What is the sentiment of this review?", "tool_call": {"arguments": "{\"location\": \"San Francisco\"}", "id": "call_abc123", "name": "get_weather", "type": "function"}, "tool_call_result": {"name": "get_weather", "result": "sunny, 72F", "tool_id": "call_abc123", "type": "function"}}}], "role": "user"}]}, "llm_provider": {"bedrock": {"region": "us-east-1"}, "integration_account_id": "my-account-id", "integration_provider": "openai", "model_name": "gpt-4o", "vertex_ai": {"location": "us-central1", "project": "my-gcp-project"}}, "target": {"application_name": "my-llm-app", "enabled": true, "eval_scope": "span", "filter": "@service:my-service", "root_spans_only": true, "sampling_percentage": 50.0}}, "id": "my-custom-evaluator", "type": "evaluator_config"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Create or update a custom evaluator configuration returns "OK" response + Given operation "UpdateLLMObsCustomEvalConfig" enabled + And new "UpdateLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "Custom", "eval_name": "my-custom-evaluator", "llm_judge_config": {"assessment_criteria": {"max_threshold": 1.0, "min_threshold": 0.7, "pass_values": ["pass", "yes"], "pass_when": true}, "inference_params": {"frequency_penalty": 0.0, "max_tokens": 1024, "presence_penalty": 0.0, "temperature": 0.7, "top_k": 50, "top_p": 1.0}, "last_used_library_prompt_template_name": "sentiment-analysis-v1", "modified_library_prompt_template": false, "output_schema": null, "parsing_type": "structured_output", "prompt_template": [{"content": "Rate the quality of the following response:", "contents": [{"type": "text", "value": {"text": "What is the sentiment of this review?", "tool_call": {"arguments": "{\"location\": \"San Francisco\"}", "id": "call_abc123", "name": "get_weather", "type": "function"}, "tool_call_result": {"name": "get_weather", "result": "sunny, 72F", "tool_id": "call_abc123", "type": "function"}}}], "role": "user"}]}, "llm_provider": {"bedrock": {"region": "us-east-1"}, "integration_account_id": "my-account-id", "integration_provider": "openai", "model_name": "gpt-4o", "vertex_ai": {"location": "us-central1", "project": "my-gcp-project"}}, "target": {"application_name": "my-llm-app", "enabled": true, "eval_scope": "span", "filter": "@service:my-service", "root_spans_only": true, "sampling_percentage": 50.0}}, "id": "my-custom-evaluator", "type": "evaluator_config"}} + 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 "Unprocessable Entity" response + Given operation "UpdateLLMObsCustomEvalConfig" enabled + And new "UpdateLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"category": "Custom", "eval_name": "my-custom-evaluator", "llm_judge_config": {"assessment_criteria": {"max_threshold": 1.0, "min_threshold": 0.7, "pass_values": ["pass", "yes"], "pass_when": true}, "inference_params": {"frequency_penalty": 0.0, "max_tokens": 1024, "presence_penalty": 0.0, "temperature": 0.7, "top_k": 50, "top_p": 1.0}, "last_used_library_prompt_template_name": "sentiment-analysis-v1", "modified_library_prompt_template": false, "output_schema": null, "parsing_type": "structured_output", "prompt_template": [{"content": "Rate the quality of the following response:", "contents": [{"type": "text", "value": {"text": "What is the sentiment of this review?", "tool_call": {"arguments": "{\"location\": \"San Francisco\"}", "id": "call_abc123", "name": "get_weather", "type": "function"}, "tool_call_result": {"name": "get_weather", "result": "sunny, 72F", "tool_id": "call_abc123", "type": "function"}}}], "role": "user"}]}, "llm_provider": {"bedrock": {"region": "us-east-1"}, "integration_account_id": "my-account-id", "integration_provider": "openai", "model_name": "gpt-4o", "vertex_ai": {"location": "us-central1", "project": "my-gcp-project"}}, "target": {"application_name": "my-llm-app", "enabled": true, "eval_scope": "span", "filter": "@service:my-service", "root_spans_only": true, "sampling_percentage": 50.0}}, "id": "my-custom-evaluator", "type": "evaluator_config"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + @generated @skip @team:DataDog/ml-observability Scenario: Delete LLM Observability dataset records returns "Bad Request" response Given operation "DeleteLLMObsDatasetRecords" enabled @@ -264,6 +300,30 @@ Feature: LLM Observability When the request is sent Then the response status is 204 No Content + @generated @skip @team:DataDog/ml-observability + Scenario: Delete a custom evaluator configuration returns "Bad Request" response + Given operation "DeleteLLMObsCustomEvalConfig" enabled + And new "DeleteLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete a custom evaluator configuration returns "No Content" response + Given operation "DeleteLLMObsCustomEvalConfig" enabled + And new "DeleteLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/ml-observability + Scenario: Delete a custom evaluator configuration returns "Not Found" response + Given operation "DeleteLLMObsCustomEvalConfig" enabled + And new "DeleteLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/ml-observability Scenario: Delete an LLM Observability annotation queue returns "No Content" response Given operation "DeleteLLMObsAnnotationQueue" enabled @@ -307,6 +367,30 @@ Feature: LLM Observability When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/ml-observability + Scenario: Get a custom evaluator configuration returns "Bad Request" response + Given operation "GetLLMObsCustomEvalConfig" enabled + And new "GetLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/ml-observability + Scenario: Get a custom evaluator configuration returns "Not Found" response + Given operation "GetLLMObsCustomEvalConfig" enabled + And new "GetLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/ml-observability + Scenario: Get a custom evaluator configuration returns "OK" response + Given operation "GetLLMObsCustomEvalConfig" enabled + And new "GetLLMObsCustomEvalConfig" request + And request contains "eval_name" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/ml-observability Scenario: Get annotated queue interactions returns "Bad Request" response Given operation "GetLLMObsAnnotatedInteractions" enabled diff --git a/tests/scenarios/features/v2/security_monitoring.feature b/tests/scenarios/features/v2/security_monitoring.feature index f6c7f395425..9c65c8a95bd 100644 --- a/tests/scenarios/features/v2/security_monitoring.feature +++ b/tests/scenarios/features/v2/security_monitoring.feature @@ -121,6 +121,20 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk update security signals returns "Bad Request" response + Given new "BulkEditSecurityMonitoringSignals" request + And body with value {"data": [{"attributes": {"archive_reason": "none", "assignee": {"uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"}, "state": "open"}, "id": "AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA", "type": "signal"}]} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/k9-cloud-siem + Scenario: Bulk update security signals returns "OK" response + Given new "BulkEditSecurityMonitoringSignals" request + And body with value {"data": [{"attributes": {"archive_reason": "none", "assignee": {"uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"}, "state": "open"}, "id": "AAAAAWgN8Xwgr1vKDQAAAABBV2dOOFh3ZzZobm1mWXJFYTR0OA", "type": "signal"}]} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-siem Scenario: Bulk update triage assignee of security signals returns "Bad Request" response Given operation "BulkEditSecurityMonitoringSignalsAssignee" enabled @@ -2232,6 +2246,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 201 OK + @skip @team:DataDog/k9-cloud-siem + Scenario: Update security signal triage state or assignee returns "Bad Request" response + Given new "EditSecurityMonitoringSignal" request + And request contains "signal_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"archive_reason": "none", "assignee": {"uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"}, "state": "open"}, "type": "signal_metadata"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/k9-cloud-siem + Scenario: Update security signal triage state or assignee returns "Not Found" response + Given new "EditSecurityMonitoringSignal" request + And request contains "signal_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"archive_reason": "none", "assignee": {"uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"}, "state": "open"}, "type": "signal_metadata"}} + When the request is sent + Then the response status is 404 Not Found + + @skip @team:DataDog/k9-cloud-siem + Scenario: Update security signal triage state or assignee returns "OK" response + Given new "EditSecurityMonitoringSignal" request + And request contains "signal_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"archive_reason": "none", "assignee": {"uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"}, "state": "open"}, "type": "signal_metadata"}} + When the request is sent + Then the response status is 200 OK + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-typescript @skip-validation @team:DataDog/k9-cloud-siem Scenario: Validate a detection rule returns "Bad Request" response Given new "ValidateSecurityMonitoringRule" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index bbfa27e028c..31f26b91091 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -135,6 +135,31 @@ "type": "safe" } }, + "DeleteLLMObsCustomEvalConfig": { + "tag": "LLM Observability", + "undo": { + "operationId": "UpdateLLMObsCustomEvalConfig", + "parameters": [ + { + "name": "eval_name", + "source": "path" + } + ], + "type": "unsafe" + } + }, + "GetLLMObsCustomEvalConfig": { + "tag": "LLM Observability", + "undo": { + "type": "safe" + } + }, + "UpdateLLMObsCustomEvalConfig": { + "tag": "LLM Observability", + "undo": { + "type": "idempotent" + } + }, "ListDatastores": { "tag": "Actions Datastores", "undo": { @@ -5674,6 +5699,12 @@ "type": "idempotent" } }, + "BulkEditSecurityMonitoringSignals": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "SearchSecurityMonitoringSignals": { "tag": "Security Monitoring", "undo": { @@ -5716,6 +5747,12 @@ "type": "safe" } }, + "EditSecurityMonitoringSignal": { + "tag": "Security Monitoring", + "undo": { + "type": "idempotent" + } + }, "BulkExportSecurityMonitoringTerraformResources": { "tag": "Security Monitoring", "undo": {