Rename and add fields additional context rest api
What does this MR do and why?
Resolves #481748 (closed), related to !164919 (merged), and gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!1302 (merged)
This MR makes the following adjustments to support changes to the additional_context REST api to align with the GraphQL API as decided here:
- renames
name->id - renames
type->category - adds
metadata- a new field with JSON type
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
How to set up and validate locally
Use cURL or PostMan to send a request to the Chat endpoint with additional context and verify it doesn't error:
http://gdk.test:3000/api/v4/chat/completions
{
"content": "How can I write a method to say hello to someone based on these snippets?",
"with_clean_history": true,
"additional_context": [
{
"id": "postman_snippet_1.rb",
"category": "snippet",
"content": "puts 'Hello, World!'",
"metadata": {"random": "hash"}
},
{
"id": "postman_snippet_2.rb",
"category": "snippet",
"content": "def say_name(name)\n puts \"Hello, #{name}!\"\nend\n\nsay_name('Melissa')"
}
]
}
Edited by Missy Davies