Skip to content

Conversation

@chrisberkhout
Copy link
Contributor

@chrisberkhout chrisberkhout commented Oct 22, 2024

Proposed commit message

[aws_bedrock] Ignore non-policy data under ...trace.guardrail In existing pipeline tests, input documents only had policy data under `output.outputBodyJson.trace.guardrail.inputAssessment`, but now there is also `invocationMetrics` data. This change modifies the `get_guardrail_details` script to skip entries that don't have policy at the end of their name. It also adds cases to be processed in the `painless_to_rename_fields_under_aws_bedrock_groups` script, so that in the output, the naming of the new invocation metrics object matches the surrounding data. --------- Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co> 

Discussion

Existing pipeline tests had input documents with values under output.outputBodyJson.trace.guardrail.inputAssessment such as:

{ "l7n9e426howe": { "topicPolicy": { "topics": [ { "name": "Robbing A Bank", "type": "DENY", "action": "BLOCKED" } ] }, "contentPolicy": { "filters": [ { "type": "MISCONDUCT", "confidence": "HIGH", "action": "BLOCKED" } ] } } }

Now this has been observed:

{ "l4n3ea14nowf": { "contentPolicy": { "filters": [ { "type": "PROMPT_ATTACK", "confidence": "HIGH", "filterStrength": "HIGH", "action": "BLOCKED" } ] }, "invocationMetrics": { "guardrailProcessingLatency": 340, "usage": { "topicPolicyUnits": 0, "contentPolicyUnits": 1, "wordPolicyUnits": 0, "sensitiveInformationPolicyUnits": 0, "sensitiveInformationPolicyFreeUnits": 0, "contextualGroundingPolicyUnits": 0 }, "guardrailCoverage": { "textCharacters": { "guarded": 73, "total": 74 } } } } }

I chose to only process objects with keys ending in Policy (_policy after the renaming).

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

How to test this PR locally

The change is covered by a modified pipeline test.

Related issues

@chrisberkhout chrisberkhout requested a review from a team as a code owner October 22, 2024 13:38
@chrisberkhout chrisberkhout self-assigned this Oct 22, 2024
@chrisberkhout chrisberkhout added bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Integration:aws_bedrock Amazon Bedrock labels Oct 22, 2024
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@chrisberkhout chrisberkhout changed the title [aws_bedrock] Ignore non-policy data under ...guardrail.inputAssessment [aws_bedrock] Ignore non-policy data under ...trace.guardrail Oct 22, 2024
@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@chrisberkhout chrisberkhout merged commit 1a6fe15 into elastic:main Oct 22, 2024
4 of 5 checks passed
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @chrisberkhout

@elastic-vault-github-plugin-prod

Package aws_bedrock - 0.11.3 containing this change is available at https://epr.elastic.co/search?package=aws_bedrock

harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 4, 2025
…c#11487) In existing pipeline tests, input documents only had policy data under `output.outputBodyJson.trace.guardrail.inputAssessment`, but now there is also `invocationMetrics` data. This change modifies the `get_guardrail_details` script to skip entries that don't have policy at the end of their name. It also adds cases to be processed in the `painless_to_rename_fields_under_aws_bedrock_groups` script, so that in the output, the naming of the new invocation metrics object matches the surrounding data. --------- Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 5, 2025
…c#11487) In existing pipeline tests, input documents only had policy data under `output.outputBodyJson.trace.guardrail.inputAssessment`, but now there is also `invocationMetrics` data. This change modifies the `get_guardrail_details` script to skip entries that don't have policy at the end of their name. It also adds cases to be processed in the `painless_to_rename_fields_under_aws_bedrock_groups` script, so that in the output, the naming of the new invocation metrics object matches the surrounding data. --------- Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:aws_bedrock Amazon Bedrock Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

3 participants