Add anthropic version header to experimentation api
What does this MR do and why?
This change is needed to add the explicit anthropic version header to the experimentation api. This header is present in all non 'experimental api' Anthropic calls and the development of the AI Gateway endpoint that Anthropic request will be forwarded to is designed to require it.
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
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- In rails console enable the experimentation api
Feature.enable(:ai_experimentation_api)
- Set Anthropic API KEY
Gitlab::CurrentSettings.update!(anthropic_api_key:<ANTHROPIC API KEY>)
- Execute the following
curl
CLI in your terminal:
curl --location 'http://127.0.0.1:3000/api/v4/ai/experimentation/anthropic/complete' \
--header 'Content-Type: application/json' \
--data '{
"model": "claude-2.1",
"max_tokens_to_sample": 1024,
"prompt": "\n\nHuman: Hello\n\nAssistant:"
}'
Edited by Michael Thomas