Add /v1/chat/agent endpoint (with `prompt_components` list)
What does this merge request do and why?
See the discussion on the payload structure in gitlab-org/gitlab!135837 (comment 1645445571)
We expect a prompt_components
list, but expect only a single element.
Introduces the first iteration of the /v1/chat/agent
endpoint that will be used to enable Duo Chat for Self-Managed users.
Response streaming will be introduced in a separate follow-up MR.
Screenshots
Happy path
Receiving multiple prompt_components (not expected)
How to set up and validate locally
- Pull the branch
- Start the instance
- Open http://0.0.0.0:5052/docs#/chat/chat_v1_chat_agent_post
- Send the payload, example below:
{
"prompt_components": [
{
"type": "prompt",
"metadata": {
"source": "test-source",
"version": "no-version"
},
"payload": {
"content": "\n\nHuman: hello, what is your name?\n\nAssistant:",
"provider": "anthropic",
"model": "claude-2"
}
}
]
}
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Closes #317 (closed)
Edited by Aleksei Lipniagov