feat: refactor so code completion uses prompt registry

What does this merge request do and why?

With !2957 (merged) merged, this MR begins addressing step 2 as detailed here for #906 (closed) by refactoring code completions to use the prompt registry. Note that cases with requires_prompt_registry set to False will need to be addressed in a follow-up MR.

How to set up and validate locally

  1. gdk start
  2. gdk stop gitlab-ai-gateway
  3. cd gitlab-development-kit/gitlab-ai-gateway
  4. poetry run ai_gateway to run the ai gateway separately from gdk
  5. In a separate tab navigate to the ai gateway directory again and run this request:
curl -X 'POST' 'http://0.0.0.0:5052/v2/code/completions' \
  -H 'Content-Type: application/json'  -H 'bypass-auth: true' \
  -d '{
  "current_file": {
    "file_name": "main.py",
    "language_identifier": "py",
    "content_above_cursor": "from djan",
    "content_below_cursor": ""
  },
  "prompt_version": 1,
  "model_provider": "fireworks_ai",
  "model_engine": "fireworks_ai",
  "model_identifier": "default",
  "model_name": "codestral-2501"
}'

If you get an error about Fireworks api keys, be sure to define the following in your .env file as per the example env:

# GitLab employees can use the "Fireworks development key" found in the engineering vault in 1password
AIGW_MODEL_KEYS__FIREWORKS_API_KEY=<DIRECT_CONNECT_API_KEY>
AIGW_MODEL_ENDPOINTS__FIREWORKS_REGIONAL_ENDPOINTS='{"us": {"qwen2p5-coder-7b": {"endpoint": "https://gitlab-ab7e8cb8.us-virginia-2.direct.fireworks.ai/v1","identifier": "accounts/fireworks/models/qwen2p5-coder-7b#accounts/gitlab/deployments/ab7e8cb8"},"codestral-2501": {"endpoint": "https://gitlab-15c6dc4b.us-arizona-1.direct.fireworks.ai/v1","identifier": "accounts/gitlab/models/codestral-2501"}}}'

Example response: Screenshot_2025-08-06_at_11.18.03_AM

Merge request checklist

  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.
Edited by Missy Davies

Merge request reports

Loading