Migrate RefactorCode tool to AIGW

What does this MR do and why?

Related to Migrate Duo Chat Tools: RefactorCode (#475048 - closed)

In this MR, we:

  • Add prompt_migration_refactor_code FF
  • Migrate the RefactorCode tool to use the AIGW
  • Use UseAiGatewayAgentPrompt concern with a FF

How to set up and validate locally

  • Run AI Gateway with Anthropic debug: ANTHROPIC_LOG=debug poetry run ai_gateway
  • Checkout migrate-refactor-code in the AIGW
  • Enable prompt_migration_refactor_code feature flag on Rails (::Feature.enable(:prompt_migration_refactor_code))
  • Perform /refactor slash command in Duo Chat, eg.. /refactor "Here is the summary for #{resource_name} ##{resource.iid} comments:"
  • Verify that /v1/prompts/chat/refactor_code endpoint is called in the AIGW
  • Verify that the correct prompt is sent to Anthropic
Edited by Mohamed Hamda

Merge request reports

Loading