Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM Rule Migration] Minor prompt improvements #201941

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

P1llus
Copy link
Member

@P1llus P1llus commented Nov 27, 2024

Summary

Adding some minor improvements and modifies the format on some of the prompts used in the siem_migration process, a few specifics below:

  1. Moved prebuilt rules matching to JSON output parsing, as its less prone for issues on some models.
  2. Moved some of the formatting of the prompts to focus on xml-like tags, as it often gives good results on multiple models. Also context that is relevant to perform an action is moved to system, while context related to the question (and to the response) is kept in the human prompt.
  3. Moved process_query to ChatPromptTemplate, moved the collection of ResourceContext outside of the prompt because of this.

@P1llus P1llus added release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Nov 27, 2024
@P1llus P1llus requested a review from a team as a code owner November 27, 2024 11:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@P1llus P1llus added backport:version Backport to applied version labels v8.18.0 and removed backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Nov 27, 2024
Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@P1llus P1llus self-assigned this Nov 27, 2024
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @P1llus

@P1llus P1llus merged commit eb87889 into elastic:main Nov 27, 2024
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12053476453

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 201941

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 28, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 201941 locally

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 201941 locally

semd pushed a commit to semd/kibana that referenced this pull request Nov 30, 2024
## Summary

Adding some minor improvements and modifies the format on some of the
prompts used in the siem_migration process, a few specifics below:

1. Moved prebuilt rules matching to JSON output parsing, as its less
prone for issues on some models.
2. Moved some of the formatting of the prompts to focus on xml-like
tags, as it often gives good results on multiple models. Also context
that is relevant to perform an action is moved to system, while context
related to the question (and to the response) is kept in the human
prompt.
3. Moved process_query to ChatPromptTemplate, moved the collection of
ResourceContext outside of the prompt because of this.

(cherry picked from commit eb87889)

# Conflicts:
#	x-pack/plugins/security_solution/server/lib/siem_migrations/rules/task/agent/nodes/match_prebuilt_rule/match_prebuilt_rule.ts
@semd
Copy link
Contributor

semd commented Nov 30, 2024

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

semd added a commit that referenced this pull request Nov 30, 2024
)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[SIEM Rule Migration] Minor prompt improvements
(#201941)](#201941)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marius
Iversen","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-27T15:30:34Z","message":"[SIEM
Rule Migration] Minor prompt improvements (#201941)\n\n##
Summary\n\nAdding some minor improvements and modifies the format on
some of the\nprompts used in the siem_migration process, a few specifics
below:\n\n1. Moved prebuilt rules matching to JSON output parsing, as
its less\nprone for issues on some models.\n2. Moved some of the
formatting of the prompts to focus on xml-like\ntags, as it often gives
good results on multiple models. Also context\nthat is relevant to
perform an action is moved to system, while context\nrelated to the
question (and to the response) is kept in the human\nprompt.\n3. Moved
process_query to ChatPromptTemplate, moved the collection
of\nResourceContext outside of the prompt because of
this.","sha":"eb87889934bbe693b6fa410a366a1e46ad136242","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","Team:
SecuritySolution","backport:version","v8.18.0"],"number":201941,"url":"https://github.com/elastic/kibana/pull/201941","mergeCommit":{"message":"[SIEM
Rule Migration] Minor prompt improvements (#201941)\n\n##
Summary\n\nAdding some minor improvements and modifies the format on
some of the\nprompts used in the siem_migration process, a few specifics
below:\n\n1. Moved prebuilt rules matching to JSON output parsing, as
its less\nprone for issues on some models.\n2. Moved some of the
formatting of the prompts to focus on xml-like\ntags, as it often gives
good results on multiple models. Also context\nthat is relevant to
perform an action is moved to system, while context\nrelated to the
question (and to the response) is kept in the human\nprompt.\n3. Moved
process_query to ChatPromptTemplate, moved the collection
of\nResourceContext outside of the prompt because of
this.","sha":"eb87889934bbe693b6fa410a366a1e46ad136242"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201941","number":201941,"mergeCommit":{"message":"[SIEM
Rule Migration] Minor prompt improvements (#201941)\n\n##
Summary\n\nAdding some minor improvements and modifies the format on
some of the\nprompts used in the siem_migration process, a few specifics
below:\n\n1. Moved prebuilt rules matching to JSON output parsing, as
its less\nprone for issues on some models.\n2. Moved some of the
formatting of the prompts to focus on xml-like\ntags, as it often gives
good results on multiple models. Also context\nthat is relevant to
perform an action is moved to system, while context\nrelated to the
question (and to the response) is kept in the human\nprompt.\n3. Moved
process_query to ChatPromptTemplate, moved the collection
of\nResourceContext outside of the prompt because of
this.","sha":"eb87889934bbe693b6fa410a366a1e46ad136242"}},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Marius Iversen <[email protected]>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Nov 30, 2024
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
## Summary

Adding some minor improvements and modifies the format on some of the
prompts used in the siem_migration process, a few specifics below:

1. Moved prebuilt rules matching to JSON output parsing, as its less
prone for issues on some models.
2. Moved some of the formatting of the prompts to focus on xml-like
tags, as it often gives good results on multiple models. Also context
that is relevant to perform an action is moved to system, while context
related to the question (and to the response) is kept in the human
prompt.
3. Moved process_query to ChatPromptTemplate, moved the collection of
ResourceContext outside of the prompt because of this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants