chore: reintroduce "Refactor Code Completions to use Prompt Registry in all cases"
What does this merge request do and why?
Reintroduces !3065 (merged) and fixes the production errors mentioned in !3065 (comment 2790750631)
The production errors were caused by routing all code completion through CodeCompletion
processor which contained a bug when it could not determine the language of the file
editor_lang or resolve_lang_name(file_name)
might return None
, which then calls lower()
on the result.
The AmazonQModel
branch already handled this, but putting more code completions through AgentModel
caused it to be exposed there as well
Updating the AmazonQModel
completion branch to handle when the language is None
should take care of the issue.
Also updates the prompt registry solution to properly handle prompt caching and session ids for Fireworks models
How to set up and validate locally
curl -X "POST" "http://localhost:5052/v2/code/completions" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"project_path": "gitlab-org/gitlab-shell",
"current_file": {
"file_name": "test.py",
"content_above_cursor": "def is_even(n: int) ->",
"content_below_cursor": ""
},
"choices_count": 2,
"prompt_version": 1,
"project_id": 33191677
}'
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed. -
If this change requires executor implementation: verified that issues/MRs exist for both Go executor and Node executor or confirmed that changes are backward-compatible and don't break existing executor functionality.
Closes #906
Edited by Allen Cook