Skip to content

Draft: Fix Syntax Bug in AiGatewayCodeGenerationMessage

What does this MR do and why?

While running code generation evaluations from prompt-lib, I kept getting the following error:

Request failed for POST http://gdk.test:3000/api/v4/code_suggestions/completions 422 {"detail":[{"type":"string_type","loc":["body",2,"prompt"],"msg":"Input should be a valid string","input":{"trigger_type":"comment","instruction":""}}]})

I traced it down to this line here.

def prompt
  params[:instruction] || DEFAULT_INSTRUCTION
end

params[:instruction] is an object, but prompt() is expected to return a string. Returning the instruction value of the instruction object fixes this issue.

Screenshot_2024-08-06_at_5.06.31_PM

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Julie Huang

Merge request reports

Loading