Skip to content

Support Claude 2.1 in v1/chat/agent

Shinya Maeda requested to merge support-claude-2-1-duo-chat into main

What does this merge request do and why?

This MR adds support of Claude 2.1. in v1/chat/agent endpoint.

This is important as per https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/issues/370#note_1696390832 that prevents gitlab-org/gitlab!138818 (merged) from being a breaking change.

Related to https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/issues/370+ and Supporting GitLab Duo (chat) for SM and Dedicated (gitlab-org&11251 - closed) and Update Claude to 2.1 (gitlab-org/gitlab#432803 - closed)

How to set up and validate locally

Visit OpenAPI playground: http://0.0.0.0:5052/docs#/chat/chat_v1_chat_agent_post

Request with:

{
  "prompt_components": [
    {
      "type": "string",
      "metadata": {
        "source": "string",
        "version": "string"
      },
      "payload": {
        "content": "\n\nHuman: Hi, How are you?\n\nAssistant:",
        "provider": "anthropic",
        "model": "claude-2.1",
        "params": {
          "stop_sequences": [
            "\n\nHuman",
            "Observation:"
          ],
          "temperature": 0.2,
          "max_tokens_to_sample": 2048
        }
      }
    }
  ],
  "stream": false
}

Response:

{
  "response": " I'm doing well, thanks for asking!",
  "metadata": {
    "provider": "anthropic",
    "model": "claude-2.1",
    "timestamp": 1702872494
  }
}

Merge request checklist

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

Merge request reports