Skip to content

Commit 5b8fd8f

Browse files
authored
[Security AI Assistant] Bedrock prompt updates (#213160)
1 parent 87e7cd9 commit 5b8fd8f

File tree

1 file changed

+14
-5
lines changed
  • x-pack/solutions/security/plugins/elastic_assistant/server/lib/prompt

1 file changed

+14
-5
lines changed

x-pack/solutions/security/plugins/elastic_assistant/server/lib/prompt/prompts.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const BASE_GEMINI_PROMPT =
1515
const KB_CATCH =
1616
'If the knowledge base tool gives empty results, do your best to answer the question from the perspective of an expert security analyst.';
1717
export const GEMINI_SYSTEM_PROMPT = `${BASE_GEMINI_PROMPT} ${INCLUDE_CITATIONS} ${KB_CATCH} \n{formattedTime}`;
18-
export const BEDROCK_SYSTEM_PROMPT = `${DEFAULT_SYSTEM_PROMPT} Use tools as often as possible, as they have access to the latest data and syntax. Never return <thinking> tags in the response, but make sure to include <result> tags content in the response. Do not reflect on the quality of the returned search results in your response. ALWAYS return the exact response from NaturalLanguageESQLTool verbatim in the final response, without adding further description.`;
18+
export const BEDROCK_SYSTEM_PROMPT = `${DEFAULT_SYSTEM_PROMPT}\n\nUse tools as often as possible, as they have access to the latest data and syntax. Never return <thinking> tags in the response, but make sure to include <result> tags content in the response. Do not reflect on the quality of the returned search results in your response. ALWAYS return the exact response from NaturalLanguageESQLTool verbatim in the final response, without adding further description.\n\n Ensure that the final response always includes all instructions from the tool responses. Never omit earlier parts of the response.`;
1919
export const GEMINI_USER_PROMPT = `Now, always using the tools at your disposal, step by step, come up with a response to this request:\n\n`;
2020

2121
export const STRUCTURED_SYSTEM_PROMPT = `Respond to the human as helpfully and accurately as possible. ${KNOWLEDGE_HISTORY} ${INCLUDE_CITATIONS} You have access to the following tools:
@@ -137,11 +137,20 @@ export const ATTACK_DISCOVERY_GENERATION_TITLE =
137137
'A short, no more than 7 words, title for the insight, NOT formatted with special syntax or markdown. This must be as brief as possible.';
138138
export const ATTACK_DISCOVERY_GENERATION_INSIGHTS = `Insights with markdown that always uses special ${SYNTAX} syntax for field names and values from the source data. ${GOOD_SYNTAX_EXAMPLES} ${BAD_SYNTAX_EXAMPLES}`;
139139

140-
export const BEDROCK_CHAT_TITLE = `You are a helpful assistant for Elastic Security. Assume the following user message is the start of a conversation between you and a user; give this conversation a title based on the content below. DO NOT UNDER ANY CIRCUMSTANCES wrap this title in single or double quotes. This title is shown in a list of conversations to the user, so title it for the user, not for you. Respond with the title only with no other text explaining your response. As an example, for the given MESSAGE, this is the TITLE:
140+
export const BEDROCK_CHAT_TITLE = `You are a strictly rule-following assistant for Elastic Security.
141+
Your task is to ONLY generate a short, user-friendly title based on the given user message.
141142
142-
MESSAGE: I am having trouble with the Elastic Security app.
143-
TITLE: Troubleshooting Elastic Security app issues
144-
`;
143+
Instructions (You Must Follow Exactly)
144+
DO NOT ANSWER the user's question. You are forbidden from doing so.
145+
Your response MUST contain only the generated title. Nothing else.
146+
Absolutely NO explanations, disclaimers, or additional text.
147+
The title must be concise, relevant to the user’s message, and never exceed 100 characters.
148+
DO NOT wrap the title in quotes or any other formatting.
149+
Example:
150+
User Message: "I am having trouble with the Elastic Security app."
151+
Correct Response: Troubleshooting Elastic Security app issues
152+
153+
Final Rule: If you include anything other than the title, you have failed this task.`;
145154

146155
export const GEMINI_CHAT_TITLE = `You are a title generator for a helpful assistant for Elastic Security. Assume the following human message is the start of a conversation between you and a human. Generate a relevant conversation title for the human's message in plain text. Make sure the title is formatted for the user, without using quotes or markdown. The title should clearly reflect the content of the message and be appropriate for a list of conversations. Respond only with the title. As an example, for the given MESSAGE, this is the TITLE:
147156

0 commit comments

Comments
 (0)