From 44b77c8fefa5814f271ec86087c13188a92f361d Mon Sep 17 00:00:00 2001 From: mo khan <mo@mokhan.ca> Date: Tue, 18 Apr 2023 10:14:01 -0600 Subject: [PATCH] Format explain vulnerability responses with markdown format headers Changelog: changed EE: true MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117902 --- ee/lib/gitlab/llm/open_ai/templates/explain_vulnerability.rb | 3 +++ .../gitlab/llm/open_ai/templates/explain_vulnerability_spec.rb | 2 ++ 2 files changed, 5 insertions(+) diff --git a/ee/lib/gitlab/llm/open_ai/templates/explain_vulnerability.rb b/ee/lib/gitlab/llm/open_ai/templates/explain_vulnerability.rb index d04055bfad3d33..2f296a927b72c3 100644 --- a/ee/lib/gitlab/llm/open_ai/templates/explain_vulnerability.rb +++ b/ee/lib/gitlab/llm/open_ai/templates/explain_vulnerability.rb @@ -58,6 +58,7 @@ def default_prompt Provide a code example with syntax highlighting on how to exploit it. Provide a code example with syntax highlighting on how to fix it. + Provide the response in markdown format with headers. PROMPT end @@ -68,6 +69,7 @@ def prompt_without_code The vulnerable code is in the file "#{filename}". Provide a code example with syntax highlighting on how to exploit it. Provide a code example with syntax highlighting on how to fix it. + Provide the response in markdown format with headers. PROMPT end @@ -77,6 +79,7 @@ def prompt_without_file_or_code Explain the vulnerability "#{title} - #{description} (#{identifiers})". Provide a code example with syntax highlighting on how to exploit it. Provide a code example with syntax highlighting on how to fix it. + Provide the response in markdown format with headers. PROMPT end end diff --git a/ee/spec/lib/gitlab/llm/open_ai/templates/explain_vulnerability_spec.rb b/ee/spec/lib/gitlab/llm/open_ai/templates/explain_vulnerability_spec.rb index 2fa8edceec7eef..188b45d42cb424 100644 --- a/ee/spec/lib/gitlab/llm/open_ai/templates/explain_vulnerability_spec.rb +++ b/ee/spec/lib/gitlab/llm/open_ai/templates/explain_vulnerability_spec.rb @@ -79,6 +79,7 @@ The vulnerable code is in the file "#{vulnerability.file}". Provide a code example with syntax highlighting on how to exploit it. Provide a code example with syntax highlighting on how to fix it. + Provide the response in markdown format with headers. PROMPT end end @@ -95,6 +96,7 @@ Explain the vulnerability "#{vulnerability.title} - #{vulnerability.description} (#{identifiers})". Provide a code example with syntax highlighting on how to exploit it. Provide a code example with syntax highlighting on how to fix it. + Provide the response in markdown format with headers. PROMPT expect(subject.to_prompt).to eq(expected) -- GitLab