Skip to content

Migrate explain_vulnerability prompt

What does this MR do and why?

Related to Migrate Duo Chat Tools: ExplainVulnerability (#475046 - closed)

In this MR, we:

  • Add prompt_migration_explain_vulnerability FF
  • Migrate the ExplainVulnerability tool to use the AIGW
  • Use UseAiGatewayAgentPrompt concern with a FF

How to set up and validate locally

  • Setup runners and the ExplainVulnerability context
  • Run AI Gateway with Anthropic debug: ANTHROPIC_LOG=debug poetry run ai_gateway
  • Checkout migrate-explain-vulnerability-tool in the AIGW
  • Enable prompt_migration_explain_vulnerability feature flag on Rails (::Feature.enable(:prompt_migration_explain_vulnerability))
  • Perform /vulnerability_explain slash command in Duo Chat, eg.. /vulnerability_explain #include <stdio.h> int main(int argc, char *argv[]) { char buf[8]; memcpy(&buf, "123456789"); printf("hello, world!"); }
  • Verify that /v1/prompts/chat//vulnerability_explain endpoint is called in the AIGW
  • Verify that the correct prompt is sent to Anthropic

I recorded a quick demo of the test results since setting up the environment would be very time-consuming.

Screen_Recording_2024-08-29_at_10.04.56

Edited by Mohamed Hamda

Merge request reports

Loading