fix: force completions/generations to be in appropriate list form
What does this merge request do and why?
fix: force completions/generations to be in appropriate list form
Requesting completion(v2/code/completions) when using the AI gateway with a AIGW_USE_FAKE_MODELS set to true yields a 500 error. This was occurring because the mock response was returning a single entry instead of a list.
In a similar but opposite fashion, requesting generations (v2/code/generations) was also yielding a 500 error as it was expecting a single entry but was sometimes receiving a list.
This MR aims to fix these issues.
related issue: #497 (closed)
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Check out to this merge request's branch.
- Set
AIGW_USE_FAKE_MODELS
totrue
in your .env file - Head to http://localhost:5052/docs
- Using the following prompt:
{
"prompt_version": 1,
"telemetry":
[],
"current_file":
{
"file_name": "/test.rb",
"content_above_cursor": "def set_name(whitespace_name)\\\\n this.name = whitespace_name.",
"content_below_cursor": "\\n\\n\\n\\n\\n",
"language_identifier": "ruby"
},
"intent": "completion"
}
execute the v2/code/generations
and v2/code/completions
endpoints and ensure you receive an OK response.
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Closes #497 (closed)
Edited by Jeff Park