Skip to content

Support Claude 3 models for Code Suggestions

Allen Cook requested to merge acook/claude-3-code-generation into main

What does this merge request do and why?

Adds support for Claude 3 to model gateway for code generation

How to set up and validate locally

Send a request with a messages based prompt to the v2 code generations endpoint

## AI Gateway Messages Generation
curl -X "POST" "http://localhost:5052/v2/code/generations" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "current_file": {
    "content_below_cursor": "string",
    "file_name": "string",
    "language_identifier": "string",
    "content_above_cursor": "string"
  },
  "stream": false,
  "model_name": "claude-3-opus-20240229",
  "prompt": [
    {
      "content": "You are a tremendously accurate and skilled coding autocomplete agent. We want to generate new Go code inside the\\nfile \'test.go\' based on instructions from the user. Return code enclosed in <new_code></new_code> tags. If you are not able to write code based on the given instructions return an empty result like <new_code></new_code>.",
      "role": "system"
    },
    {
      "content": "Write a function to parse an environment file.",
      "role": "user"
    },
    {
      "content": "<new_code>",
      "role": "assistant"
    }
  ],
  "telemetry": [],
  "model_provider": "anthropic",
  "prompt_version": 3
}'

Merge request checklist

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

Merge request reports