Skip to content

Implement Anthropic experimentation API

Patrick Bajao requested to merge 409816-anthropic-experimentation-api into master

What does this MR do and why?

This implements the /api/v4/ai/experimentation/anthropic/complete endpoint that team members can use to interact with Anthropic API.

Just like other experimentation API, workhorse will handle the actual request.

This is behind the following feature flags:

  • anthropic_experimentation
  • ai_experimentation_api

How to set up and validate locally

  1. Set your API key via rails console: Gitlab::CurrentSettings.update!(anthropic_api_key: <insert API key>). If you don't have one yet, create one in https://console.anthropic.com/account/keys if you have access.
  2. Enable anthropic_experimentation and ai_experimentation_api feature flags.
  3. Make a POST request to http://localhost:3000/api/v4/ai/experimentation/anthropic/complete with the following body:
{
  'prompt':'Hi',
  'model':'claude-v1.3',
  'max_tokens_to_sample':100
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #409816

Merge request reports