Add "intent" to code completion API
What does this MR do and why?
Adds a new parameter to the code completions endpoint that allows users to specify whether they want code completion or code generation suggestions.
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
- Specify the new intent parameter to the
api/v4/code_suggestions/completions
endpoint with a suitable payload
{
"prompt_version": 1,
"project_path": "gitlab-org/gitlab-shell",
"project_id": 33191677,
"current_file": {
"file_name": "test.py",
"content_above_cursor": "def is_even(n: int) ->",
"content_below_cursor": ""
},
"telemetry": [
{
"model_engine": "vertex-ai",
"model_name": "code-gecko",
"lang": "python",
"experiments": [
{
"name": "exp_truncate_suffix",
"variant": 0
}
],
"requests": 1,
"accepts": 1,
"errors": 0
}
],
"intent": "generation"
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #425788 (closed)
Edited by Allen Cook